本文整理匯總了Golang中k8s/io/kubernetes/pkg/api/validation.ValidatePodUpdate函數的典型用法代碼示例。如果您正苦於以下問題:Golang ValidatePodUpdate函數的具體用法?Golang ValidatePodUpdate怎麽用?Golang ValidatePodUpdate使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ValidatePodUpdate函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestPodSpecNodeSelectorUpdateDisallowed
func TestPodSpecNodeSelectorUpdateDisallowed(t *testing.T) {
oldPod := &kapi.Pod{
ObjectMeta: kapi.ObjectMeta{
ResourceVersion: "1",
},
Spec: kapi.PodSpec{
NodeSelector: map[string]string{
"foo": "bar",
},
},
}
if errs := validation.ValidatePodUpdate(oldPod, oldPod); len(errs) != 0 {
t.Fatal("expected no errors")
}
newPod := *oldPod
// use a new map so it doesn't change oldPod's map too
newPod.Spec.NodeSelector = map[string]string{"foo": "other"}
errs := validation.ValidatePodUpdate(&newPod, oldPod)
if len(errs) == 0 {
t.Fatal("expected at least 1 error")
}
}
示例2: ValidateUpdate
// ValidateUpdate is the default update validation for an end user.
func (podStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) utilvalidation.ErrorList {
errorList := validation.ValidatePod(obj.(*api.Pod))
return append(errorList, validation.ValidatePodUpdate(obj.(*api.Pod), old.(*api.Pod))...)
}
示例3: ValidateUpdate
// ValidateUpdate is the default update validation for an end user.
func (podStrategy) ValidateUpdate(ctx genericapirequest.Context, obj, old runtime.Object) field.ErrorList {
errorList := validation.ValidatePod(obj.(*api.Pod))
return append(errorList, validation.ValidatePodUpdate(obj.(*api.Pod), old.(*api.Pod))...)
}