Skip to content

Commit 5ac3588

Browse files
committed
Add EventBridge ec2 event reconciliation and rule creation to eks managed control planes
1 parent 1424bef commit 5ac3588

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"
@@ -253,6 +254,14 @@ func (r *AWSManagedControlPlaneReconciler) reconcileNormal(ctx context.Context,
253254
return reconcile.Result{}, fmt.Errorf("failed to reconcile control plane for AWSManagedControlPlane %s/%s: %w", awsManagedControlPlane.Namespace, awsManagedControlPlane.Name, err)
254255
}
255256

257+
if feature.Gates.Enabled(feature.EventBridgeInstanceState) {
258+
instancestateSvc := instancestate.NewService(managedScope)
259+
if err := instancestateSvc.ReconcileEC2Events(); err != nil {
260+
// non fatal error, so we continue
261+
managedScope.Error(err, "non-fatal: failed to set up EventBridge")
262+
}
263+
}
264+
256265
if err := authService.ReconcileIAMAuthenticator(ctx); err != nil {
257266
conditions.MarkFalse(awsManagedControlPlane, ekscontrolplanev1.IAMAuthenticatorConfiguredCondition, ekscontrolplanev1.IAMAuthenticatorConfigurationFailedReason, clusterv1.ConditionSeverityError, err.Error())
258267
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)