Skip to content

Commit 710471c

Browse files
committed
fixup! refactor: Move helm value to helmRepository.enabled
1 parent e738700 commit 710471c

File tree

10 files changed

+93
-41
lines changed

10 files changed

+93
-41
lines changed

charts/cluster-api-runtime-extensions-nutanix/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ A Helm chart for cluster-api-runtime-extensions-nutanix
3232
| deployment.replicas | int | `1` | |
3333
| env | object | `{}` | |
3434
| helmAddonsConfigMap | string | `"default-helm-addons-config"` | |
35+
| helmRepository.enabled | bool | `true` | |
3536
| helmRepository.images.bundleInitializer.pullPolicy | string | `"IfNotPresent"` | |
3637
| helmRepository.images.bundleInitializer.repository | string | `"ghcr.io/nutanix-cloud-native/caren-helm-reg"` | |
3738
| helmRepository.images.bundleInitializer.tag | string | `""` | |
@@ -102,7 +103,6 @@ A Helm chart for cluster-api-runtime-extensions-nutanix
102103
| resources.requests.cpu | string | `"100m"` | |
103104
| resources.requests.memory | string | `"128Mi"` | |
104105
| securityContext.runAsUser | int | `65532` | |
105-
| selfHostedRegistry | bool | `true` | |
106106
| service.annotations | object | `{}` | |
107107
| service.port | int | `443` | |
108108
| service.type | string | `"ClusterIP"` | |

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,48 +10,48 @@ data:
1010
aws-ccm: |
1111
ChartName: aws-cloud-controller-manager
1212
ChartVersion: 0.0.8
13-
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes.github.io/cloud-provider-aws{{ end }}"
13+
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes.github.io/cloud-provider-aws{{ end }}'
1414
aws-ebs-csi: |
1515
ChartName: aws-ebs-csi-driver
1616
ChartVersion: 2.35.1
17-
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes-sigs.github.io/aws-ebs-csi-driver{{ end }}"
17+
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes-sigs.github.io/aws-ebs-csi-driver{{ end }}'
1818
cilium: |
1919
ChartName: cilium
2020
ChartVersion: 1.16.2
21-
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://helm.cilium.io/{{ end }}"
21+
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://helm.cilium.io/{{ end }}'
2222
cluster-autoscaler: |
2323
ChartName: cluster-autoscaler
2424
ChartVersion: 9.40.0
25-
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes.github.io/autoscaler{{ end }}"
25+
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes.github.io/autoscaler{{ end }}'
2626
local-path-provisioner-csi: |
2727
ChartName: local-path-provisioner
2828
ChartVersion: 0.0.29
29-
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://charts.containeroo.ch{{ end }}"
29+
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://charts.containeroo.ch{{ end }}'
3030
metallb: |
3131
ChartName: metallb
3232
ChartVersion: 0.14.8
33-
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://metallb.github.io/metallb{{ end }}"
33+
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://metallb.github.io/metallb{{ end }}'
3434
nfd: |
3535
ChartName: node-feature-discovery
3636
ChartVersion: 0.16.4
37-
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes-sigs.github.io/node-feature-discovery/charts{{ end }}"
37+
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes-sigs.github.io/node-feature-discovery/charts{{ end }}'
3838
nutanix-ccm: |
3939
ChartName: nutanix-cloud-provider
4040
ChartVersion: 0.4.1
41-
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://nutanix.github.io/helm/{{ end }}"
41+
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://nutanix.github.io/helm/{{ end }}'
4242
nutanix-storage-csi: |
4343
ChartName: nutanix-csi-storage
4444
ChartVersion: 3.1.0
45-
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://nutanix.github.io/helm-releases/{{ end }}"
45+
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://nutanix.github.io/helm-releases/{{ end }}'
4646
snapshot-controller: |
4747
ChartName: snapshot-controller
4848
ChartVersion: 3.0.6
49-
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://piraeus.io/helm-charts/{{ end }}"
49+
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://piraeus.io/helm-charts/{{ end }}'
5050
tigera-operator: |
5151
ChartName: tigera-operator
5252
ChartVersion: v3.28.2
53-
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://docs.tigera.io/calico/charts{{ end }}"
53+
RepositoryURL: '{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://docs.tigera.io/calico/charts{{ end }}'
5454
kind: ConfigMap
5555
metadata:
5656
creationTimestamp: null
57-
name: {{ .Values.helmAddonsConfigMap }}
57+
name: '{{ .Values.helmAddonsConfigMap }}'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This file contains the manifests to run a helmRepository deployment which contains helm charts for our addons.
44
# The pod is built via goreleaser with configuration from hack/addons.
55
#
6-
{{ if .Values.selfHostedRegistry }}
6+
{{ if .Values.helmRepository.enabled }}
77
apiVersion: cert-manager.io/v1
88
kind: Issuer
99
metadata:

charts/cluster-api-runtime-extensions-nutanix/values.schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
},
4141
"helmRepository": {
4242
"properties": {
43+
"enabled": {
44+
"type": "boolean"
45+
},
4346
"images": {
4447
"properties": {
4548
"bundleInitializer": {
@@ -599,9 +602,6 @@
599602
},
600603
"type": "object"
601604
},
602-
"selfHostedRegistry": {
603-
"type": "boolean"
604-
},
605605
"service": {
606606
"properties": {
607607
"annotations": {

charts/cluster-api-runtime-extensions-nutanix/values.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ hooks:
110110

111111
helmAddonsConfigMap: default-helm-addons-config
112112

113-
selfHostedRegistry: true
114-
115113
deployDefaultClusterClasses: true
116114

117115
# The ClusterClass and the Templates it references must be in the same namespace
@@ -133,6 +131,7 @@ image:
133131
pullPolicy: IfNotPresent
134132

135133
helmRepository:
134+
enabled: true
136135
images:
137136
bundleInitializer:
138137
repository: ghcr.io/nutanix-cloud-native/caren-helm-reg

hack/addons/add-warning-helm-configmap.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,3 @@ $(cat "${GIT_REPO_ROOT}/hack/license-header.yaml.txt")
2121
#=================================================================
2222
$(cat "${ASSETS_DIR}/helm-config.yaml")
2323
EOF
24-
25-
sed -i s/placeholder/"{{ .Values.helmAddonsConfigMap }}"/g "${GIT_REPO_ROOT}/charts/cluster-api-runtime-extensions-nutanix/templates/helm-config.yaml"

hack/addons/helm-chart-bundler/repos.yaml

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,59 @@
55
# DO NOT EDIT THIS FILE
66
# IT HAS BEEN GENERATED BY /hack/addons/generate-mindthegap-repofile.sh
77
#=================================================================
8-
{}
8+
repositories:
9+
aws-cloud-controller-manager:
10+
repoURL: https://kubernetes.github.io/cloud-provider-aws
11+
charts:
12+
aws-cloud-controller-manager:
13+
- 0.0.8
14+
aws-ebs-csi-driver:
15+
repoURL: https://kubernetes-sigs.github.io/aws-ebs-csi-driver
16+
charts:
17+
aws-ebs-csi-driver:
18+
- 2.35.1
19+
cilium:
20+
repoURL: https://helm.cilium.io/
21+
charts:
22+
cilium:
23+
- 1.16.2
24+
cluster-autoscaler:
25+
repoURL: https://kubernetes.github.io/autoscaler
26+
charts:
27+
cluster-autoscaler:
28+
- 9.40.0
29+
local-path-provisioner:
30+
repoURL: https://charts.containeroo.ch
31+
charts:
32+
local-path-provisioner:
33+
- 0.0.29
34+
metallb:
35+
repoURL: https://metallb.github.io/metallb
36+
charts:
37+
metallb:
38+
- 0.14.8
39+
node-feature-discovery:
40+
repoURL: https://kubernetes-sigs.github.io/node-feature-discovery/charts
41+
charts:
42+
node-feature-discovery:
43+
- 0.16.4
44+
nutanix-cloud-provider:
45+
repoURL: https://nutanix.github.io/helm/
46+
charts:
47+
nutanix-cloud-provider:
48+
- 0.4.1
49+
nutanix-csi-storage:
50+
repoURL: https://nutanix.github.io/helm-releases/
51+
charts:
52+
nutanix-csi-storage:
53+
- 3.1.0
54+
snapshot-controller:
55+
repoURL: https://piraeus.io/helm-charts/
56+
charts:
57+
snapshot-controller:
58+
- 3.0.6
59+
tigera-operator:
60+
repoURL: https://docs.tigera.io/calico/charts
61+
charts:
62+
tigera-operator:
63+
- v3.28.2

hack/tools/helm-cm/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func createConfigMapFromDir(kustomizeDir string) (*corev1.ConfigMap, error) {
137137

138138
finalCM := corev1.ConfigMap{
139139
ObjectMeta: metav1.ObjectMeta{
140-
Name: "placeholder",
140+
Name: "{{ .Values.helmAddonsConfigMap }}",
141141
},
142142
TypeMeta: metav1.TypeMeta{
143143
APIVersion: corev1.SchemeGroupVersion.String(),

hack/tools/mindthegap-helm-reg/main.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ package main
44

55
import (
66
"bytes"
7-
"context"
87
"flag"
9-
"fmt"
8+
"log"
109
"os"
1110
"path"
1211

1312
"gopkg.in/yaml.v2"
1413
corev1 "k8s.io/api/core/v1"
1514
yamlDecode "k8s.io/apimachinery/pkg/util/yaml"
16-
ctrl "sigs.k8s.io/controller-runtime"
1715
)
1816

1917
type HelmChartFromConfigMap struct {
@@ -31,8 +29,6 @@ type HelmChartsConfig struct {
3129
Repositories map[string]Repository `yaml:"repositories,omitempty"`
3230
}
3331

34-
var log = ctrl.LoggerFrom(context.Background())
35-
3632
func main() {
3733
args := os.Args
3834
var (
@@ -46,27 +42,32 @@ func main() {
4642
"input configmap file to create the mindthegap repo file from")
4743
err := flagSet.Parse(args[1:])
4844
if err != nil {
49-
log.Error(err, "failed to parse args")
45+
log.Fatalln("failed to parse args:", err)
46+
}
47+
if outputFile == "" {
48+
log.Fatalln("output file is required")
49+
}
50+
if inputConfigMapFile == "" {
51+
log.Fatalln("input configmap file is required")
5052
}
5153
fullPath := inputConfigMapFile
5254
if !path.IsAbs(fullPath) {
5355
wd, err := os.Getwd()
5456
if err != nil {
55-
log.Error(err, "failed to get wd")
56-
return
57+
log.Fatalln("failed to get wd:", err)
5758
}
5859
fullPath = path.Join(wd, inputConfigMapFile)
5960
}
6061
f, err := os.Open(fullPath)
6162
if err != nil {
62-
log.Error(err, "failed to open file")
63-
return
63+
log.Fatalln("failed to open file:", err)
6464
}
6565
defer f.Close()
6666
cm := &corev1.ConfigMap{}
6767
err = yamlDecode.NewYAMLOrJSONDecoder(f, 1024).Decode(cm)
6868
if err != nil {
69-
log.Error(err, fmt.Sprintf("failed to unmarshal file %s", fullPath))
69+
f.Close()
70+
log.Fatalf("failed to unmarshal file %s: %v\n", fullPath, err)
7071
}
7172
out := HelmChartsConfig{
7273
map[string]Repository{},
@@ -75,8 +76,7 @@ func main() {
7576
var settings HelmChartFromConfigMap
7677
err = yaml.Unmarshal([]byte(info), &settings)
7778
if err != nil {
78-
log.Error(err, "failed unmarshl settings")
79-
return
79+
log.Fatalln("failed to unmarshal settings:", err)
8080
}
8181
out.Repositories[settings.Name] = Repository{
8282
RepoURL: settings.Repository,
@@ -89,23 +89,23 @@ func main() {
8989
}
9090
b, err := yaml.Marshal(out)
9191
if err != nil {
92-
log.Error(err, fmt.Sprintf("failed to marshal obj %v", out))
92+
log.Fatalf("failed to marshal obj %+v: %v", out, err)
9393
}
9494
fullOutputfilePath := outputFile
9595
if !path.IsAbs(outputFile) {
9696
wd, err := os.Getwd()
9797
if err != nil {
98-
log.Error(err, "failed")
98+
log.Fatalln("failed:", err)
9999
}
100100
fullOutputfilePath = path.Join(wd, outputFile)
101101
}
102102
f, err = os.OpenFile(fullOutputfilePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o666)
103103
if err != nil {
104-
log.Error(err, "failed to create file")
104+
log.Fatalln("failed to create file:", err)
105105
}
106106
defer f.Close()
107107
_, err = bytes.NewBuffer(b).WriteTo(f)
108108
if err != nil {
109-
log.Error(err, "failed to write to file")
109+
log.Fatalln("failed to write to file:", err)
110110
}
111111
}

make/addons.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ generate-mindthegap-repofile: generate-helm-configmap ; $(info $(M) generating h
8383

8484
.PHONY: template-helm-repository
8585
template-helm-repository: generate-mindthegap-repofile ## this is used by gorealeaser to set the helm value to this.
86-
sed -i 's#\(RepositoryURL: *\)\(.*\)#\1"{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}\2{{ end }}"#' "./charts/cluster-api-runtime-extensions-nutanix/templates/helm-config.yaml"
86+
yq -i '.data |= (to_entries | map(.value |= (. | fromjson | .RepositoryURL |= "{{ if .Values.helmRepository.enabled }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}" + . + "{{ end }}" | to_yaml)) | from_entries)' ./charts/cluster-api-runtime-extensions-nutanix/templates/helm-config.yaml
8787

8888
.PHONY: list-images
8989
list-images:

0 commit comments

Comments
 (0)