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

FluxCDAddon should wait for CRDs #1125

Open
hlascelles opened this issue Mar 12, 2025 · 2 comments
Open

FluxCDAddon should wait for CRDs #1125

hlascelles opened this issue Mar 12, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@hlascelles
Copy link

hlascelles commented Mar 12, 2025

Describe the bug

When installing FluxCDAddon, and specifying GitRepositories or Kustomizations, we can see a race condition (despite addDependencies) that fails the install as CRDs are not ready in time.

MyStack | 12/52 | 3:59:34 PM | CREATE_FAILED        | Custom::AWSCDK-EKS-KubernetesResource | MyStack/manifest-fluxcd-addonkustomizationdeploys0/Resource/Default 
(MyStackmanifestfluxcdaddonkustomizationdeploys069E26670) Received response status [FAILED] from custom 
resource. Message returned: Error: b'error: resource mapping not found for name: "deploys-0" namespace: 
"flux-system" from "/tmp/manifest.yaml": no matches for kind "Kustomization" in version 
"kustomize.toolkit.fluxcd.io/v1beta2"\nensure CRDs are installed first\n'

If the AddOn is installed with no GitRepositories or Kustomizations, then it installs fine, and then updated with GitRepositories or Kustomizations, they install fine too.

Expected Behavior

The Helm chart install should wait for the CRDs to be ready so the GitRepositories or Kustomizations can be added.

Current Behavior

The helm install does not wait for the CRDs and the GitRepositories or Kustomizations fail, causing a stack rollback.

Reproduction Steps

Add the addon while specifying resources:

    return new FluxCDAddOn({
      createNamespace: true,
      namespace: "flux-system",
      version: "2.14.0",
      repositories: [
        {
          name: "myrepo",
          secretRefName: "foo",
          namespace: "flux-system",
          syncInterval: "1m",
          repository: { // Note we are supplying resources here that need the CRDs
            repoUrl: "ssh://[email protected]/acme/myrepo.git",
            targetRevision: "master",
          },
          values: {},
          kustomizations: [ // Note we are supplying resources here that need the CRDs
            {
              syncInterval: "1m",
              prune: true,
              timeout: "1m",
              kustomizationPath: `./default`
            }
          ]
        }
      ],
      values: {},
    });
  };

Sometimes, when installing, the CRDs will not be ready in time and the installation as a whole fails.

Possible Solution

Add a wait to the helm install as was done here: #514

The fix should go here:

const chart = this.addHelmChart(clusterInfo, values);

Additional Information/Context

No response

CDK CLI Version

2.1000.2 (build bc82193)

EKS Blueprints Version

1.16.3

Node.js Version

v22.14.0

Environment details (OS name and version, etc.)

Any

Other information

No response

@hlascelles hlascelles added the bug Something isn't working label Mar 12, 2025
@shapirov103
Copy link
Collaborator

@elamaran11 have you seen this behavior? Potentially having a wait condition in resource apply maybe one of the things to consider.

@elamaran11
Copy link
Collaborator

@shapirov103 I have not seen this but i would agree it needs a wait condition in apply as a fix. @arunvthangaraj Can you take a look in to this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants