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

Add FluxCD support for S3 Bucket sources #1007

Merged
merged 5 commits into from
Jun 19, 2024

Conversation

jkataja
Copy link
Contributor

@jkataja jkataja commented May 29, 2024

Issue #, if available:

Description of changes:

  • implement support for FluxCD Bucket source: https://fluxcd.io/flux/components/source/buckets/
  • bump FluxCD default version to 2.13.0
  • use the more reliable OCI registry for the FluxCD Helm chart
  • make indentation consistent within the modified files
  • changed typo in defaultKustomiationProps
  • basic use case tested
  • kustomizations not tested

Example use:

        .addOns(new blueprints.addons.FluxCDAddOn({
            buckets: [
                {
                    name: "bootstrap-bucket",
                    bucketName:base.bucket.bucketName,
                    bucketRegion: cdk.Aws.REGION,
                }
            ],
        }),

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Collaborator

@elamaran11 elamaran11 left a comment

Choose a reason for hiding this comment

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

Approach LGTM. @shapirov103 Pls check.

@jkataja
Copy link
Contributor Author

jkataja commented Jun 4, 2024

@shapirov103 Hi, do you require any inputs from me to test and review the pull request? For example how I setup the Flux CD source bucket.

@jkataja jkataja force-pushed the feature/fluxcd-bucket-source branch from f8744e2 to 7cef337 Compare June 12, 2024 20:22
Copy link
Collaborator

@shapirov103 shapirov103 left a comment

Choose a reason for hiding this comment

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

@jkataja thank you for this contribution, looks good overall, I added a couple of design/maintenance level comments.

As far as testing, please share an example that you used for validation. We need to run it manually in this case as flux is not continuously tested with the end-to-end tests.

kustomizations?: FluxKustomizationProps[];
}

/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

As far as design - therepository construct is effectively misused as a vehicle to carry bucket info. Consider a case when we add a URL validator (lack of it is a miss) to the repoUrl and start failing valid cases for the bucket name.
why not omit this structure from the type and introduce a clear bucket type?

Copy link
Contributor Author

@jkataja jkataja Jun 14, 2024

Choose a reason for hiding this comment

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

see commit 1c95b13

  • test bucket construct changes

chart: "flux2",
version: "2.13.0",
release: "blueprints-fluxcd-addon",
repository: "oci://ghcr.io/fluxcd-community/charts/flux2",
Copy link
Collaborator

Choose a reason for hiding this comment

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

with the switch to OCR, are you aware of a mechanism for us to discover when new versions of flux become available (other than manual look up)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

seems that gh release will show it but the output is not strictly for this chart:

$ gh release  list --repo fluxcd-community/helm-charts
flux2-sync-1.9.0           Latest  (flux2-sync-1.9.0)           about 1 month ago
flux2-notification-1.15.0          (flux2-notification-1.15.0)  about 1 month ago
flux2-2.13.0                       (flux2-2.13.0)               about 1 month ago
flux2-2.12.4                       (flux2-2.12.4)               about 3 months ago
flux2-sync-1.8.2                   (flux2-sync-1.8.2)           about 3 months ago
flux2-notification-1.14.1          (flux2-notification-1.14.1)  about 3 months ago
flux2-2.12.3                       (flux2-2.12.3)               about 3 months ago
flux2-notification-1.14.0          (flux2-notification-1.14.0)  about 4 months ago
flux2-sync-1.8.1                   (flux2-sync-1.8.1)           about 5 months ago
flux2-notification-1.13.1          (flux2-notification-1.13.1)  about 5 months ago
flux2-2.12.2                       (flux2-2.12.2)               about 5 months ago
flux2-2.12.1                       (flux2-2.12.1)               about 6 months ago
flux2-sync-1.8.0                   (flux2-sync-1.8.0)           about 6 months ago
flux2-notification-1.13.0          (flux2-notification-1.13.0)  about 6 months ago
flux2-2.12.0                       (flux2-2.12.0)               about 6 months ago
flux2-2.11.1                       (flux2-2.11.1)               about 7 months ago
flux2-sync-1.7.3                   (flux2-sync-1.7.3)           about 7 months ago
flux2-notification-1.12.4          (flux2-notification-1.12.4)  about 7 months ago
flux2-multi-tenancy-0.0.6          (flux2-multi-tenancy-0.0.6)  about 7 months ago
flux2-2.11.0                       (flux2-2.11.0)               about 7 months ago
flux2-2.10.6                       (flux2-2.10.6)               about 7 months ago
flux2-sync-1.7.2                   (flux2-sync-1.7.2)           about 7 months ago
flux2-notification-1.12.3          (flux2-notification-1.12.3)  about 7 months ago
flux2-2.10.5                       (flux2-2.10.5)               about 7 months ago
flux2-notification-1.12.2          (flux2-notification-1.12.2)  about 7 months ago
flux2-multi-tenancy-0.0.5          (flux2-multi-tenancy-0.0.5)  about 7 months ago
flux2-2.10.4                       (flux2-2.10.4)               about 7 months ago
flux2-2.10.3                       (flux2-2.10.3)               about 7 months ago
flux2-2.10.2                       (flux2-2.10.2)               about 8 months ago
flux2-sync-1.7.1                   (flux2-sync-1.7.1)           about 8 months ago

commented in 455a6a3

@jkataja
Copy link
Contributor Author

jkataja commented Jun 14, 2024

@jkataja thank you for this contribution, looks good overall, I added a couple of design/maintenance level comments.

You're welcome!

As far as testing, please share an example that you used for validation. We need to run it manually in this case as flux is not continuously tested with the end-to-end tests.

Sure, so I create the bucket in a separate stack using:

new s3.Bucket(this, "SourceBucket", {
      removalPolicy: cdk.RemovalPolicy.RETAIN,
      objectOwnership: s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,
    });

Allow the node role to access the bucket by using:

        base.bucket.grantRead(role);

And then initialize the FluxCD addon as follows:

    .addOns(new blueprints.addons.FluxCDAddOn({
        buckets: [
            {
                name: "bootstrap-bucket",
                bucketName:base.bucket.bucketName,
                bucketRegion: cdk.Aws.REGION,
            }
        ],
    }),
...

Contains untested changes. Edit: tested basic deployment without Kustomizations

@shapirov103 please take another look of the pull request, I have addressed the comments and tested manually.

@jkataja jkataja force-pushed the feature/fluxcd-bucket-source branch 2 times, most recently from 2ef8562 to c80694d Compare June 15, 2024 11:56
@jkataja
Copy link
Contributor Author

jkataja commented Jun 15, 2024

The pipeline started failing with the eksworkshop.com returning HTTP 403 with AccessDenied response from S3

Copy link
Collaborator

@shapirov103 shapirov103 left a comment

Choose a reason for hiding this comment

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

LGTM

@shapirov103
Copy link
Collaborator

/do-e2e-tests

Copy link

@aws-ia-ci aws-ia-ci left a comment

Choose a reason for hiding this comment

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

end to end tests passed

@elamaran11
Copy link
Collaborator

@jkataja Please merge from main, that should fix the GH Action errors.

@jkataja jkataja force-pushed the feature/fluxcd-bucket-source branch from c80694d to 031c2e5 Compare June 19, 2024 13:35
@jkataja
Copy link
Contributor Author

jkataja commented Jun 19, 2024

@elamaran11 I rebased on main, please try again

@elamaran11
Copy link
Collaborator

/do-e2e-tests

Copy link

@aws-ia-ci aws-ia-ci left a comment

Choose a reason for hiding this comment

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

end to end tests passed

@elamaran11
Copy link
Collaborator

@shapirov103 LG to merge.

@shapirov103 shapirov103 merged commit 7f38bbc into aws-quickstart:main Jun 19, 2024
2 checks passed
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.

4 participants