Skip to content

Commit

Permalink
Actually reconcile service accounts (#324)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Parraga <sovietaced@gmail.com>
  • Loading branch information
Sovietaced committed Sep 3, 2024
1 parent d82cf81 commit e3bcf44
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
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

0 comments on commit e3bcf44

Please sign in to comment.