Merge pull request #66518 from deads2k/dynamic-02-ordie

Automatic merge from submit-queue (batch tested with PRs 66252, 66518). 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>.

add missing OrDie variant for dynamic client construction

Generated clients have it and it is very handy for test cases.

```release-note
NONE
```

@kubernetes/sig-api-machinery-pr-reviews
pull/8/head
Kubernetes Submit Queue 2018-07-24 00:49:07 -07:00 committed by GitHub
commit 6764a79586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -36,6 +36,16 @@ type dynamicClient struct {
var _ Interface = &dynamicClient{}
// NewForConfigOrDie creates a new Interface for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) Interface {
ret, err := NewForConfig(c)
if err != nil {
panic(err)
}
return ret
}
func NewForConfig(inConfig *rest.Config) (Interface, error) {
config := rest.CopyConfig(inConfig)
// for serializing the options