Skip to content

Commit 55bf57b

Browse files
authored
fix: Use correct CamelCase Kind names in reconcile resources (#590)
Description of changes: Fixed the generation of reconcile resources in the Helm chart to use proper CamelCase Kind names. The previous implementation using `metaVars.CRDNames` with `names.New(name).Camel` was incorrectly converting CRD names from their lowercase plural form, resulting in improper capitalization. The previous approach used `metaVars.CRDNames` which contains lowercase plural forms (e.g., "preparedstatements", "workgroups"). When these were processed through `names.New(name).Camel`, it only capitalized the first letter without properly handling internal word breaks, leading to incorrect resource kind names. Issue: ```yaml resources: - Preparedstatements # incorrect - Workgroups # incorrect ``` Fix: ```yaml resources: - PreparedStatement - WorkGroup ``` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent d609aed commit 55bf57b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

pkg/generate/ack/release.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"github.com/aws-controllers-k8s/code-generator/pkg/generate/templateset"
2222
ackmetadata "github.com/aws-controllers-k8s/code-generator/pkg/metadata"
2323
ackmodel "github.com/aws-controllers-k8s/code-generator/pkg/model"
24-
"github.com/aws-controllers-k8s/pkg/names"
2524
)
2625

2726
var (
@@ -104,9 +103,20 @@ func Release(
104103
releaseFuncMap(m.MetaVars().ControllerName),
105104
)
106105
metaVars := m.MetaVars()
107-
reconcileResources := make([]string, len(metaVars.CRDNames))
108-
for i, name := range metaVars.CRDNames {
109-
reconcileResources[i] = names.New(name).Camel
106+
// Using GetCRDs() directly gives us the proper CamelCase format
107+
// that matches the Kubernetes API resource kinds. The previous approach using
108+
// metaVars.CRDNames with names.New(name).Camel was incorrect because CRDNames
109+
// contains lowercase plural forms (e.g., "preparedstatements", "workgroups")
110+
// and the names package's Camel conversion wasn't handling the internal word
111+
// breaks correctly, resulting in "Preparedstatements" instead of "PreparedStatement".
112+
crds, err := m.GetCRDs()
113+
if err != nil {
114+
return nil, err
115+
}
116+
117+
reconcileResources := make([]string, 0)
118+
for _, crd := range crds {
119+
reconcileResources = append(reconcileResources, crd.Kind)
110120
}
111121

112122
releaseVars := &templateReleaseVars{

0 commit comments

Comments
 (0)