@ -44,12 +44,20 @@ import (
// Client represents a client capable of communicating with the Kubernetes API.
// Client represents a client capable of communicating with the Kubernetes API.
type Client struct {
type Client struct {
* cmdutil . Factory
* cmdutil . Factory
// IncludeThirdPartyAPIs indicates whether to load "dynamic" APIs.
//
// This requires additional calls to the Kubernetes API server, and these calls
// are not supported by all versions. Additionally, during testing, initializing
// a client will still attempt to contact a live server. In these situations,
// this flag may need to be disabled.
IncludeThirdPartyAPIs bool
}
}
// New create a new Client
// New create a new Client
func New ( config clientcmd . ClientConfig ) * Client {
func New ( config clientcmd . ClientConfig ) * Client {
return & Client {
return & Client {
Factory : cmdutil . NewFactory ( config ) ,
Factory : cmdutil . NewFactory ( config ) ,
IncludeThirdPartyAPIs : true ,
}
}
}
}
@ -145,7 +153,7 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) {
//
//
// Namespace will set the namespaces
// Namespace will set the namespaces
func ( c * Client ) Update ( namespace string , currentReader , targetReader io . Reader ) error {
func ( c * Client ) Update ( namespace string , currentReader , targetReader io . Reader ) error {
current := c . NewBuilder ( i ncludeThirdPartyAPIs) .
current := c . NewBuilder ( c. I ncludeThirdPartyAPIs) .
ContinueOnError ( ) .
ContinueOnError ( ) .
NamespaceParam ( namespace ) .
NamespaceParam ( namespace ) .
DefaultNamespace ( ) .
DefaultNamespace ( ) .
@ -153,7 +161,7 @@ func (c *Client) Update(namespace string, currentReader, targetReader io.Reader)
Flatten ( ) .
Flatten ( ) .
Do ( )
Do ( )
target := c . NewBuilder ( i ncludeThirdPartyAPIs) .
target := c . NewBuilder ( c. I ncludeThirdPartyAPIs) .
ContinueOnError ( ) .
ContinueOnError ( ) .
NamespaceParam ( namespace ) .
NamespaceParam ( namespace ) .
DefaultNamespace ( ) .
DefaultNamespace ( ) .
@ -275,10 +283,8 @@ func (c *Client) WatchUntilReady(namespace string, reader io.Reader) error {
return perform ( c , namespace , reader , watchUntilReady )
return perform ( c , namespace , reader , watchUntilReady )
}
}
const includeThirdPartyAPIs = false
func perform ( c * Client , namespace string , reader io . Reader , fn ResourceActorFunc ) error {
func perform ( c * Client , namespace string , reader io . Reader , fn ResourceActorFunc ) error {
r := c . NewBuilder ( i ncludeThirdPartyAPIs) .
r := c . NewBuilder ( c . IncludeThirdPartyAPIs ) .
ContinueOnError ( ) .
ContinueOnError ( ) .
NamespaceParam ( namespace ) .
NamespaceParam ( namespace ) .
DefaultNamespace ( ) .
DefaultNamespace ( ) .