Skip to content

Commit

Permalink
fix: service account name is wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfouquet committed Oct 27, 2023
1 parent 9a0d5da commit 8a80fd4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
9 changes: 6 additions & 3 deletions infra/cdk8s.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ const app = new App();
async function main(): Promise<void> {
// Get cloudformation outputs
const cfnOutputs = await getCfnOutputs(ClusterName);
const missingKeys = [...Object.values(CfnOutputKeys.Karpenter), ...Object.values(CfnOutputKeys.FluentBit)].filter(
(f) => cfnOutputs[f] == null,
);
//FIXME: is there a better way to do that?
const missingKeys = [
...Object.values(CfnOutputKeys.Karpenter),
...Object.values(CfnOutputKeys.FluentBit),
...Object.values(CfnOutputKeys.Argo),
].filter((f) => cfnOutputs[f] == null);
if (missingKeys.length > 0) {
throw new Error(`Missing CloudFormation Outputs for keys ${missingKeys.join(', ')}`);
}
Expand Down
2 changes: 1 addition & 1 deletion infra/charts/argo.workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class ArgoWorkflows extends Chart {
replicas: 2,
workflowDefaults: {
spec: {
serviceAccountName: 'workflow-runner-sa',
serviceAccountName: props.saName,
ttlStrategy: { secondsAfterCompletion: Duration.days(7).toSeconds() },
podGC: { strategy: 'OnPodCompletion' },
tolerations: [
Expand Down
7 changes: 6 additions & 1 deletion infra/eks/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,16 @@ export class LinzEksCluster extends Stack {
metadata: { name: 'argo' },
});
const argoRunnerSa = this.cluster.addServiceAccount('ArgoRunnerServiceAccount', {
name: 'argo-runner-sa',
name: 'workflow-runner-sa',
namespace: 'argo',
});
argoRunnerSa.node.addDependency(argoNs);
new CfnOutput(this, 'ArgoRunnerServiceAccountRoleArn', { value: argoRunnerSa.role.roleArn });
new CfnOutput(this, CfnOutputKeys.Argo.RunnerServiceAccountName, { value: argoRunnerSa.serviceAccountName });

// give read/write on the temporary (scratch) bucket
this.tempBucket.grantReadWrite(argoRunnerSa.role);
// give permission to the sa to assume a role
argoRunnerSa.role.addToPrincipalPolicy(new PolicyStatement({ actions: ['sts:AssumeRole'], resources: ['*'] }));
}
}

0 comments on commit 8a80fd4

Please sign in to comment.