-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Support storing Ignition user data in S3 bucket for AWSMachinePool
#5318
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test pull-cluster-api-provider-aws-test |
/test pull-cluster-api-provider-aws-e2e |
1 similar comment
/test pull-cluster-api-provider-aws-e2e |
@@ -280,7 +296,7 @@ func (r *AWSMachinePoolReconciler) reconcileNormal(ctx context.Context, machineP | |||
machinePoolScope.Info("starting instance refresh", "number of instances", machinePoolScope.MachinePool.Spec.Replicas) | |||
return asgsvc.StartASGInstanceRefresh(machinePoolScope) | |||
} | |||
if err := reconSvc.ReconcileLaunchTemplate(machinePoolScope, ec2Svc, canUpdateLaunchTemplate, runPostLaunchTemplateUpdateOperation); err != nil { | |||
if err := reconSvc.ReconcileLaunchTemplate(machinePoolScope, machinePoolScope, s3Scope, ec2Svc, objectStoreSvc, canUpdateLaunchTemplate, runPostLaunchTemplateUpdateOperation); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to pass the same machinePoolScope
twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It gets cast to two different interfaces (IgnitionScope
and LaunchTemplateScope
). The number of small interfaces is to blame here, but many of them are needed to easily mock functionality or share functionality between regular and EKS cluster code and types.
@@ -607,7 +623,7 @@ func machinePoolToInfrastructureMapFunc(gvk schema.GroupVersionKind) handler.Map | |||
} | |||
} | |||
|
|||
func (r *AWSMachinePoolReconciler) getInfraCluster(ctx context.Context, log *logger.Logger, cluster *clusterv1.Cluster, awsMachinePool *expinfrav1.AWSMachinePool) (scope.EC2Scope, error) { | |||
func (r *AWSMachinePoolReconciler) getInfraCluster(ctx context.Context, log *logger.Logger, cluster *clusterv1.Cluster, awsMachinePool *expinfrav1.AWSMachinePool) (scope.EC2Scope, scope.S3Scope, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there is no case where the first and second returned values are different. They are always both the same value, either nil
or clusterScope
or managedControlplaneScope
. If both always have the same value, couldn't we just return one instead of two values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above comment regarding interfaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
What this PR does / why we need it:
Reopened from #5172 because of branch issues.
EC2 user data is insecure and very limited in size (16 KB). Use the S3 bucket storage also for machine pools. The difference to
AWSMachine
is that the S3 objects must stay around because a new instance could be started by the ASG at any time, and user data with a valid token must exist. Both a lifecycle policy for regular deletion, and explicit S3 object deletion requests, are used for cleanup, so that normally, only 1-3 launch template versions' user data are stored in S3. Each launch template version relates to one S3 object.What type of PR is this?
/kind feature
Which issue(s) this PR fixes:
Didn't find an existing issue. My company ran into EC2 user data size limit problems.
Special notes for your reviewer:
This change has been successfully used in the Giant Swarm fork of CAPA since July 2024, on production clusters. I have adapted the change to the latest upstream changes, in particular the introduction of
IgnitionStorageTypeOption
(#4700) and made sure the previous default storage type is kept. Therefore, I retested this feature using Tilt on a plain CAPI@main + CAPA@main setup, with AWSCluster + Flatcar AMI + AWSMachinePool in my manifests.Checklist:
Release note: