Skip to content

Commit

Permalink
Merge pull request #54218 from CaoShuFeng/stra
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

fix error message of custrom resource validation

/assign @deads2k
/assign @sttts

**Release note**:
```
NONE
```

Kubernetes-commit: 194f3983f09be84c9a7e6eaab09e1fd6064b05bf
  • Loading branch information
k8s-publish-robot committed Oct 20, 2017
2 parents ac65cb2 + 318f9e6 commit 6994313
Show file tree
Hide file tree
Showing 9 changed files with 1,242 additions and 1,098 deletions.
148 changes: 74 additions & 74 deletions Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/registry/customresource/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (a customResourceValidator) Validate(ctx genericapirequest.Context, obj run
return field.ErrorList{field.Invalid(field.NewPath("kind"), typeAccessor.GetKind(), fmt.Sprintf("must be %v", a.kind.Kind))}
}
if typeAccessor.GetAPIVersion() != a.kind.Group+"/"+a.kind.Version {
return field.ErrorList{field.Invalid(field.NewPath("apiVersion"), typeAccessor.GetKind(), fmt.Sprintf("must be %v", a.kind.Group+"/"+a.kind.Version))}
return field.ErrorList{field.Invalid(field.NewPath("apiVersion"), typeAccessor.GetAPIVersion(), fmt.Sprintf("must be %v", a.kind.Group+"/"+a.kind.Version))}
}

customResourceObject, ok := obj.(*unstructured.Unstructured)
Expand Down Expand Up @@ -169,7 +169,7 @@ func (a customResourceValidator) ValidateUpdate(ctx genericapirequest.Context, o
return field.ErrorList{field.Invalid(field.NewPath("kind"), typeAccessor.GetKind(), fmt.Sprintf("must be %v", a.kind.Kind))}
}
if typeAccessor.GetAPIVersion() != a.kind.Group+"/"+a.kind.Version {
return field.ErrorList{field.Invalid(field.NewPath("apiVersion"), typeAccessor.GetKind(), fmt.Sprintf("must be %v", a.kind.Group+"/"+a.kind.Version))}
return field.ErrorList{field.Invalid(field.NewPath("apiVersion"), typeAccessor.GetAPIVersion(), fmt.Sprintf("must be %v", a.kind.Group+"/"+a.kind.Version))}
}

customResourceObject, ok := obj.(*unstructured.Unstructured)
Expand Down
Loading

0 comments on commit 6994313

Please sign in to comment.