mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
kubeadm: fix dry-run for kubelet-wait-bootstrap phase
This commit is contained in:
parent
20fbdeac96
commit
6c093b1699
@ -609,7 +609,9 @@ func (j *joinData) Client() (clientset.Interface, error) {
|
|||||||
AppendReactor(dryRun.GetKubeadmConfigReactor()).
|
AppendReactor(dryRun.GetKubeadmConfigReactor()).
|
||||||
AppendReactor(dryRun.GetKubeadmCertsReactor()).
|
AppendReactor(dryRun.GetKubeadmCertsReactor()).
|
||||||
AppendReactor(dryRun.GetKubeProxyConfigReactor()).
|
AppendReactor(dryRun.GetKubeProxyConfigReactor()).
|
||||||
AppendReactor(dryRun.GetKubeletConfigReactor())
|
AppendReactor(dryRun.GetKubeletConfigReactor()).
|
||||||
|
AppendReactor(dryRun.GetNodeReactor()).
|
||||||
|
AppendReactor(dryRun.PatchNodeReactor())
|
||||||
|
|
||||||
j.client = dryRun.FakeClient()
|
j.client = dryRun.FakeClient()
|
||||||
return j.client, nil
|
return j.client, nil
|
||||||
|
@ -293,6 +293,16 @@ func runKubeletWaitBootstrapPhase(c workflow.RunData) (returnErr error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var client clientset.Interface
|
||||||
|
|
||||||
|
if data.DryRun() {
|
||||||
|
fmt.Println("[kubelet-wait] Would wait for the kubelet to be bootstrapped")
|
||||||
|
|
||||||
|
// Use the dry-run client.
|
||||||
|
if client, err = data.Client(); err != nil {
|
||||||
|
return errors.Wrap(err, "could not get client for dry-run")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
bootstrapKubeConfigFile := filepath.Join(data.KubeConfigDir(), kubeadmconstants.KubeletBootstrapKubeConfigFileName)
|
bootstrapKubeConfigFile := filepath.Join(data.KubeConfigDir(), kubeadmconstants.KubeletBootstrapKubeConfigFileName)
|
||||||
// Deletes the bootstrapKubeConfigFile, so the credential used for TLS bootstrap is removed from disk
|
// Deletes the bootstrapKubeConfigFile, so the credential used for TLS bootstrap is removed from disk
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -328,10 +338,11 @@ func runKubeletWaitBootstrapPhase(c workflow.RunData) (returnErr error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// When we know the /etc/kubernetes/kubelet.conf file is available, get the client
|
// When we know the /etc/kubernetes/kubelet.conf file is available, get the client
|
||||||
client, err := kubeconfigutil.ClientSetFromFile(kubeadmconstants.GetKubeletKubeConfigPath())
|
client, err = kubeconfigutil.ClientSetFromFile(kubeadmconstants.GetKubeletKubeConfigPath())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !features.Enabled(initCfg.ClusterConfiguration.FeatureGates, features.NodeLocalCRISocket) {
|
if !features.Enabled(initCfg.ClusterConfiguration.FeatureGates, features.NodeLocalCRISocket) {
|
||||||
klog.V(1).Infoln("[kubelet-start] preserving the crisocket information for the node")
|
klog.V(1).Infoln("[kubelet-start] preserving the crisocket information for the node")
|
||||||
|
Loading…
Reference in New Issue
Block a user