forked from kubernetes/kops
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This depends on kubernetes/kubernetes#42115
- Loading branch information
1 parent
7e0ac01
commit 32081f3
Showing
7 changed files
with
118 additions
and
1,310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package kutil | ||
|
||
import ( | ||
"k8s.io/kubernetes/pkg/client/restclient" | ||
"fmt" | ||
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd" | ||
"github.com/golang/glog" | ||
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" | ||
) | ||
|
||
func NewClientConfig(clientConfig *restclient.Config, namespace string) clientcmd.ClientConfig { | ||
c := &SimpleClientConfig{clientConfig: clientConfig, namespace: namespace} | ||
return c | ||
} | ||
|
||
// ClientConfig is used to make it easy to get an api server client | ||
type SimpleClientConfig struct { | ||
clientConfig *restclient.Config | ||
namespace string | ||
} | ||
|
||
var _ clientcmd.ClientConfig = &SimpleClientConfig{} | ||
|
||
// RawConfig returns the merged result of all overrides | ||
func (c*SimpleClientConfig) RawConfig() (clientcmdapi.Config, error) { | ||
return clientcmdapi.Config{}, fmt.Errorf("SimpleClientConfig::RawConfig not implemented") | ||
} | ||
|
||
// ClientConfig returns a complete client config | ||
func (c*SimpleClientConfig) ClientConfig() (*restclient.Config, error) { | ||
return c.clientConfig, nil | ||
} | ||
// Namespace returns the namespace resulting from the merged | ||
// result of all overrides and a boolean indicating if it was | ||
// overridden | ||
func (c*SimpleClientConfig) Namespace() (string, bool, error) { | ||
return c.namespace, false, nil | ||
} | ||
// ConfigAccess returns the rules for loading/persisting the config. | ||
func (c*SimpleClientConfig) ConfigAccess() clientcmd.ConfigAccess { | ||
glog.Fatalf("SimpleClientConfig::RawConfig not implemented") | ||
return nil | ||
} |
Oops, something went wrong.