本文整理汇总了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))...)
}