Skip to content

Commit 48a5656

Browse files
authored
Do not remove cluster configuring if refresh fails (#893)
1 parent b1ca66e commit 48a5656

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cli/cmd/cluster.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,9 @@ func refreshCachedClusterConfig(awsCreds AWSCredentials) clusterconfig.Config {
321321
fmt.Println("fetching cluster configuration ..." + "\n")
322322
out, exitCode, err := runManagerAccessCommand("/root/refresh.sh "+mountedConfigPath, *accessConfig, awsCreds)
323323
if err != nil {
324-
os.Remove(cachedConfigPath)
325324
exit.Error(err)
326325
}
327326
if exitCode == nil || *exitCode != 0 {
328-
os.Remove(cachedConfigPath)
329327
exit.Error(ErrorClusterRefresh(out))
330328
}
331329

manager/refresh.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ fi
2727
eksctl utils write-kubeconfig --cluster=$CORTEX_CLUSTER_NAME --region=$CORTEX_REGION | grep -v "saved kubeconfig as" | grep -v "using region" | grep -v "eksctl version" || true
2828

2929
kubectl get -n=default configmap cluster-config -o yaml >> cluster_configmap.yaml
30-
python refresh_cluster_config.py cluster_configmap.yaml $cached_cluster_config_file
30+
python refresh_cluster_config.py cluster_configmap.yaml tmp_cluster_config.yaml
3131

3232
kubectl -n=default create configmap 'cluster-config' \
33-
--from-file='cluster.yaml'=$cached_cluster_config_file \
33+
--from-file='cluster.yaml'=tmp_cluster_config.yaml \
3434
-o yaml --dry-run | kubectl apply -f - >/dev/null
35+
36+
cp tmp_cluster_config.yaml $cached_cluster_config_file

0 commit comments

Comments
 (0)