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

     1  package configimage
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/openshift/installer/pkg/asset"
     7  	"github.com/openshift/installer/pkg/asset/tls"
     8  )
     9  
    10  // ImageBasedKubeAPIServerCompleteCABundle is the asset the generates the kube-apiserver-complete-server-ca-bundle,
    11  // which contains all the certs that are valid to confirm the kube-apiserver identity and it also contains the
    12  // Ingress Operator CA certificate.
    13  type ImageBasedKubeAPIServerCompleteCABundle struct {
    14  	tls.CertBundle
    15  }
    16  
    17  var _ asset.Asset = (*ImageBasedKubeAPIServerCompleteCABundle)(nil)
    18  
    19  // Dependencies returns the dependency of the cert bundle.
    20  func (a *ImageBasedKubeAPIServerCompleteCABundle) Dependencies() []asset.Asset {
    21  	return []asset.Asset{
    22  		&tls.KubeAPIServerLocalhostCABundle{},
    23  		&tls.KubeAPIServerServiceNetworkCABundle{},
    24  		&tls.KubeAPIServerLBCABundle{},
    25  		&IngressOperatorCABundle{},
    26  	}
    27  }
    28  
    29  // Generate generates the cert bundle based on its dependencies.
    30  func (a *ImageBasedKubeAPIServerCompleteCABundle) Generate(ctx context.Context, deps asset.Parents) error {
    31  	certs := []tls.CertInterface{}
    32  	for _, asset := range a.Dependencies() {
    33  		deps.Get(asset)
    34  		certs = append(certs, asset.(tls.CertInterface))
    35  	}
    36  	return a.CertBundle.Generate(ctx, "kube-apiserver-complete-server-ca-bundle", certs...)
    37  }
    38  
    39  // Name returns the human-friendly name of the asset.
    40  func (a *ImageBasedKubeAPIServerCompleteCABundle) Name() string {
    41  	return "Certificate (kube-apiserver-complete-server-ca-bundle)"
    42  }