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

View File

@ -61,7 +61,7 @@ func runCheckEtcdPhase(c workflow.RunData) error {
// Checks that the etcd cluster is healthy // Checks that the etcd cluster is healthy
// NB. this check cannot be implemented before because it requires the admin.conf and all the certificates // NB. this check cannot be implemented before because it requires the admin.conf and all the certificates
// for connecting to etcd already in place // for connecting to etcd already in place
client, err := data.ClientSet() client, err := data.Client()
if err != nil { if err != nil {
return err 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 // gets access to the cluster using the identity defined in admin.conf
client, err := data.ClientSet() client, err := data.Client()
if err != nil { if err != nil {
return errors.Wrap(err, "couldn't create Kubernetes client") 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 // gets access to the cluster using the identity defined in admin.conf
client, err := data.ClientSet() client, err := data.Client()
if err != nil { if err != nil {
return errors.Wrap(err, "couldn't create Kubernetes client") return errors.Wrap(err, "couldn't create Kubernetes client")
} }

View File

@ -33,7 +33,7 @@ type JoinData interface {
Cfg() *kubeadmapi.JoinConfiguration Cfg() *kubeadmapi.JoinConfiguration
TLSBootstrapCfg() (*clientcmdapi.Config, error) TLSBootstrapCfg() (*clientcmdapi.Config, error)
InitCfg() (*kubeadmapi.InitConfiguration, error) InitCfg() (*kubeadmapi.InitConfiguration, error)
ClientSet() (*clientset.Clientset, error) Client() (clientset.Interface, error)
IgnorePreflightErrors() sets.String IgnorePreflightErrors() sets.String
OutputWriter() io.Writer OutputWriter() io.Writer
PatchesDir() string 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) Cfg() *kubeadmapi.JoinConfiguration { return nil }
func (j *testJoinData) TLSBootstrapCfg() (*clientcmdapi.Config, error) { return nil, nil } func (j *testJoinData) TLSBootstrapCfg() (*clientcmdapi.Config, error) { return nil, nil }
func (j *testJoinData) InitCfg() (*kubeadmapi.InitConfiguration, 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) IgnorePreflightErrors() sets.String { return nil }
func (j *testJoinData) OutputWriter() io.Writer { return nil } func (j *testJoinData) OutputWriter() io.Writer { return nil }
func (j *testJoinData) PatchesDir() string { return "" } func (j *testJoinData) PatchesDir() string { return "" }