Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for PatchPodStatus (0.63 sec)

  1. pkg/util/pod/pod.go

    	"k8s.io/apimachinery/pkg/util/strategicpatch"
    	clientset "k8s.io/client-go/kubernetes"
    	podutil "k8s.io/kubernetes/pkg/api/v1/pod"
    )
    
    // PatchPodStatus patches pod status. It returns true and avoids an update if the patch contains no changes.
    func PatchPodStatus(ctx context.Context, c clientset.Interface, namespace, name string, uid types.UID, oldPodStatus, newPodStatus v1.PodStatus) (*v1.Pod, []byte, bool, error) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Nov 07 15:22:29 UTC 2022
    - 3K bytes
    - Viewed (0)
  2. pkg/scheduler/util/utils.go

    	return apierrors.IsInternalError(err) || apierrors.IsServiceUnavailable(err) ||
    		net.IsConnectionRefused(err)
    }
    
    // PatchPodStatus calculates the delta bytes change from <old.Status> to <newStatus>,
    // and then submit a request to API server to patch the pod changes.
    func PatchPodStatus(ctx context.Context, cs kubernetes.Interface, old *v1.Pod, newStatus *v1.PodStatus) error {
    	if newStatus == nil {
    		return nil
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Sep 21 01:40:44 UTC 2023
    - 6.2K bytes
    - Viewed (0)
  3. pkg/util/pod/pod_test.go

    		},
    	}
    	for _, tc := range testCases {
    		t.Run(tc.description, func(t *testing.T) {
    			_, patchBytes, unchanged, err := PatchPodStatus(context.TODO(), client, ns, name, uid, getPodStatus(), tc.mutate(getPodStatus()))
    			if err != nil {
    				t.Errorf("unexpected error: %v", err)
    			}
    			if unchanged != tc.expectUnchanged {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Nov 07 15:22:29 UTC 2022
    - 4.5K bytes
    - Viewed (0)
  4. pkg/scheduler/util/utils_test.go

    			}
    		})
    	}
    }
    
    func TestPatchPodStatus(t *testing.T) {
    	tests := []struct {
    		name   string
    		pod    v1.Pod
    		client *clientsetfake.Clientset
    		// validateErr checks if error returned from PatchPodStatus is expected one or not.
    		// (true means error is expected one.)
    		validateErr    func(goterr error) bool
    		statusToUpdate v1.PodStatus
    	}{
    		{
    			name:   "Should update pod conditions successfully",
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Sep 21 01:40:44 UTC 2023
    - 14.5K bytes
    - Viewed (0)
  5. pkg/controller/podgc/gc_controller.go

    			newStatus.Phase = v1.PodFailed
    			if condition != nil && utilfeature.DefaultFeatureGate.Enabled(features.PodDisruptionConditions) {
    				apipod.UpdatePodCondition(newStatus, condition)
    			}
    			if _, _, _, err := utilpod.PatchPodStatus(ctx, gcc.kubeClient, pod.Namespace, pod.Name, pod.UID, pod.Status, *newStatus); err != nil {
    				return err
    			}
    		}
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat May 04 18:33:12 UTC 2024
    - 13.3K bytes
    - Viewed (0)
  6. pkg/controller/tainteviction/taint_eviction.go

    			Type:    v1.DisruptionTarget,
    			Status:  v1.ConditionTrue,
    			Reason:  "DeletionByTaintManager",
    			Message: "Taint manager: deleting due to NoExecute taint",
    		})
    		if updated {
    			if _, _, _, err := utilpod.PatchPodStatus(ctx, c, pod.Namespace, pod.Name, pod.UID, pod.Status, *newStatus); err != nil {
    				return err
    			}
    		}
    	}
    	return c.CoreV1().Pods(ns).Delete(ctx, name, metav1.DeleteOptions{})
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat May 04 18:33:12 UTC 2024
    - 19.9K bytes
    - Viewed (0)
  7. pkg/scheduler/framework/preemption/preemption.go

    				}
    				newStatus := pod.Status.DeepCopy()
    				updated := apipod.UpdatePodCondition(newStatus, condition)
    				if updated {
    					if err := util.PatchPodStatus(ctx, cs, victim, newStatus); err != nil {
    						logger.Error(err, "Could not add DisruptionTarget condition due to preemption", "pod", klog.KObj(victim), "preemptor", klog.KObj(pod))
    						errCh.SendErrorWithCancel(err, cancel)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri May 31 15:52:16 UTC 2024
    - 25.1K bytes
    - Viewed (0)
  8. pkg/scheduler/schedule_one.go

    	if !podutil.UpdatePodCondition(podStatusCopy, condition) && !nnnNeedsUpdate {
    		return nil
    	}
    	if nnnNeedsUpdate {
    		podStatusCopy.NominatedNodeName = nominatingInfo.NominatedNodeName
    	}
    	return util.PatchPodStatus(ctx, client, pod, podStatusCopy)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jun 06 13:28:08 UTC 2024
    - 43.4K bytes
    - Viewed (0)
  9. pkg/kubelet/status/status_manager.go

    		m.deletePodStatus(uid)
    		return
    	}
    
    	mergedStatus := mergePodStatus(pod.Status, status.status, m.podDeletionSafety.PodCouldHaveRunningContainers(pod))
    
    	newPod, patchBytes, unchanged, err := statusutil.PatchPodStatus(context.TODO(), m.kubeClient, pod.Namespace, pod.Name, pod.UID, pod.Status, mergedStatus)
    	klog.V(3).InfoS("Patch status for pod", "pod", klog.KObj(pod), "podUID", uid, "patch", string(patchBytes))
    
    	if err != nil {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu May 02 16:27:19 UTC 2024
    - 44.3K bytes
    - Viewed (0)
Back to top