Skip to content

Commit 82f2c7f

Browse files
authored
Merge pull request #3752 from cnmcavoy/cnmcavoy/eventbridge-eks
Add EventBridge ec2 event reconciliation and rule creation to eks managed control planes
2 parents 578244c + 5ac3588 commit 82f2c7f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

controlplane/eks/controllers/awsmanagedcontrolplane_controller.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import (
4343
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/eks"
4444
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/gc"
4545
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/iamauth"
46+
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/instancestate"
4647
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/kubeproxy"
4748
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/network"
4849
"sigs.k8s.io/cluster-api-provider-aws/v2/pkg/cloud/services/securitygroup"
@@ -254,6 +255,14 @@ func (r *AWSManagedControlPlaneReconciler) reconcileNormal(ctx context.Context,
254255
return reconcile.Result{}, fmt.Errorf("failed to reconcile control plane for AWSManagedControlPlane %s/%s: %w", awsManagedControlPlane.Namespace, awsManagedControlPlane.Name, err)
255256
}
256257

258+
if feature.Gates.Enabled(feature.EventBridgeInstanceState) {
259+
instancestateSvc := instancestate.NewService(managedScope)
260+
if err := instancestateSvc.ReconcileEC2Events(); err != nil {
261+
// non fatal error, so we continue
262+
managedScope.Error(err, "non-fatal: failed to set up EventBridge")
263+
}
264+
}
265+
257266
if err := authService.ReconcileIAMAuthenticator(ctx); err != nil {
258267
conditions.MarkFalse(awsManagedControlPlane, ekscontrolplanev1.IAMAuthenticatorConfiguredCondition, ekscontrolplanev1.IAMAuthenticatorConfigurationFailedReason, clusterv1.ConditionSeverityError, err.Error())
259268
return reconcile.Result{}, errors.Wrapf(err, "failed to reconcile aws-iam-authenticator config for AWSManagedControlPlane %s/%s", awsManagedControlPlane.Namespace, awsManagedControlPlane.Name)

test/e2e/data/e2e_eks_conf.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ variables:
118118
KUBERNETES_VERSION_MANAGEMENT: "v1.22.9" # Kind bootstrap
119119
EXP_MACHINE_POOL: "true"
120120
EXP_CLUSTER_RESOURCE_SET: "true"
121+
EVENT_BRIDGE_INSTANCE_STATE: "true"
121122
AWS_NODE_MACHINE_TYPE: t3.large
122123
AWS_MACHINE_TYPE_VCPU_USAGE: 2
123124
AWS_SSH_KEY_NAME: "cluster-api-provider-aws-sigs-k8s-io"

0 commit comments

Comments
 (0)