mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-21 06:21:43 -04:00
bootstrapper: remove unnecessary stat (#3202)
This commit is contained in:
parent
dcb8cca268
commit
50dcfd7905
1 changed files with 10 additions and 16 deletions
|
@ -137,15 +137,12 @@ func (k *KubernetesUtil) InitCluster(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create static pods directory for all nodes (the Kubelets on the worker nodes also expect the path to exist)
|
// Create static pods directory for all nodes (the Kubelets on the worker nodes also expect the path to exist)
|
||||||
if _, err := os.Stat("/etc/kubernetes/manifests"); err == nil {
|
|
||||||
// If the node rebooted after the static pod directory was created,
|
// If the node rebooted after the static pod directory was created,
|
||||||
// the existing directory needs to be removed before we can
|
// the existing directory needs to be removed before we can
|
||||||
// try to init the cluster again.
|
// try to init the cluster again.
|
||||||
log.Info("Removing existing static Pod directory /etc/kubernetes/manifests")
|
|
||||||
if err := os.RemoveAll("/etc/kubernetes/manifests"); err != nil {
|
if err := os.RemoveAll("/etc/kubernetes/manifests"); err != nil {
|
||||||
return nil, fmt.Errorf("removing static pods directory: %w", err)
|
return nil, fmt.Errorf("removing static pods directory: %w", err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
log.Info("Creating static Pod directory /etc/kubernetes/manifests")
|
log.Info("Creating static Pod directory /etc/kubernetes/manifests")
|
||||||
if err := os.MkdirAll("/etc/kubernetes/manifests", os.ModePerm); err != nil {
|
if err := os.MkdirAll("/etc/kubernetes/manifests", os.ModePerm); err != nil {
|
||||||
return nil, fmt.Errorf("creating static pods directory: %w", err)
|
return nil, fmt.Errorf("creating static pods directory: %w", err)
|
||||||
|
@ -209,15 +206,12 @@ func (k *KubernetesUtil) JoinCluster(ctx context.Context, joinConfig []byte, log
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create static pods directory for all nodes (the Kubelets on the worker nodes also expect the path to exist)
|
// Create static pods directory for all nodes (the Kubelets on the worker nodes also expect the path to exist)
|
||||||
if _, err := os.Stat("/etc/kubernetes/manifests"); err == nil {
|
|
||||||
// If the node rebooted after the static pod directory was created, for example
|
// If the node rebooted after the static pod directory was created, for example
|
||||||
// if a failure during an upgrade occurred, the existing directory needs to be
|
// if a failure during an upgrade occurred, the existing directory needs to be
|
||||||
// removed before we can try to join the cluster again.
|
// removed before we can try to join the cluster again.
|
||||||
log.Info("Removing existing static Pod directory /etc/kubernetes/manifests")
|
|
||||||
if err := os.RemoveAll("/etc/kubernetes/manifests"); err != nil {
|
if err := os.RemoveAll("/etc/kubernetes/manifests"); err != nil {
|
||||||
return fmt.Errorf("removing static pods directory: %w", err)
|
return fmt.Errorf("removing static pods directory: %w", err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
log.Info("Creating static Pod directory /etc/kubernetes/manifests")
|
log.Info("Creating static Pod directory /etc/kubernetes/manifests")
|
||||||
if err := os.MkdirAll("/etc/kubernetes/manifests", os.ModePerm); err != nil {
|
if err := os.MkdirAll("/etc/kubernetes/manifests", os.ModePerm); err != nil {
|
||||||
return fmt.Errorf("creating static pods directory: %w", err)
|
return fmt.Errorf("creating static pods directory: %w", err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue