mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-23 19:16:25 +00:00
Merge pull request #133079 from Apptane/fetch-image-credentials-later
kubelet: don't fetch image credentials if the image is present and if we don't need to check if the pod is allowed to pull it
This commit is contained in:
@@ -178,6 +178,12 @@ func (m *imageManager) EnsureImageExists(ctx context.Context, objRef *v1.ObjectR
|
||||
return "", message, err
|
||||
}
|
||||
|
||||
if imageRef != "" && !utilfeature.DefaultFeatureGate.Enabled(features.KubeletEnsureSecretPulledImages) {
|
||||
msg := fmt.Sprintf("Container image %q already present on machine", requestedImage)
|
||||
m.logIt(objRef, v1.EventTypeNormal, events.PulledImage, logPrefix, msg, klog.Info)
|
||||
return imageRef, msg, nil
|
||||
}
|
||||
|
||||
repoToPull, _, _, err := parsers.ParseImageName(spec.Image)
|
||||
if err != nil {
|
||||
return "", err.Error(), err
|
||||
@@ -207,12 +213,6 @@ func (m *imageManager) EnsureImageExists(ctx context.Context, objRef *v1.ObjectR
|
||||
pullCredentials, _ := keyring.Lookup(repoToPull)
|
||||
|
||||
if imageRef != "" {
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.KubeletEnsureSecretPulledImages) {
|
||||
msg := fmt.Sprintf("Container image %q already present on machine", requestedImage)
|
||||
m.logIt(objRef, v1.EventTypeNormal, events.PulledImage, logPrefix, msg, klog.Info)
|
||||
return imageRef, msg, nil
|
||||
}
|
||||
|
||||
var imagePullSecrets []kubeletconfiginternal.ImagePullSecret
|
||||
// we don't take the audience of the service account into account, so there can only
|
||||
// be one imagePullServiceAccount per pod when we try to make a decision.
|
||||
|
||||
Reference in New Issue
Block a user