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

feat(eks): Support bootstrap.sh --dns-cluster-ip arg #13890

Merged
merged 3 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/@aws-cdk/aws-eks/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,16 @@ export interface BootstrapOptions {
*/
readonly dockerConfigJson?: string;

/**

* Overrides the IP address to use for DNS queries within the
* cluster.
*
* @default - 10.100.0.10 or 172.20.0.10 based on the IP
* address of the primary interface.
*/
readonly dnsClusterIp?: string;

/**
* Extra arguments to add to the kubelet. Useful for adding labels or taints.
*
Expand Down
4 changes: 4 additions & 0 deletions packages/@aws-cdk/aws-eks/lib/user-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export function renderAmazonLinuxUserData(clusterName: string, autoScalingGroup:
extraArgs.push(`--docker-config-json '${options.dockerConfigJson}'`);
}

if (options.dnsClusterIp) {
extraArgs.push(`--dns-cluster-ip ${options.dnsClusterIp}`);
}

if (options.additionalArgs) {
extraArgs.push(options.additionalArgs);
}
Expand Down
14 changes: 14 additions & 0 deletions packages/@aws-cdk/aws-eks/test/test.user-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ export = {
test.done();
},

'--dns-cluster-ip'(test: Test) {
// GIVEN
const { asg, stack } = newFixtures();

// WHEN
const userData = stack.resolve(renderAmazonLinuxUserData('my-cluster-name', asg, {
dnsClusterIp: '192.0.2.53',
}));

// THEN
test.deepEqual(userData[1], '/etc/eks/bootstrap.sh my-cluster-name --kubelet-extra-args "--node-labels lifecycle=OnDemand" --use-max-pods true --dns-cluster-ip 192.0.2.53');
test.done();
},

'--docker-config-json'(test: Test) {
// GIVEN
const { asg } = newFixtures();
Expand Down