MCPcopy
hub / github.com/kubernetes/client-go / UnversionedRESTClientFor

Function UnversionedRESTClientFor

rest/config.go:307–337  ·  view source on GitHub ↗

UnversionedRESTClientFor is the same as RESTClientFor, except that it allows the config.Version to be empty.

(config *Config)

Source from the content-addressed store, hash-verified

305// UnversionedRESTClientFor is the same as RESTClientFor, except that it allows
306// the config.Version to be empty.
307func UnversionedRESTClientFor(config *Config) (*RESTClient, error) {
308 if config.NegotiatedSerializer == nil {
309 return nil, fmt.Errorf("NegotiatedSerializer is required when initializing a RESTClient")
310 }
311
312 baseURL, versionedAPIPath, err := defaultServerUrlFor(config)
313 if err != nil {
314 return nil, err
315 }
316
317 transport, err := TransportFor(config)
318 if err != nil {
319 return nil, err
320 }
321
322 var httpClient *http.Client
323 if transport != http.DefaultTransport {
324 httpClient = &http.Client{Transport: transport}
325 if config.Timeout > 0 {
326 httpClient.Timeout = config.Timeout
327 }
328 }
329
330 versionConfig := config.ContentConfig
331 if versionConfig.GroupVersion == nil {
332 v := metav1.SchemeGroupVersion
333 versionConfig.GroupVersion = &v
334 }
335
336 return NewRESTClient(baseURL, versionedAPIPath, versionConfig, config.QPS, config.Burst, config.RateLimiter, httpClient)
337}
338
339// SetKubernetesDefaults sets default values on the provided client config for accessing the
340// Kubernetes API or returns an error if any of the defaults are impossible or invalid.

Callers

nothing calls this directly

Calls 4

defaultServerUrlForFunction · 0.85
TransportForFunction · 0.85
NewRESTClientFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected