github.com/openshift/installer@v1.4.17/pkg/asset/kubeconfig/admin_internal.go (about) 1 package kubeconfig 2 3 import ( 4 "context" 5 "path/filepath" 6 7 "github.com/openshift/installer/pkg/asset" 8 "github.com/openshift/installer/pkg/asset/installconfig" 9 "github.com/openshift/installer/pkg/asset/tls" 10 ) 11 12 var ( 13 kubeconfigAdminInternalPath = filepath.Join("auth", "kubeconfig") 14 ) 15 16 // AdminInternalClient is the asset for the admin kubeconfig. 17 type AdminInternalClient struct { 18 kubeconfig 19 } 20 21 var _ asset.WritableAsset = (*AdminInternalClient)(nil) 22 23 // Dependencies returns the dependency of the kubeconfig. 24 func (k *AdminInternalClient) Dependencies() []asset.Asset { 25 return []asset.Asset{ 26 &tls.AdminKubeConfigClientCertKey{}, 27 &tls.KubeAPIServerCompleteCABundle{}, 28 &installconfig.InstallConfig{}, 29 } 30 } 31 32 // Generate generates the kubeconfig. 33 func (k *AdminInternalClient) Generate(_ context.Context, parents asset.Parents) error { 34 ca := &tls.KubeAPIServerCompleteCABundle{} 35 clientCertKey := &tls.AdminKubeConfigClientCertKey{} 36 installConfig := &installconfig.InstallConfig{} 37 parents.Get(ca, clientCertKey, installConfig) 38 39 return k.kubeconfig.generate( 40 ca, 41 clientCertKey, 42 getIntAPIServerURL(installConfig.Config), 43 installConfig.Config.GetName(), 44 "admin", 45 kubeconfigAdminInternalPath, 46 ) 47 } 48 49 // Name returns the human-friendly name of the asset. 50 func (k *AdminInternalClient) Name() string { 51 return "Kubeconfig Admin Internal Client" 52 } 53 54 // Load returns the kubeconfig from disk. 55 func (k *AdminInternalClient) Load(f asset.FileFetcher) (found bool, err error) { 56 return false, nil 57 }