mirror of https://github.com/k3s-io/k3s
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-reviewspull/8/head
commit
6764a79586
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue