Skip to content

Commit e9bba77

Browse files
authored
add a comment on how and why we deal with image pull secret (deckhouse#40)
1 parent 250c5b1 commit e9bba77

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/registry_checker/indexers.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ func ExtractPullSecretRefs(kubeClient *kubernetes.Clientset, obj interface{}) (r
153153
}
154154

155155
pullSecretRefs := extractPullSecretRefsFromPodSpec(namespace, podSpec)
156+
// Image pull secret defined in Pod's `spec.ImagePullSecrets` takes preference over the secret from ServiceAccount.
157+
// We are acting the same way as kubelet does:
158+
// https://github.com/kubernetes/kubernetes/blob/88b31814f4a55c0af1c7d2712ce736a8fe08887e/plugin/pkg/admission/serviceaccount/admission.go#L163-L168.
156159
if len(pullSecretRefs) == 0 && len(podSpec.ServiceAccountName) > 0 {
157160
serviceAccount, err := kubeClient.CoreV1().ServiceAccounts(namespace).Get(podSpec.ServiceAccountName, metav1.GetOptions{})
158161
if err == nil {

0 commit comments

Comments
 (0)