Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for PrepareForUpdate (0.62 sec)

  1. pkg/registry/apps/statefulset/strategy_test.go

    			Status: apps.StatefulSetStatus{Replicas: 4},
    		}
    		Strategy.PrepareForUpdate(ctx, validPs, ps)
    		errs = Strategy.ValidateUpdate(ctx, validPs, ps)
    		if len(errs) != 0 {
    			t.Errorf("updating spec.Replicas and minReadySeconds is allowed on a statefulset: %v", errs)
    		}
    		invalidPs := ps
    		invalidPs.Spec.MinReadySeconds = int32(-1)
    		Strategy.PrepareForUpdate(ctx, validPs, invalidPs)
    		errs = Strategy.ValidateUpdate(ctx, validPs, ps)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 22.1K bytes
    - Viewed (0)
  2. pkg/registry/policy/poddisruptionbudget/strategy_test.go

    		},
    	}
    
    	// Nothing in Spec changes: OK
    	Strategy.PrepareForUpdate(ctx, newPdb, pdb)
    	errs = Strategy.ValidateUpdate(ctx, newPdb, pdb)
    	if len(errs) != 0 {
    		t.Errorf("Unexpected error updating PodDisruptionBudget.")
    	}
    
    	// Changing the selector?  OK
    	newPdb.Spec.Selector = &metav1.LabelSelector{MatchLabels: map[string]string{"a": "bar"}}
    	Strategy.PrepareForUpdate(ctx, newPdb, pdb)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 19.2K bytes
    - Viewed (0)
  3. pkg/registry/batch/cronjob/strategy_test.go

    			Schedule: "5 5 5 * ?",
    		},
    		Status: batch.CronJobStatus{
    			LastScheduleTime: &now,
    		},
    	}
    
    	// ensure we do not change status
    	Strategy.PrepareForUpdate(ctx, updatedCronJob, cronJob)
    	if updatedCronJob.Status.Active != nil {
    		t.Errorf("PrepareForUpdate should have preserved prior version status")
    	}
    	if updatedCronJob.Generation != 2 {
    		t.Errorf("expected Generation=2, got %d", updatedCronJob.Generation)
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 15 14:34:53 UTC 2024
    - 12.2K bytes
    - Viewed (0)
  4. pkg/registry/core/service/strategy.go

    	service := obj.(*api.Service)
    	service.Status = api.ServiceStatus{}
    
    	dropServiceDisabledFields(service, nil)
    }
    
    // PrepareForUpdate sets contextual defaults and clears fields that are not allowed to be set by end users on update.
    func (svcStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
    	newService := obj.(*api.Service)
    	oldService := old.(*api.Service)
    	newService.Status = oldService.Status
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Apr 11 13:09:36 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  5. pkg/registry/storage/csidriver/strategy_test.go

    	}
    
    	// Update of spec is disallowed
    	newCSIDriver := csiDriver.DeepCopy()
    	attachNotRequired := false
    	newCSIDriver.Spec.AttachRequired = &attachNotRequired
    
    	Strategy.PrepareForUpdate(ctx, newCSIDriver, csiDriver)
    
    	errs = Strategy.ValidateUpdate(ctx, newCSIDriver, csiDriver)
    	if len(errs) == 0 {
    		t.Errorf("Expected a validation error")
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 16.7K bytes
    - Viewed (0)
  6. pkg/registry/core/persistentvolume/strategy_test.go

    			featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.PersistentVolumeLastPhaseTransitionTime, tc.fg)
    
    			obj := tc.newObj.DeepCopy()
    			StatusStrategy.PrepareForUpdate(context.TODO(), obj, tc.oldObj.DeepCopy())
    			if !reflect.DeepEqual(obj, tc.expectedObj) {
    				t.Errorf("object diff: %s", cmp.Diff(obj, tc.expectedObj))
    			}
    		})
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 11K bytes
    - Viewed (0)
  7. pkg/registry/core/persistentvolumeclaim/strategy_test.go

    			newPvcHasConditions, newPvc := newPvcInfo.hasConditions, newPvcInfo.pvc()
    
    			t.Run(fmt.Sprintf("old pvc %s, new pvc %s", oldPvcInfo.description, newPvcInfo.description), func(t *testing.T) {
    				StatusStrategy.PrepareForUpdate(ctx, newPvc, oldPvc)
    
    				// old pvc should never be changed
    				if !reflect.DeepEqual(oldPvc, oldPvcInfo.pvc()) {
    					t.Errorf("old pvc changed: %v", cmp.Diff(oldPvc, oldPvcInfo.pvc()))
    				}
    
    				switch {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 11.2K bytes
    - Viewed (0)
  8. pkg/registry/core/service/strategy_test.go

    				},
    			},
    		},
    	}
    	StatusStrategy.PrepareForUpdate(ctx, newService, oldService)
    	if newService.Status.LoadBalancer.Ingress[0].IP != "127.0.0.2" {
    		t.Errorf("Service status updates should allow change of status fields")
    	}
    	if newService.Spec.SessionAffinity != "None" {
    		t.Errorf("PrepareForUpdate should have preserved old spec")
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 32.4K bytes
    - Viewed (0)
  9. pkg/api/pod/util.go

    }
    
    // DropDisabledTemplateFields removes disabled fields from the pod template metadata and spec.
    // This should be called from PrepareForCreate/PrepareForUpdate for all resources containing a PodTemplateSpec
    func DropDisabledTemplateFields(podTemplate, oldPodTemplate *api.PodTemplateSpec) {
    	var (
    		podSpec           *api.PodSpec
    		podAnnotations    map[string]string
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 29 22:40:29 UTC 2024
    - 41.3K bytes
    - Viewed (0)
  10. pkg/registry/discovery/endpointslice/strategy_test.go

    				},
    				Endpoints: []discovery.Endpoint{{
    					Addresses: []string{"1.2.3.4"},
    				}},
    			},
    		},
    	}
    
    	for _, tc := range testCases {
    		t.Run(tc.name, func(t *testing.T) {
    			Strategy.PrepareForUpdate(context.TODO(), tc.newEPS, tc.oldEPS)
    			if !apiequality.Semantic.DeepEqual(tc.newEPS, tc.expectedEPS) {
    				t.Errorf("Expected %+v\nGot: %+v", tc.expectedEPS, tc.newEPS)
    			}
    		})
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 27.3K bytes
    - Viewed (0)
Back to top