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): Helm chart timeout expects duration #8773

Merged
merged 5 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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/lib/helm-chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class HelmChart extends Construct {
Chart: props.chart,
Version: props.version,
Wait: props.wait ?? false,
Timeout: timeout,
Timeout: timeout && `${timeout.toString()}s`, // Helm v3 expects duration instead of integer
eladb marked this conversation as resolved.
Show resolved Hide resolved
Values: (props.values ? stack.toJsonString(props.values) : undefined),
Namespace: props.namespace ?? 'default',
Repository: props.repository,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2222,7 +2222,8 @@
},
"Release": "awscdkeksclustertestclusterchartnginxingressa7f70129",
"Chart": "nginx-ingress",
"Wait": false,
"Wait": true,
"Timeout": "900s",
"Namespace": "kube-system",
"Repository": "https://helm.nginx.com/stable"
},
Expand Down
16 changes: 11 additions & 5 deletions packages/@aws-cdk/aws-eks/test/integ.eks-cluster.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as ec2 from '@aws-cdk/aws-ec2';
import * as iam from '@aws-cdk/aws-iam';
import { App, CfnOutput } from '@aws-cdk/core';
import { App, CfnOutput, Duration } from '@aws-cdk/core';
import * as eks from '../lib';
import * as hello from './hello-k8s';
import { TestStack } from './util';
Expand All @@ -21,7 +21,7 @@ class EksClusterStack extends TestStack {
version: '1.16',
});

// // fargate profile for resources in the "default" namespace
// fargate profile for resources in the "default" namespace
cluster.addFargateProfile('default', {
selectors: [{ namespace: 'default' }],
});
Expand Down Expand Up @@ -59,12 +59,18 @@ class EksClusterStack extends TestStack {
nodeRole: cluster.defaultCapacity ? cluster.defaultCapacity.role : undefined,
});

// // apply a kubernetes manifest
// apply a kubernetes manifest
cluster.addResource('HelloApp', ...hello.resources);

// // add two Helm charts to the cluster. This will be the Kubernetes dashboard and the Nginx Ingress Controller
// add two Helm charts to the cluster. This will be the Kubernetes dashboard and the Nginx Ingress Controller
cluster.addChart('dashboard', { chart: 'kubernetes-dashboard', repository: 'https://kubernetes-charts.storage.googleapis.com' });
cluster.addChart('nginx-ingress', { chart: 'nginx-ingress', repository: 'https://helm.nginx.com/stable', namespace: 'kube-system' });
cluster.addChart('nginx-ingress', {
chart: 'nginx-ingress',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expecting to see an integ test update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i am update the integ test to check the logic for the both wait and timeout

repository: 'https://helm.nginx.com/stable',
namespace: 'kube-system',
wait: true,
timeout: Duration.minutes(15),
});

// add a service account connected to a IAM role
cluster.addServiceAccount('MyServiceAccount');
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-eks/test/test.helm-chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export = {
new eks.HelmChart(stack, 'MyChart', { cluster, chart: 'chart', timeout: Duration.minutes(10) });

// THEN
expect(stack).to(haveResource(eks.HelmChart.RESOURCE_TYPE, { Timeout: 600 }));
expect(stack).to(haveResource(eks.HelmChart.RESOURCE_TYPE, { Timeout: '600s' }));
test.done();
},
},
Expand Down