Skip to content

Commit b420033

Browse files
authored
feat(eks): Addon support configurationValues (#34061)
### Issue # (if applicable) Closes #34001 ### Description of changes `Addon` support configurationValues, both v1 and v2 ### Description of how you validated changes Unit + Integ ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 04061f2 commit b420033

17 files changed

+83
-16
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-addon.js.snapshot/EksClusterWithAddonStack.assets.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-addon.js.snapshot/EksClusterWithAddonStack.template.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,9 +526,9 @@
526526
"S3Bucket": {
527527
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
528528
},
529-
"S3Key": "9953ad4c3e84d120643ece4b2e51caf43fd9850063641b4d78bf30fbe6b4d381.zip"
529+
"S3Key": "6094cb0ff874f89ab5ab24fb6b9417df0fdeb6966645f90c88ec1d7e28130112.zip"
530530
},
531-
"Description": "/opt/kubectl/kubectl 1.30; /opt/helm/helm 3.17.1",
531+
"Description": "/opt/kubectl/kubectl 1.32.3; /opt/helm/helm 3.17.2",
532532
"LicenseInfo": "Apache-2.0"
533533
}
534534
},
@@ -849,7 +849,7 @@
849849
]
850850
},
851851
"Config": {
852-
"version": "1.30",
852+
"version": "1.32",
853853
"roleArn": {
854854
"Fn::GetAtt": [
855855
"ClusterRoleFA261979",
@@ -1157,6 +1157,7 @@
11571157
"ClusterName": {
11581158
"Ref": "Cluster9EE0221C"
11591159
},
1160+
"ConfigurationValues": "{\"replicaCount\":2}",
11601161
"PreserveOnDelete": true
11611162
}
11621163
}

packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-addon.js.snapshot/asset.9953ad4c3e84d120643ece4b2e51caf43fd9850063641b4d78bf30fbe6b4d381.zip

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-addon.js.snapshot/tree.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-addon.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ class EksClusterStack extends Stack {
1111
const vpc = new ec2.Vpc(this, 'Vpc', { natGateways: 1 });
1212
const cluster = new eks.Cluster(this, 'Cluster', {
1313
vpc,
14-
...getClusterVersionConfig(this, eks.KubernetesVersion.V1_30),
14+
...getClusterVersionConfig(this, eks.KubernetesVersion.V1_32),
1515
});
1616

1717
new eks.Addon(this, 'Addon', {
1818
addonName: 'coredns',
1919
cluster,
2020
preserveOnDelete: true,
21+
configurationValues: {
22+
replicaCount: 2,
23+
},
2124
});
2225
}
2326
}

packages/@aws-cdk/aws-eks-v2-alpha/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,10 +1079,13 @@ declare const cluster: eks.Cluster;
10791079

10801080
new eks.Addon(this, 'Addon', {
10811081
cluster,
1082-
addonName: 'aws-guardduty-agent',
1083-
addonVersion: 'v1.6.1',
1082+
addonName: 'coredns',
1083+
addonVersion: 'v1.11.4-eksbuild.2',
10841084
// whether to preserve the add-on software on your cluster but Amazon EKS stops managing any settings for the add-on.
10851085
preserveOnDelete: false,
1086+
configurationValues: {
1087+
replicaCount: 2,
1088+
},
10861089
});
10871090
```
10881091

packages/@aws-cdk/aws-eks-v2-alpha/lib/addon.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ export interface AddonProps {
4949
* @default true
5050
*/
5151
readonly preserveOnDelete?: boolean;
52+
53+
/**
54+
* The configuration values for the Add-on.
55+
*
56+
* @default - Use default configuration.
57+
*/
58+
readonly configurationValues?: Record<string, any>;
5259
}
5360

5461
/**
@@ -144,6 +151,7 @@ export class Addon extends Resource implements IAddon {
144151
clusterName: this.clusterName,
145152
addonVersion: props.addonVersion,
146153
preserveOnDelete: props.preserveOnDelete,
154+
configurationValues: this.stack.toJsonString(props.configurationValues),
147155
});
148156

149157
this.addonName = this.getResourceNameAttribute(resource.ref);

0 commit comments

Comments
 (0)