Merge pull request #109751 from SataQiu/clean-kubeadm-20220502

kubeadm: replace *clientset.Clientset with clientset.Interface for join phase
This commit is contained in:
Kubernetes Prow Robot 2022-05-05 01:43:06 -07:00 committed by GitHub
commit f1ad477c88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 11 deletions

View File

@ -145,7 +145,7 @@ type joinData struct {
cfg *kubeadmapi.JoinConfiguration
initCfg *kubeadmapi.InitConfiguration
tlsBootstrapCfg *clientcmdapi.Config
clientSet *clientset.Clientset
client clientset.Interface
ignorePreflightErrors sets.String
outputWriter io.Writer
patchesDir string
@ -547,10 +547,10 @@ func (j *joinData) InitCfg() (*kubeadmapi.InitConfiguration, error) {
return initCfg, err
}
// ClientSet returns the ClientSet for accessing the cluster with the identity defined in admin.conf.
func (j *joinData) ClientSet() (*clientset.Clientset, error) {
if j.clientSet != nil {
return j.clientSet, nil
// Client returns the Client for accessing the cluster with the identity defined in admin.conf.
func (j *joinData) Client() (clientset.Interface, error) {
if j.client != nil {
return j.client, nil
}
path := filepath.Join(j.KubeConfigDir(), kubeadmconstants.AdminKubeConfigFileName)
@ -558,7 +558,7 @@ func (j *joinData) ClientSet() (*clientset.Clientset, error) {
if err != nil {
return nil, errors.Wrap(err, "[preflight] couldn't create Kubernetes client")
}
j.clientSet = client
j.client = client
return client, nil
}

View File

@ -61,7 +61,7 @@ func runCheckEtcdPhase(c workflow.RunData) error {
// Checks that the etcd cluster is healthy
// NB. this check cannot be implemented before because it requires the admin.conf and all the certificates
// for connecting to etcd already in place
client, err := data.ClientSet()
client, err := data.Client()
if err != nil {
return err
}

View File

@ -116,7 +116,7 @@ func runEtcdPhase(c workflow.RunData) error {
}
// gets access to the cluster using the identity defined in admin.conf
client, err := data.ClientSet()
client, err := data.Client()
if err != nil {
return errors.Wrap(err, "couldn't create Kubernetes client")
}
@ -180,7 +180,7 @@ func runMarkControlPlanePhase(c workflow.RunData) error {
}
// gets access to the cluster using the identity defined in admin.conf
client, err := data.ClientSet()
client, err := data.Client()
if err != nil {
return errors.Wrap(err, "couldn't create Kubernetes client")
}

View File

@ -33,7 +33,7 @@ type JoinData interface {
Cfg() *kubeadmapi.JoinConfiguration
TLSBootstrapCfg() (*clientcmdapi.Config, error)
InitCfg() (*kubeadmapi.InitConfiguration, error)
ClientSet() (*clientset.Clientset, error)
Client() (clientset.Interface, error)
IgnorePreflightErrors() sets.String
OutputWriter() io.Writer
PatchesDir() string

View File

@ -36,7 +36,7 @@ func (j *testJoinData) CertificateKey() string { return
func (j *testJoinData) Cfg() *kubeadmapi.JoinConfiguration { return nil }
func (j *testJoinData) TLSBootstrapCfg() (*clientcmdapi.Config, error) { return nil, nil }
func (j *testJoinData) InitCfg() (*kubeadmapi.InitConfiguration, error) { return nil, nil }
func (j *testJoinData) ClientSet() (*clientset.Clientset, error) { return nil, nil }
func (j *testJoinData) Client() (clientset.Interface, error) { return nil, nil }
func (j *testJoinData) IgnorePreflightErrors() sets.String { return nil }
func (j *testJoinData) OutputWriter() io.Writer { return nil }
func (j *testJoinData) PatchesDir() string { return "" }