mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #39231 from NickrenREN/getPullSecretsForPod
Automatic merge from submit-queue (batch tested with PRs 42721, 39231) optimize getPullSecretsForPod() and syncPod()
This commit is contained in:
commit
e38c575ae6
@ -1551,16 +1551,12 @@ func (kl *Kubelet) syncPod(o syncPodOptions) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch the pull secrets for the pod
|
// Fetch the pull secrets for the pod
|
||||||
pullSecrets, err := kl.getPullSecretsForPod(pod)
|
pullSecrets := kl.getPullSecretsForPod(pod)
|
||||||
if err != nil {
|
|
||||||
glog.Errorf("Unable to get pull secrets for pod %q: %v", format.Pod(pod), err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call the container runtime's SyncPod callback
|
// Call the container runtime's SyncPod callback
|
||||||
result := kl.containerRuntime.SyncPod(pod, apiPodStatus, podStatus, pullSecrets, kl.backOff)
|
result := kl.containerRuntime.SyncPod(pod, apiPodStatus, podStatus, pullSecrets, kl.backOff)
|
||||||
kl.reasonCache.Update(pod.UID, result)
|
kl.reasonCache.Update(pod.UID, result)
|
||||||
if err = result.Error(); err != nil {
|
if err := result.Error(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,7 +672,7 @@ func (kl *Kubelet) makePodDataDirs(pod *v1.Pod) error {
|
|||||||
|
|
||||||
// getPullSecretsForPod inspects the Pod and retrieves the referenced pull
|
// getPullSecretsForPod inspects the Pod and retrieves the referenced pull
|
||||||
// secrets.
|
// secrets.
|
||||||
func (kl *Kubelet) getPullSecretsForPod(pod *v1.Pod) ([]v1.Secret, error) {
|
func (kl *Kubelet) getPullSecretsForPod(pod *v1.Pod) []v1.Secret {
|
||||||
pullSecrets := []v1.Secret{}
|
pullSecrets := []v1.Secret{}
|
||||||
|
|
||||||
for _, secretRef := range pod.Spec.ImagePullSecrets {
|
for _, secretRef := range pod.Spec.ImagePullSecrets {
|
||||||
@ -685,7 +685,7 @@ func (kl *Kubelet) getPullSecretsForPod(pod *v1.Pod) ([]v1.Secret, error) {
|
|||||||
pullSecrets = append(pullSecrets, *secret)
|
pullSecrets = append(pullSecrets, *secret)
|
||||||
}
|
}
|
||||||
|
|
||||||
return pullSecrets, nil
|
return pullSecrets
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if pod is in the terminated state ("Failed" or "Succeeded").
|
// Returns true if pod is in the terminated state ("Failed" or "Succeeded").
|
||||||
|
Loading…
Reference in New Issue
Block a user