Skip to content

Commit

Permalink
Fix error message for Bottlerocket validation
Browse files Browse the repository at this point in the history
  • Loading branch information
cPu1 committed Aug 17, 2023
1 parent 299403d commit 11894ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pkg/apis/eksctl.io/v1alpha5/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -1485,8 +1485,8 @@ func (fps FargateProfileSelector) Validate() error {
}

func checkBottlerocketSettings(ng *NodeGroup, path string) error {
overlapErr := func(key, ngField string) error {
return errors.Errorf("invalid Bottlerocket setting: use %s.%s instead (path=%s)", path, ngField, key)
overlapErr := func(kubernetesKey, ngField string) error {
return fmt.Errorf("invalid Bottlerocket setting: use %[1]s.%[2]s instead (path=%[1]s.bottlerocket.settings.kubernetes.%[3]s)", path, ngField, kubernetesKey)
}

// Dig into kubernetes settings if provided.
Expand All @@ -1509,7 +1509,7 @@ func checkBottlerocketSettings(ng *NodeGroup, path string) error {
for checkKey, shouldUse := range checkMapping {
_, ok := kube[checkKey]
if ok {
return overlapErr(path+".kubernetes."+checkKey, shouldUse)
return overlapErr(checkKey, shouldUse)
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/eksctl.io/v1alpha5/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,7 @@ var _ = Describe("ClusterConfig validation", func() {
},
},

expectedErr: "invalid Bottlerocket setting: use nodeGroups[0].labels instead (path=nodeGroups[0].kubernetes.node-labels)",
expectedErr: "invalid Bottlerocket setting: use nodeGroups[0].labels instead (path=nodeGroups[0].bottlerocket.settings.kubernetes.node-labels)",
}),

Entry("both clusterDNS and cluster-dns-ip set", bottlerocketEntry{
Expand Down

0 comments on commit 11894ae

Please sign in to comment.