Skip to content
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

S3 user data support for AWSMachinePool #592

Merged
merged 9 commits into from
Jun 6, 2024

Conversation

AndiDog
Copy link

@AndiDog AndiDog commented Jun 5, 2024

Towards giantswarm/roadmap#3442

Upstream CAPA supports putting EC2 user data into S3 buckets, but only for single AWSMachines, as we use for the control plane. For machine pools, it's more complicated. Since we're exceeding the user data size limit of AWS, I implemented this feature.

Tested:

  • Cluster creation
  • Regular addition of launch template version with latest bootstrap join token
  • Cluster upgrade to cluster-aws with changed bootstrap config – nodes roll out correctly, no reconciliation death loop observed

@AndiDog AndiDog requested a review from a team June 5, 2024 22:05
@@ -57,20 +59,21 @@ const (
// ReconcileLaunchTemplate reconciles a launch template and triggers instance refresh conditionally, depending on
// changes.
//
//nolint:gocyclo
//nolint:gocyclo,maintidx
func (s *Service) ReconcileLaunchTemplate(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR contains quite some interface changes, parameter additions, etc. So I'm marking a few of the most important spots where the actual feature is implemented.

Main change number 1

@@ -78,6 +79,10 @@ func (s *Service) ReconcileBucket() error {
return errors.Wrap(err, "ensuring bucket policy")
}

if err := s.ensureBucketLifecycleConfiguration(bucketName); err != nil {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main change number 2 (including the IAM permission; note how it was already present in our CAPA IAM role)

@@ -161,6 +166,51 @@ func (s *Service) Create(m *scope.MachineScope, data []byte) (string, error) {
return objectURL.String(), nil
}

func (s *Service) CreateForMachinePool(scope scope.LaunchTemplateScope, data []byte) (string, error) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main change number 3

@AndiDog AndiDog merged commit 0bcf5b8 into release-2.3 Jun 6, 2024
3 of 5 checks passed
fiunchinho pushed a commit that referenced this pull request Jul 1, 2024
fiunchinho added a commit that referenced this pull request Jul 4, 2024
* Add Giant Swarm fork modifications

* Push to Azure registry

* aws-cni-deleted-helm-managed-resources

* import-order

* Filter CNI subnets when creating EKS NodeGroup

* add godoc

* 🐛 Create a `aws.Config` with region to be able to work different AWS partition (like gov cloud or china AWS partition) (#588)

* create-aws-client-with-region

* 🐛 Add ID to secondary subnets (#589)

* give name to secondary subnets

* make linter happy

* Add non root volumes to AWSMachineTemplate

* Support adding custom secondary VPC CIDR blocks in `AWSCluster` (backport) (#590)

* S3 user data support for `AWSMachinePool` (#592)

* Delete machine pool user data files that did not get deleted yet by the lifecycle policy (#593)

* Delete machine pool user data files that did not get deleted yet by the lifecycle policy

* Use paging for S3 results

* Log S3 list operation

* Handle NotFound

* Remove duplicated argument

* Add `make test` to Circle CI build, S3 test fixes (#596)

* Cancel instance refresh on any relevant change to ASG instead of blocking until previous one is finished (which may have led to failing nodes due to outdated join token) (#598)

* Use feature gate for S3 storage (#599)

* Fixes after cherry-pick our customizations

---------

Co-authored-by: Andreas Sommer <andreas@giantswarm.io>
Co-authored-by: calvix <vaclav@giantswarm.io>
Co-authored-by: Mario Nitchev <marionitchev@gmail.com>
Co-authored-by: calvix <rozsypalek.vaclav@gmail.com>
fiunchinho pushed a commit that referenced this pull request Aug 21, 2024
fiunchinho pushed a commit that referenced this pull request Aug 27, 2024
fiunchinho added a commit that referenced this pull request Sep 9, 2024
* Add Giant Swarm fork modifications

* aws-cni-deleted-helm-managed-resources

* Filter CNI subnets when creating EKS NodeGroup

* Add non root volumes to AWSMachineTemplate

* Support adding custom secondary VPC CIDR blocks in `AWSCluster` (backport) (#590)

* S3 user data support for `AWSMachinePool` (#592)

* Add GS workflow action

---------

Co-authored-by: Andreas Sommer <andreas@giantswarm.io>
Co-authored-by: calvix <vaclav@giantswarm.io>
Co-authored-by: Mario Nitchev <marionitchev@gmail.com>
AndiDog added a commit that referenced this pull request Nov 11, 2024
AndiDog added a commit that referenced this pull request Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants