diff --git a/pkg/apis/eksctl.io/v1alpha5/validation.go b/pkg/apis/eksctl.io/v1alpha5/validation.go index 609ea523bc1..fa4c60cecf1 100644 --- a/pkg/apis/eksctl.io/v1alpha5/validation.go +++ b/pkg/apis/eksctl.io/v1alpha5/validation.go @@ -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. @@ -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) } } diff --git a/pkg/apis/eksctl.io/v1alpha5/validation_test.go b/pkg/apis/eksctl.io/v1alpha5/validation_test.go index fd5aedf916f..420ba77da04 100644 --- a/pkg/apis/eksctl.io/v1alpha5/validation_test.go +++ b/pkg/apis/eksctl.io/v1alpha5/validation_test.go @@ -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{