コード例 #1
0
// FromUnversionedClient adapts a pkg/client/unversioned#Client to a Clientset.
// This function is temporary. We will remove it when everyone has moved to using
// Clientset. New code should NOT use this function.
func FromUnversionedClient(c *unversioned.Client) *Clientset {
	var clientset Clientset
	if c != nil {
		clientset.LegacyClient = legacy_unversioned.New(c.RESTClient)
	} else {
		clientset.LegacyClient = legacy_unversioned.New(nil)
	}
	if c != nil && c.ExtensionsClient != nil {
		clientset.ExtensionsClient = extensions_unversioned.New(c.ExtensionsClient.RESTClient)
	} else {
		clientset.ExtensionsClient = extensions_unversioned.New(nil)
	}

	return &clientset
}
コード例 #2
0
ファイル: clientset.go プロジェクト: jchauncey/kubeclient
// New creates a new Clientset for the given RESTClient.
func New(c *unversioned.RESTClient) *Clientset {
	var clientset Clientset
	clientset.LegacyClient = legacy_unversioned.New(c)
	clientset.ExtensionsClient = extensions_unversioned.New(c)

	clientset.DiscoveryClient = unversioned.NewDiscoveryClient(c)
	return &clientset
}