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: Actually reconcile service accounts #324

Merged
merged 1 commit into from
Sep 3, 2024
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
10 changes: 10 additions & 0 deletions internal/controller/install/common_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,16 @@ func (cc *CommonComponents) ReconcileComponents(newComponents *CommonComponents)
cc.Service = nil
}

if newComponents.ServiceAccount != nil {
cc.ServiceAccount.Labels = newComponents.ServiceAccount.Labels
cc.ServiceAccount.Annotations = newComponents.ServiceAccount.Annotations
cc.ServiceAccount.ImagePullSecrets = newComponents.ServiceAccount.ImagePullSecrets
cc.ServiceAccount.Secrets = newComponents.ServiceAccount.Secrets
cc.ServiceAccount.AutomountServiceAccountToken = newComponents.ServiceAccount.AutomountServiceAccountToken
} else {
cc.ServiceAccount = nil
}

if newComponents.ClusterRole != nil {
cc.ClusterRole.Rules = newComponents.ClusterRole.Rules
cc.ClusterRole.Labels = newComponents.ClusterRole.Labels
Expand Down
22 changes: 22 additions & 0 deletions internal/controller/install/common_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,27 @@ func makeCommonComponents() CommonComponents {
},
}

automountServiceAccountToken := true
serviceAccount := corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Name: "some-name",
Namespace: "some-namespace",
Labels: map[string]string{"some-label-key": "some-label-value"},
Annotations: map[string]string{"some-annotation-key": "some-annotation-value"},
},
ImagePullSecrets: []corev1.LocalObjectReference{
{
Name: "some-image-pull-secret",
},
},
Secrets: []corev1.ObjectReference{
{
Name: "some-secret",
},
},
AutomountServiceAccountToken: &automountServiceAccountToken,
}

pc := schedulingv1.PriorityClass{
Value: 1000,
}
Expand All @@ -768,6 +789,7 @@ func makeCommonComponents() CommonComponents {
}
return CommonComponents{
Deployment: &deployment,
ServiceAccount: &serviceAccount,
PriorityClasses: []*schedulingv1.PriorityClass{&pc},
Secret: &secret,
}
Expand Down
Loading