Skip to content

Commit 1938341

Browse files
committed
revert temporary fix
1 parent 8258b6b commit 1938341

1 file changed

Lines changed: 8 additions & 26 deletions

File tree

services/kuber/server/domain/usecases/patch_kubeadm.go

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package usecases
33
import (
44
"context"
55
"fmt"
6-
"time"
76

87
"github.com/berops/claudie/internal/kubectl"
98
"github.com/berops/claudie/internal/loggerutils"
@@ -35,33 +34,16 @@ func (u *Usecases) PatchKubeadmConfigMap(ctx context.Context, request *pb.PatchK
3534
Kubeconfig: request.DesiredCluster.Kubeconfig,
3635
}
3736

38-
var configMap []byte
39-
var rawKubeadmConfigMap map[string]any
40-
var err error
41-
42-
// try to unmarshall the kubeadm config map 3 times before giving up.
43-
// the e2e tests fail sometimes after the cluster has been created with error:
44-
// failed to unmarshal kubeadm-config cluster map, malformed yaml: yaml: mapping values are not allowed in this context"
45-
// https://github.com/berops/claudie/issues/1686
46-
// This is a simple workaround until the problem is resolved.
47-
const retries = 3
48-
for range retries {
49-
configMap, err = k.KubectlGet("cm kubeadm-config", "-oyaml", "-n kube-system")
50-
if err != nil {
51-
return nil, err
52-
}
53-
if configMap == nil {
54-
return &pb.PatchKubeadmConfigMapResponse{}, nil
55-
}
56-
if err = yaml.Unmarshal(configMap, &rawKubeadmConfigMap); err != nil {
57-
logger.Warn().Msgf("failed to unmarshal kubeadm-config cluster map: %v, trying again later", err)
58-
time.Sleep(time.Second)
59-
continue
60-
}
61-
break
37+
configMap, err := k.KubectlGet("cm kubeadm-config", "-oyaml", "-n kube-system")
38+
if err != nil {
39+
return nil, err
40+
}
41+
if configMap == nil {
42+
return &pb.PatchKubeadmConfigMapResponse{}, nil
6243
}
6344

64-
if err != nil {
45+
var rawKubeadmConfigMap map[string]any
46+
if err := yaml.Unmarshal(configMap, &rawKubeadmConfigMap); err != nil {
6547
return nil, fmt.Errorf("failed to unmarshal kubeadm-config cluster map, malformed yaml: %w", err)
6648
}
6749

0 commit comments

Comments
 (0)