github.com/openshift/installer@v1.4.17/pkg/asset/kubeconfig/imagebased.go (about)

     1  package kubeconfig
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/openshift/installer/pkg/asset"
     7  	"github.com/openshift/installer/pkg/asset/imagebased/configimage"
     8  	"github.com/openshift/installer/pkg/asset/tls"
     9  )
    10  
    11  // ImageBasedAdminClient is the asset for the image-based admin kubeconfig.
    12  type ImageBasedAdminClient struct {
    13  	AdminClient
    14  }
    15  
    16  // Dependencies returns the dependency of the kubeconfig.
    17  func (k *ImageBasedAdminClient) Dependencies() []asset.Asset {
    18  	return []asset.Asset{
    19  		&tls.AdminKubeConfigClientCertKey{},
    20  		&configimage.ImageBasedKubeAPIServerCompleteCABundle{},
    21  		&configimage.InstallConfig{},
    22  	}
    23  }
    24  
    25  // Generate generates the kubeconfig.
    26  func (k *ImageBasedAdminClient) Generate(_ context.Context, parents asset.Parents) error {
    27  	ca := &configimage.ImageBasedKubeAPIServerCompleteCABundle{}
    28  	clientCertKey := &tls.AdminKubeConfigClientCertKey{}
    29  	installConfig := &configimage.InstallConfig{}
    30  	parents.Get(ca, clientCertKey, installConfig)
    31  
    32  	return k.kubeconfig.generate(
    33  		ca,
    34  		clientCertKey,
    35  		getExtAPIServerURL(installConfig.Config),
    36  		installConfig.Config.GetName(),
    37  		"admin",
    38  		kubeconfigAdminPath,
    39  	)
    40  }