Skip to content

Commit

Permalink
Merge pull request #2647 from jstuever/bz1762618
Browse files Browse the repository at this point in the history
Bug 1762618: pkg/asset/ignition: bootstrap kubeconfig to use api-int
  • Loading branch information
openshift-merge-robot authored Nov 12, 2019
2 parents 0ee8c54 + 2aae2a9 commit a498f63
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/asset/ignition/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var _ asset.WritableAsset = (*Bootstrap)(nil)
func (a *Bootstrap) Dependencies() []asset.Asset {
return []asset.Asset{
&installconfig.InstallConfig{},
&kubeconfig.AdminClient{},
&kubeconfig.AdminInternalClient{},
&kubeconfig.Kubelet{},
&kubeconfig.LoopbackClient{},
&machines.Master{},
Expand Down Expand Up @@ -425,7 +425,7 @@ func (a *Bootstrap) addParentFiles(dependencies asset.Parents) {

// These files are all added with mode 0600; use for secret keys and the like.
for _, asset := range []asset.WritableAsset{
&kubeconfig.AdminClient{},
&kubeconfig.AdminInternalClient{},
&kubeconfig.Kubelet{},
&kubeconfig.LoopbackClient{},
&tls.AdminKubeConfigCABundle{},
Expand Down
56 changes: 56 additions & 0 deletions pkg/asset/kubeconfig/admin_internal.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package kubeconfig

import (
"path/filepath"

"github.com/openshift/installer/pkg/asset"
"github.com/openshift/installer/pkg/asset/installconfig"
"github.com/openshift/installer/pkg/asset/tls"
)

var (
kubeconfigAdminInternalPath = filepath.Join("auth", "kubeconfig")
)

// AdminInternalClient is the asset for the admin kubeconfig.
type AdminInternalClient struct {
kubeconfig
}

var _ asset.WritableAsset = (*AdminInternalClient)(nil)

// Dependencies returns the dependency of the kubeconfig.
func (k *AdminInternalClient) Dependencies() []asset.Asset {
return []asset.Asset{
&tls.AdminKubeConfigClientCertKey{},
&tls.KubeAPIServerCompleteCABundle{},
&installconfig.InstallConfig{},
}
}

// Generate generates the kubeconfig.
func (k *AdminInternalClient) Generate(parents asset.Parents) error {
ca := &tls.KubeAPIServerCompleteCABundle{}
clientCertKey := &tls.AdminKubeConfigClientCertKey{}
installConfig := &installconfig.InstallConfig{}
parents.Get(ca, clientCertKey, installConfig)

return k.kubeconfig.generate(
ca,
clientCertKey,
getIntAPIServerURL(installConfig.Config),
installConfig.Config.GetName(),
"admin",
kubeconfigAdminInternalPath,
)
}

// Name returns the human-friendly name of the asset.
func (k *AdminInternalClient) Name() string {
return "Kubeconfig Admin Internal Client"
}

// Load returns the kubeconfig from disk.
func (k *AdminInternalClient) Load(f asset.FileFetcher) (found bool, err error) {
return false, nil
}

0 comments on commit a498f63

Please sign in to comment.