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: AWS Pod Identity uses default service account if not provided #4768

Merged
merged 1 commit into from
Jul 4, 2023
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio

### Fixes

- **AWS Pod Identity Authentication**: Use `default` service account if the workload doesn't set it ([#4767](https://github.com/kedacore/keda/issues/4767))
- **Pulsar Scaler**: Fix `msgBacklogThreshold` field being named wrongly as `msgBacklog` ([#4681](https://github.com/kedacore/keda/issues/4681))

### Deprecations
Expand Down
16 changes: 10 additions & 6 deletions pkg/scaling/resolver/scale_resolvers.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ import (
)

const (
referenceOperator = '$'
referenceOpener = '('
referenceCloser = ')'
boolTrue = true
boolFalse = false
referenceOperator = '$'
referenceOpener = '('
referenceCloser = ')'
boolTrue = true
boolFalse = false
defaultServiceAccount = "default"
)

var (
Expand Down Expand Up @@ -181,7 +182,10 @@ func ResolveAuthRefAndPodIdentity(ctx context.Context, client client.Client, log
authParams, podIdentity := resolveAuthRef(ctx, client, logger, triggerAuthRef, &podTemplateSpec.Spec, namespace, secretsLister)

if podIdentity.Provider == kedav1alpha1.PodIdentityProviderAwsEKS {
serviceAccountName := podTemplateSpec.Spec.ServiceAccountName
serviceAccountName := defaultServiceAccount
if podTemplateSpec.Spec.ServiceAccountName != "" {
serviceAccountName = podTemplateSpec.Spec.ServiceAccountName
}
serviceAccount := &corev1.ServiceAccount{}
err := client.Get(ctx, types.NamespacedName{Name: serviceAccountName, Namespace: namespace}, serviceAccount)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ spec:
labels:
app: {{.DeploymentName}}
spec:
serviceAccountName: default
containers:
- name: nginx
image: nginxinc/nginx-unprivileged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ spec:
labels:
app: {{.DeploymentName}}
spec:
serviceAccountName: default
containers:
- name: nginx
image: nginxinc/nginx-unprivileged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ spec:
labels:
app: {{.DeploymentName}}
spec:
serviceAccountName: default
containers:
- name: nginx
image: nginxinc/nginx-unprivileged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ spec:
labels:
app: {{.DeploymentName}}
spec:
serviceAccountName: default
containers:
- name: nginx
image: nginxinc/nginx-unprivileged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ spec:
labels:
app: {{.DeploymentName}}
spec:
serviceAccountName: default
containers:
- name: nginx
image: nginxinc/nginx-unprivileged
Expand Down