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

fix(eks): ConfigCommand and GetTokenCommand should output by default #33673

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-eks-v2-alpha/lib/cluster.ts
Original file line number Diff line number Diff line change
@@ -1325,7 +1325,7 @@ export class Cluster extends ClusterBase {
this.defineCoreDnsComputeType(CoreDnsComputeType.FARGATE);
}

const outputConfigCommand = (props.outputConfigCommand ?? true) && props.mastersRole;
const outputConfigCommand = (props.outputConfigCommand ?? true);
if (outputConfigCommand) {
const postfix = commonCommandOptions.join(' ');
new CfnOutput(this, 'ConfigCommand', { value: `${updateConfigCommandPrefix} ${postfix}` });
7 changes: 5 additions & 2 deletions packages/@aws-cdk/aws-eks-v2-alpha/test/cluster.test.ts
Original file line number Diff line number Diff line change
@@ -990,7 +990,7 @@ describe('cluster', () => {
});

describe('outputs', () => {
test('no outputs are synthesized by default', () => {
test('ConfigCommand and GetTokenCommand are output by default', () => {
// GIVEN
const { app, stack } = testFixtureNoVpc();

@@ -1000,7 +1000,10 @@ describe('cluster', () => {
// THEN
const assembly = app.synth();
const template = assembly.getStackByName(stack.stackName).template;
expect(template.Outputs).toBeUndefined(); // no outputs
expect(template.Outputs).toEqual({
ClusterConfigCommand43AAE40F: { Value: { 'Fn::Join': ['', ['aws eks update-kubeconfig --name ', { Ref: 'ClusterEB0386A7' }, ' --region us-east-1']] } },
ClusterGetTokenCommand06AE992E: { Value: { 'Fn::Join': ['', ['aws eks get-token --cluster-name ', { Ref: 'ClusterEB0386A7' }, ' --region us-east-1']] } },
});
});

describe('boostrap user-data', () => {

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -2101,6 +2101,50 @@
]
}
},
"Outputs": {
"ClusterConfigCommand43AAE40F": {
"Value": {
"Fn::Join": [
"",
[
"aws eks update-kubeconfig --name ",
{
"Ref": "ClusterEB0386A7"
},
" --region ",
{
"Ref": "AWS::Region"
}
]
]
}
},
"ClusterGetTokenCommand06AE992E": {
"Value": {
"Fn::Join": [
"",
[
"aws eks get-token --cluster-name ",
{
"Ref": "ClusterEB0386A7"
},
" --region ",
{
"Ref": "AWS::Region"
}
]
]
}
},
"IngressPingerResponse": {
"Value": {
"Fn::GetAtt": [
"IngressPinger1AD9E831",
"Value"
]
}
}
},
"Mappings": {
"LatestNodeRuntimeMap": {
"af-south-1": {
@@ -2225,16 +2269,6 @@
}
}
},
"Outputs": {
"IngressPingerResponse": {
"Value": {
"Fn::GetAtt": [
"IngressPinger1AD9E831",
"Value"
]
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1330,6 +1330,42 @@
]
}
},
"Outputs": {
"ClusterConfigCommand43AAE40F": {
"Value": {
"Fn::Join": [
"",
[
"aws eks update-kubeconfig --name ",
{
"Ref": "ClusterEB0386A7"
},
" --region ",
{
"Ref": "AWS::Region"
}
]
]
}
},
"ClusterGetTokenCommand06AE992E": {
"Value": {
"Fn::Join": [
"",
[
"aws eks get-token --cluster-name ",
{
"Ref": "ClusterEB0386A7"
},
" --region ",
{
"Ref": "AWS::Region"
}
]
]
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Oops, something went wrong.