@@ -37,23 +37,31 @@ Template to generate secrets for a private Docker repository for K8s to use
3737Template to decide if the serviceAccount must be built
3838*/} }
3939{ {- define " serviceAccount.enabled" } }
40- { {- $awsIamRoleDefined := and .Values.features.aws.enabled .Values.features.aws.iamRoleName -} }
41- { {- $customAnnotations := .Values.resources.serviceAccount.annotations -} }
42- { {- $existingName := .Values.resources.serviceAccount.existingName -} }
43- { {- not $existingName | and (or $awsIamRoleDefined $customAnnotations ) -} }
40+ { {- with .Values.resources.serviceAccount -} }
41+ { {- $useExistingName := (empty .existingName | not ) -} }
42+ { {- $useIamRole := (empty .aws.iamRoleName | and (empty .aws.accountId) | not ) -} }
43+ { {- $useAnnotations := (empty .annotations | not ) -} }
44+ { {- if (and $useExistingName $useAnnotations ) -} }
45+ { {- fail " Cannot add annotations to the external service account (check .resources.serviceAccount)" -} }
46+ { {- end -} }
47+ { {- if (and $useExistingName $useIamRole ) -} }
48+ { {- fail " Cannot add IAM Role authentication to the external service account (check .resources.serviceAccount)" -} }
49+ { {- end -} }
50+ { {- (not $useExistingName | and (or $useAnnotations $useIamRole )) } }
51+ { {- end } }
4452{ {- end } }
4553
4654{ {/*
4755Template to generate service account annotation for AWS IAM Role
4856https://docs.aws.amazon.com/eks/latest/userguide/specify-service-account-role.html
4957*/} }
5058{ {- define " aws.iamRoleAnnotation" } }
51- { {- with .Values.features .aws -} }
52- { {- $id := required " features .aws.accountId" .accountId -} }
53- { {- $role := required " features .aws.iamRoleName" .iamRoleName -} }
59+ { {- with .Values.resources.serviceAccount .aws -} }
60+ { {- $id := required " resources.serviceAccount .aws.accountId" .accountId -} }
61+ { {- $role := required " resources.serviceAccount .aws.iamRoleName" .iamRoleName -} }
5462{ {- $value := printf " arn:aws:iam::%s:role/%s" $id $role -} }
5563{ {- printf " eks.amazonaws.com/role-arn: %s" (quote $value ) } }
56- { {- end } }
64+ { {- end - } }
5765{ {- end -} }
5866
5967{ {/* Name of the priority class */} }
@@ -106,7 +114,7 @@ https://docs.aws.amazon.com/eks/latest/userguide/specify-service-account-role.ht
106114
107115{ {/* Combine ingress path from server.pathPrefix and ingress.pathSuffix */} }
108116{ {- define " imgproxy.ingressPath" -} }
109- { {- $prefix := ($.Values.features.server.pathPrefix | default " " | trimSuffix " /" ) -} }
117+ { {- $prefix := ($.Values.env.IMGPROXY_PATH_PREFIX | default " " | trimSuffix " /" ) -} }
110118{ {- $suffix := ($.Values.resources.ingress.pathSuffix | default " " | trimPrefix " /" ) -} }
111119{ {- printf " %s/%s" $prefix $suffix -} }
112120{ {- end -} }
0 commit comments