aws-quickstart / cdk-eks-blueprints

AWS Quick Start Team
Apache License 2.0
430 stars 190 forks source link

ClusterAutoScalerAddOn: Serviceaccount not deploying due to missing namespace dependency. #957

Closed Hounddog closed 3 months ago

Hounddog commented 3 months ago

Describe the bug

When deploying ClusterAutoScalerAddOn with a different Namespace, we receive a CloudFormation error:

Received response status [FAILED] from custom resource. Message returned: Error: b'Error from server (NotFound): error when creating "/tmp/manifest.yaml": namespaces "infra-system-autoscaler" not found\n' Logs: /aws/lambda/xxx at invokeUserFunction (/var/task/framework.js:2:6) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async onEvent (/var/task/framework.js:1:369) at async Runtime.handler (/var/task/cfn-response.js:1:1573) (RequestId: xxx)

Upon further inspection, there seems to be no dependencies between namespace and service account that are created as part of the addon.

Expected Behavior

I expect to deploy the addon successfully.

Current Behavior

The addon does NOT deploy, with the error produced from CloudFormation as mentioned in the bug report.

Reproduction Steps

The blueprint that I used to deploy is:

const addOns: Array<blueprints.ClusterAddOn> = [
  new blueprints.addons.ClusterAutoScalerAddOn(autoscalerAddonProperties)
];

We have extended the Properties which are passed to the blueprints.addon


import * as blueprints from "@aws-quickstart/eks-blueprints";
import { loadYaml, readYamlDocument } from "@aws-quickstart/eks-blueprints/dist/utils";

export const autoscalerAddonProperties: blueprints.ClusterAutoScalerAddOnProps = {
  repository: "oci://xxx.dkr.ecr.eu-central-1.amazonaws.com/infra/helm/cluster-autoscaler",
  version: "9.35.0",
  namespace: "autoscaler",
  createNamespace: true,
  values: loadYaml(readYamlDocument("./lib/base-services/autoscaler/values.yaml")),
};

### Possible Solution

Add dependencies to the namespace and serviceaccount.

### Additional Information/Context

_No response_

### CDK CLI Version

2.99.1

### EKS Blueprints Version

1.12.0

### Node.js Version

v20.9.0

### Environment details (OS name and version, etc.)

Ubuntu 22.04.4 LTS

### Other information

_No response_
elamaran11 commented 3 months ago

This issue is fixed, thanks for the PR @Hounddog closing this issue.