Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit ed362df

Browse files
committed
fix: comments after review
1 parent 34f1c7c commit ed362df

File tree

3 files changed

+46
-37
lines changed

3 files changed

+46
-37
lines changed

charts/cluster-api-runtime-extensions-nutanix/templates/helm-config.yaml

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,33 @@
11
apiVersion: v1
22
data:
3-
aws-ccm: |
4-
defaultChartName: aws-cloud-controller-manager
5-
defaultChartVersion: ""
6-
defaultRepositoryUrl: https://kubernetes.github.io/cloud-provider-aws
73
aws-ebs-csi: |
8-
defaultChartName: aws-ebs-csi-driver
9-
defaultChartVersion: v2.28.1
10-
defaultRepositoryUrl: https://kubernetes-sigs.github.io/aws-ebs-csi-driver
4+
ChartName: aws-ebs-csi-driver
5+
ChartVersion: v2.28.1
6+
RepositoryURL: https://kubernetes-sigs.github.io/aws-ebs-csi-driver
117
cilium: |
12-
defaultChartName: cilium
13-
defaultChartVersion: 1.15.0
14-
defaultRepositoryUrl: https://helm.cilium.io/
8+
ChartName: cilium
9+
ChartVersion: 1.15.0
10+
RepositoryURL: https://helm.cilium.io/
1511
cluster-autoscaler: |
16-
defaultChartName: cluster-autoscaler
17-
defaultChartVersion: 9.35.0
18-
defaultRepositoryUrl: https://kubernetes.github.io/autoscaler
12+
ChartName: cluster-autoscaler
13+
ChartVersion: 9.35.0
14+
RepositoryURL: https://kubernetes.github.io/autoscaler
1915
nfd: |
20-
defaultChartName: node-feature-discovery
21-
defaultChartVersion: 0.15.2
22-
defaultRepositoryUrl: https://kubernetes-sigs.github.io/node-feature-discovery/charts
16+
ChartName: node-feature-discovery
17+
ChartVersion: 0.15.2
18+
RepositoryURL: https://kubernetes-sigs.github.io/node-feature-discovery/charts
2319
nutanix-snapshot-csi: |
24-
defaultChartName: nutanix-csi-snapshot
25-
defaultChartVersion: v6.3.2
26-
defaultRepositoryUrl: https://nutanix.github.io/helm/
20+
ChartName: nutanix-csi-snapshot
21+
ChartVersion: v6.3.2
22+
RepositoryURL: https://nutanix.github.io/helm/
2723
nutanix-storage-csi: |
28-
defaultChartName: nutanix-csi-storage
29-
defaultChartVersion: v2.6.6
30-
defaultRepositoryUrl: https://nutanix.github.io/helm/
24+
ChartName: nutanix-csi-storage
25+
ChartVersion: v2.6.6
26+
RepositoryURL: https://nutanix.github.io/helm/
3127
tigera-operator: |
32-
defaultChartName: tigera-operator
33-
defaultChartVersion: v3.26.4
34-
defaultRepositoryUrl: https://docs.tigera.io/calico/charts
28+
ChartName: tigera-operator
29+
ChartVersion: v3.26.4
30+
RepositoryURL: https://docs.tigera.io/calico/charts
3531
kind: ConfigMap
3632
metadata:
3733
creationTimestamp: null

hack/tools/helm-cm/main.go

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ func main() {
7070
}
7171

7272
type configMapInfo struct {
73-
configMapFieldName string
74-
DefaultRepositoryURL string `json:"defaultRepositoryUrl"`
75-
DefaultChartVersion string `json:"defaultChartVersion"`
76-
DefaultChartName string `json:"defaultChartName"`
73+
configMapFieldName string
74+
RepositoryURL string `json:"RepositoryURL"`
75+
ChartVersion string `json:"ChartVersion"`
76+
ChartName string `json:"ChartName"`
7777
}
7878

7979
func createConfigMapFromDir(kustomizeDir string) (*corev1.ConfigMap, error) {
@@ -91,7 +91,7 @@ func createConfigMapFromDir(kustomizeDir string) (*corev1.ConfigMap, error) {
9191
if err != nil {
9292
return err
9393
}
94-
if strings.Contains(filepath, "kustomization.yaml.tmpl") {
94+
if strings.Contains(filepath, "kustomization.yaml.tmpl") && !isIgnored(filepath) {
9595
f, err := os.Open(path.Join(fullPath, filepath))
9696
if err != nil {
9797
return fmt.Errorf("failed to open file: %w", err)
@@ -119,13 +119,13 @@ func createConfigMapFromDir(kustomizeDir string) (*corev1.ConfigMap, error) {
119119
name := info["name"].(string)
120120
dirName := strings.Split(filepath, "/")[0]
121121
i := configMapInfo{
122-
configMapFieldName: dirName,
123-
DefaultRepositoryURL: repo,
124-
DefaultChartName: name,
122+
configMapFieldName: dirName,
123+
RepositoryURL: repo,
124+
ChartName: name,
125125
}
126126
versionEnvVar := info["version"].(string)
127127
version := os.ExpandEnv(versionEnvVar)
128-
i.DefaultChartVersion = version
128+
i.ChartVersion = version
129129
results = append(results, i)
130130
return nil
131131
}
@@ -151,3 +151,16 @@ func createConfigMapFromDir(kustomizeDir string) (*corev1.ConfigMap, error) {
151151
}
152152
return &finalCM, err
153153
}
154+
155+
var ignored = []string{
156+
"aws-ccm",
157+
}
158+
159+
func isIgnored(filepath string) bool {
160+
for _, i := range ignored {
161+
if strings.Contains(filepath, i) {
162+
return true
163+
}
164+
}
165+
return false
166+
}

pkg/handlers/generic/lifecycle/config/cm.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ type HelmChartGetter struct {
3232
}
3333

3434
type HelmChart struct {
35-
Name string `yaml:"defaultChartName"`
36-
Version string `yaml:"defaultChartVersion"`
37-
Repository string `yaml:"defaultRepositoryUrl"`
35+
Name string `yaml:"ChartName"`
36+
Version string `yaml:"ChartVersion"`
37+
Repository string `yaml:"RepositoryURL"`
3838
}
3939

4040
func NewHelmChartGetterFromConfigMap(

0 commit comments

Comments
 (0)