Skip to content

Commit 2678448

Browse files
committed
serviceaccounts: do not manage pull secrets created by third parties
1 parent f73848f commit 2678448

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/serviceaccounts/controllers/docker_registry_service.go

+7
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,13 @@ func (e *DockerRegistryServiceController) syncRegistryLocationChange() error {
287287
if t.Type != v1.SecretTypeDockercfg {
288288
continue
289289
}
290+
if t.Annotations == nil {
291+
continue
292+
}
293+
// Do not manage dockercfg secrets we haven't created (eg. secrets created by user for private repositories).
294+
if _, hasTokenSecret := t.Annotations[ServiceAccountTokenSecretNameKey]; !hasTokenSecret {
295+
continue
296+
}
290297
default:
291298
utilruntime.HandleError(fmt.Errorf("object passed to %T that is not expected: %T", e, obj))
292299
continue

0 commit comments

Comments
 (0)