-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2647 from jstuever/bz1762618
Bug 1762618: pkg/asset/ignition: bootstrap kubeconfig to use api-int
- Loading branch information
Showing
2 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |