Merge "Standardize KubeConfig variables"
This commit is contained in:
commit
db6217f011
@ -445,7 +445,7 @@ func (c *Config) AddCluster(theCluster *ClusterOptions) (*Cluster, error) {
|
||||
// Create the new Airship config Cluster
|
||||
nCluster := NewCluster()
|
||||
c.Clusters[theCluster.Name].ClusterTypes[theCluster.ClusterType] = nCluster
|
||||
// Create a new Kubeconfig Cluster object as well
|
||||
// Create a new KubeConfig Cluster object as well
|
||||
kcluster := clientcmdapi.NewCluster()
|
||||
clusterName := NewClusterComplexName()
|
||||
clusterName.WithType(theCluster.Name, theCluster.ClusterType)
|
||||
@ -554,7 +554,7 @@ func (c *Config) AddContext(theContext *ContextOptions) *Context {
|
||||
// Create the new Airship config context
|
||||
nContext := NewContext()
|
||||
c.Contexts[theContext.Name] = nContext
|
||||
// Create a new Kubeconfig Context object as well
|
||||
// Create a new KubeConfig Context object as well
|
||||
context := clientcmdapi.NewContext()
|
||||
nContext.NameInKubeconf = theContext.Name
|
||||
contextName := NewClusterComplexName()
|
||||
@ -685,7 +685,7 @@ func (c *Config) AddAuthInfo(theAuthInfo *AuthInfoOptions) *AuthInfo {
|
||||
// Create the new Airship config context
|
||||
nAuthInfo := NewAuthInfo()
|
||||
c.AuthInfos[theAuthInfo.Name] = nAuthInfo
|
||||
// Create a new Kubeconfig AuthInfo object as well
|
||||
// Create a new KubeConfig AuthInfo object as well
|
||||
authInfo := clientcmdapi.NewAuthInfo()
|
||||
nAuthInfo.SetKubeAuthInfo(authInfo)
|
||||
c.KubeConfig().AuthInfos[theAuthInfo.Name] = authInfo
|
||||
|
@ -79,7 +79,7 @@ type Cluster struct {
|
||||
// Complex cluster name defined by the using <cluster name>_<cluster type>)
|
||||
NameInKubeconf string `json:"cluster-kubeconf"`
|
||||
|
||||
// Kubeconfig Cluster Object
|
||||
// KubeConfig Cluster Object
|
||||
cluster *kubeconfig.Cluster
|
||||
|
||||
// Bootstrap configuration this clusters ephemeral hosts will rely on
|
||||
@ -104,12 +104,12 @@ type Context struct {
|
||||
// +optional
|
||||
Manifest string `json:"manifest,omitempty"`
|
||||
|
||||
// Kubeconfig Context Object
|
||||
// KubeConfig Context Object
|
||||
context *kubeconfig.Context
|
||||
}
|
||||
|
||||
type AuthInfo struct {
|
||||
// Kubeconfig AuthInfo Object
|
||||
// KubeConfig AuthInfo Object
|
||||
authInfo *kubeconfig.AuthInfo
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ func NewClient(settings *environment.AirshipCTLSettings) (Interface, error) {
|
||||
client := new(Client)
|
||||
var err error
|
||||
|
||||
f := k8sutils.FactoryFromKubeconfigPath(settings.KubeConfigPath())
|
||||
f := k8sutils.FactoryFromKubeConfigPath(settings.KubeConfigPath())
|
||||
|
||||
pathToBufferDir := filepath.Join(filepath.Dir(settings.AirshipConfigPath()), buffDir)
|
||||
client.kubectl = kubectl.NewKubectl(f).WithBufferDir(pathToBufferDir)
|
||||
|
@ -44,8 +44,8 @@ func (f TestFile) Name() string { return f.MockName() }
|
||||
func (f TestFile) Write([]byte) (int, error) { return f.MockWrite() }
|
||||
func (f TestFile) Close() error { return f.MockClose() }
|
||||
|
||||
func TestNewKubectlFromKubeconfigPath(t *testing.T) {
|
||||
f := k8sutils.FactoryFromKubeconfigPath(kubeconfigPath)
|
||||
func TestNewKubectlFromKubeConfigPath(t *testing.T) {
|
||||
f := k8sutils.FactoryFromKubeConfigPath(kubeconfigPath)
|
||||
kctl := kubectl.NewKubectl(f).WithBufferDir("/tmp/.airship")
|
||||
|
||||
assert.NotNil(t, kctl.Factory)
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
cmdutil "k8s.io/kubectl/pkg/cmd/util"
|
||||
)
|
||||
|
||||
func FactoryFromKubeconfigPath(kp string) cmdutil.Factory {
|
||||
func FactoryFromKubeConfigPath(kp string) cmdutil.Factory {
|
||||
kf := genericclioptions.NewConfigFlags(false)
|
||||
kf.KubeConfig = &kp
|
||||
return cmdutil.NewFactory(kf)
|
||||
|
Loading…
Reference in New Issue
Block a user