MCPcopy
hub / github.com/kubernetes-sigs/controller-runtime / New

Function New

pkg/client/client.go:116–129  ·  view source on GitHub ↗

New returns a new Client using the provided config and Options. By default, the client surfaces warnings returned by the server. To suppress warnings, set config.WarningHandlerWithContext = rest.NoWarnings{}. To define custom behavior, implement the rest.WarningHandlerWithContext interface. See [si

(config *rest.Config, options Options)

Source from the content-addressed store, hash-verified

114// case of unstructured types, the group, version, and kind will be extracted
115// from the corresponding fields on the object.
116func New(config *rest.Config, options Options) (c Client, err error) {
117 c, err = newClient(config, options)
118 if err == nil && options.DryRun != nil && *options.DryRun {
119 c = NewDryRunClient(c)
120 }
121 if fo := options.FieldOwner; fo != "" {
122 c = WithFieldOwner(c, fo)
123 }
124 if fv := options.FieldValidation; fv != "" {
125 c = WithFieldValidation(c, FieldValidation(fv))
126 }
127
128 return c, err
129}
130
131func newClient(config *rest.Config, options Options) (*client, error) {
132 if config == nil {

Callers 15

createPodWithLabelsFunction · 0.92
deletePodFunction · 0.92
cache_test.goFile · 0.92
NonBlockingGetTestFunction · 0.92
CacheTestFunction · 0.92
client_test.goFile · 0.92
ExampleNewFunction · 0.92
dryrun_test.goFile · 0.92
TestApiMachineryFunction · 0.92

Calls 5

newClientFunction · 0.85
NewDryRunClientFunction · 0.85
WithFieldOwnerFunction · 0.85
WithFieldValidationFunction · 0.85
FieldValidationTypeAlias · 0.85

Tested by 8

createPodWithLabelsFunction · 0.74
deletePodFunction · 0.74
NonBlockingGetTestFunction · 0.74
CacheTestFunction · 0.74
ExampleNewFunction · 0.74
TestApiMachineryFunction · 0.74