Skip to content

Commit c8ee816

Browse files
committed
fix: adds TLS for mindthegap
1 parent 97b28b2 commit c8ee816

File tree

13 files changed

+35
-21
lines changed

13 files changed

+35
-21
lines changed

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,36 @@ apiVersion: v1
99
data:
1010
cilium: |
1111
ChartName: cilium
12-
ChartVersion: 1.15.0
13-
RepositoryURL: {{ if .Values.selfHostedRegistry }}{{ .Values.selfHostedRegistryURI }}{{ else }}https://helm.cilium.io/{{ end }}
12+
ChartVersion: 1.15.5
13+
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://mindthegap.{{ .Release.Namespace }}.svc/charts{{ else }}https://helm.cilium.io/{{ end }}
1414
cluster-autoscaler: |
1515
ChartName: cluster-autoscaler
1616
ChartVersion: 9.37.0
17-
RepositoryURL: {{ if .Values.selfHostedRegistry }}{{ .Values.selfHostedRegistryURI }}{{ else }}https://kubernetes.github.io/autoscaler{{ end }}
17+
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://mindthegap.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes.github.io/autoscaler{{ end }}
1818
metallb: |
1919
ChartName: metallb
2020
ChartVersion: v0.14.5
21-
RepositoryURL: {{ if .Values.selfHostedRegistry }}{{ .Values.selfHostedRegistryURI }}{{ else }}https://metallb.github.io/metallb{{ end }}
21+
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://mindthegap.{{ .Release.Namespace }}.svc/charts{{ else }}https://metallb.github.io/metallb{{ end }}
2222
nfd: |
2323
ChartName: node-feature-discovery
2424
ChartVersion: 0.15.2
25-
RepositoryURL: {{ if .Values.selfHostedRegistry }}{{ .Values.selfHostedRegistryURI }}{{ else }}https://kubernetes-sigs.github.io/node-feature-discovery/charts{{ end }}
25+
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://mindthegap.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes-sigs.github.io/node-feature-discovery/charts{{ end }}
2626
nutanix-ccm: |
2727
ChartName: nutanix-cloud-provider
2828
ChartVersion: 0.3.3
29-
RepositoryURL: {{ if .Values.selfHostedRegistry }}{{ .Values.selfHostedRegistryURI }}{{ else }}https://nutanix.github.io/helm/{{ end }}
29+
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://mindthegap.{{ .Release.Namespace }}.svc/charts{{ else }}https://nutanix.github.io/helm/{{ end }}
3030
nutanix-snapshot-csi: |
3131
ChartName: nutanix-csi-snapshot
3232
ChartVersion: 6.3.2
33-
RepositoryURL: {{ if .Values.selfHostedRegistry }}{{ .Values.selfHostedRegistryURI }}{{ else }}https://nutanix.github.io/helm/{{ end }}
33+
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://mindthegap.{{ .Release.Namespace }}.svc/charts{{ else }}https://nutanix.github.io/helm/{{ end }}
3434
nutanix-storage-csi: |
3535
ChartName: nutanix-csi-storage
3636
ChartVersion: 3.0.0-beta.1912
37-
RepositoryURL: {{ if .Values.selfHostedRegistry }}{{ .Values.selfHostedRegistryURI }}{{ else }}https://nutanix.github.io/helm-releases/{{ end }}
37+
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://mindthegap.{{ .Release.Namespace }}.svc/charts{{ else }}https://nutanix.github.io/helm-releases/{{ end }}
3838
tigera-operator: |
3939
ChartName: tigera-operator
4040
ChartVersion: v3.28.0
41-
RepositoryURL: {{ if .Values.selfHostedRegistry }}{{ .Values.selfHostedRegistryURI }}{{ else }}https://docs.tigera.io/calico/charts{{ end }}
41+
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://mindthegap.{{ .Release.Namespace }}.svc/charts{{ else }}https://docs.tigera.io/calico/charts{{ end }}
4242
kind: ConfigMap
4343
metadata:
4444
creationTimestamp: null

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ hooks:
8484

8585
helmAddonsConfigMap: default-helm-addons-config
8686

87-
selfHostedRegistry: false
88-
selfHostedRegistryURI: oci://mindthegap.{{ .Release.Namespace }}.svc/charts
87+
selfHostedRegistry: true
8988

9089

9190
deployDefaultClusterClasses: true

hack/addons/mindthegap-helm-registry/repos.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repositories:
1010
repoURL: https://helm.cilium.io/
1111
charts:
1212
cilium:
13-
- 1.15.0
13+
- 1.15.5
1414
cluster-autoscaler:
1515
repoURL: https://kubernetes.github.io/autoscaler
1616
charts:
@@ -45,4 +45,4 @@ repositories:
4545
repoURL: https://docs.tigera.io/calico/charts
4646
charts:
4747
tigera-operator:
48-
- v3.26.4
48+
- v3.28.0

make/addons.mk

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

6666
.PHONY: template-mindthegap
6767
template-mindthegap: generate-mindthegap-repofile ## this is used by gorealeaser to set the helm value to this.
68-
sed -i '/RepositoryURL:/s#\(RepositoryURL: *\)\(.*\)#\1{{ if .Values.selfHostedRegistry }}{{ .Values.selfHostedRegistryURI }}{{ else }}\2{{ end }}#' "./charts/cluster-api-runtime-extensions-nutanix/templates/helm-config.yaml"
68+
sed -i '/RepositoryURL:/s#\(RepositoryURL: *\)\(.*\)#\1{{ if .Values.selfHostedRegistry }}oci://mindthegap.{{ .Release.Namespace }}.svc/charts{{ else }}\2{{ end }}#' "./charts/cluster-api-runtime-extensions-nutanix/templates/helm-config.yaml"

pkg/handlers/generic/lifecycle/ccm/nutanix/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func (p *provider) Apply(
149149
ValuesTemplate: values,
150150
},
151151
}
152-
152+
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
153153
if err = controllerutil.SetOwnerReference(cluster, hcp, p.client.Scheme()); err != nil {
154154
return fmt.Errorf(
155155
"failed to set owner reference on nutanix-ccm installation HelmChartProxy: %w",

pkg/handlers/generic/lifecycle/clusterautoscaler/strategy_helmaddon.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ func (s helmAddonStrategy) apply(
103103
},
104104
}
105105

106+
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
106107
if err = controllerutil.SetOwnerReference(&req.Cluster, hcp, s.client.Scheme()); err != nil {
107108
return fmt.Errorf(
108109
"failed to set owner reference on cluster-autoscaler installation HelmChartProxy: %w",

pkg/handlers/generic/lifecycle/cni/calico/strategy_helmaddon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (s helmAddonStrategy) apply(
102102
ValuesTemplate: values,
103103
},
104104
}
105-
105+
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
106106
if err := controllerutil.SetOwnerReference(&req.Cluster, hcp, s.client.Scheme()); err != nil {
107107
return fmt.Errorf(
108108
"failed to set owner reference on Calico CNI installation HelmChartProxy: %w",

pkg/handlers/generic/lifecycle/cni/cilium/strategy_helmaddon.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ func (s helmAddonStrategy) apply(
8787
},
8888
}
8989

90+
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
9091
if err := controllerutil.SetOwnerReference(&req.Cluster, hcp, s.client.Scheme()); err != nil {
9192
return fmt.Errorf(
9293
"failed to set owner reference on Cilium CNI installation HelmChartProxy: %w",

pkg/handlers/generic/lifecycle/csi/nutanix-csi/handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ func (n *NutanixCSI) handleHelmAddonApply(
183183
},
184184
}
185185

186+
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(storageChartProxy)
186187
snapshotChartProxy := &caaphv1.HelmChartProxy{
187188
TypeMeta: metav1.TypeMeta{
188189
APIVersion: caaphv1.GroupVersion.String(),
@@ -203,7 +204,7 @@ func (n *NutanixCSI) handleHelmAddonApply(
203204
Version: snapshotChart.Version,
204205
},
205206
}
206-
207+
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(snapshotChartProxy)
207208
// We use a slice of pointers to satisfy the gocritic linter rangeValCopy check.
208209
for _, cp := range []*caaphv1.HelmChartProxy{storageChartProxy, snapshotChartProxy} {
209210
if err = controllerutil.SetOwnerReference(&req.Cluster, cp, n.client.Scheme()); err != nil {

pkg/handlers/generic/lifecycle/nfd/strategy_helmaddon.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ image:
9393
},
9494
}
9595

96+
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
9697
if err := controllerutil.SetOwnerReference(&req.Cluster, hcp, s.client.Scheme()); err != nil {
9798
return fmt.Errorf(
9899
"failed to set owner reference on NFD installation HelmChartProxy: %w",

pkg/handlers/generic/lifecycle/serviceloadbalancer/metallb/handler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ func (n *MetalLB) Apply(
140140
},
141141
}
142142

143+
lifecycleutils.SetTLSConfigForHelmChartProxyIfNeeded(hcp)
143144
if err = controllerutil.SetOwnerReference(cluster, hcp, n.client.Scheme()); err != nil {
144145
return fmt.Errorf(
145146
"failed to set owner reference on MetalLB installation HelmChartProxy: %w",

pkg/handlers/generic/lifecycle/utils/utils.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package utils
66
import (
77
"context"
88
"fmt"
9+
"strings"
910

1011
corev1 "k8s.io/api/core/v1"
1112
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -17,6 +18,7 @@ import (
1718
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
1819
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
1920

21+
caaphv1 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/external/sigs.k8s.io/cluster-api-addon-provider-helm/api/v1alpha1"
2022
"github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/common/pkg/k8s/client"
2123
)
2224

@@ -219,3 +221,13 @@ func CreateConfigMapForCRS(configMapName, configMapNamespace string,
219221
cm.Data[defaultCRSConfigMapKey] = string(utilyaml.JoinYaml(l...))
220222
return cm, nil
221223
}
224+
225+
func SetTLSConfigForHelmChartProxyIfNeeded(hcp *caaphv1.HelmChartProxy) {
226+
if strings.Contains(hcp.Spec.RepoURL, "mindthegap") {
227+
hcp.Spec.TLSConfig = &caaphv1.TLSConfig{
228+
CASecretRef: &corev1.SecretReference{
229+
Name: "mindthegap-tls",
230+
},
231+
}
232+
}
233+
}

0 commit comments

Comments
 (0)