Skip to content

Commit

Permalink
fixup! refactor: Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmidyson committed Nov 5, 2024
1 parent d5245bd commit e738700
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 88 deletions.
8 changes: 4 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ dockers:
- image_templates:
- 'ghcr.io/nutanix-cloud-native/caren-helm-reg:v{{ trimprefix .Version "v" }}-amd64'
use: buildx
dockerfile: ./hack/addons/mindthegap-helm-registry/Dockerfile
dockerfile: ./hack/addons/helm-chart-bundler/Dockerfile
extra_files:
- hack/addons/mindthegap-helm-registry/repos.yaml
- hack/addons/helm-chart-bundler/repos.yaml
build_flag_templates:
- "--platform=linux/amd64"
- "--pull"
Expand All @@ -119,9 +119,9 @@ dockers:
- image_templates:
- 'ghcr.io/nutanix-cloud-native/caren-helm-reg:v{{ trimprefix .Version "v" }}-arm64'
use: buildx
dockerfile: ./hack/addons/mindthegap-helm-registry/Dockerfile
dockerfile: ./hack/addons/helm-chart-bundler/Dockerfile
extra_files:
- hack/addons/mindthegap-helm-registry/repos.yaml
- hack/addons/helm-chart-bundler/repos.yaml
build_flag_templates:
- "--platform=linux/arm64"
- "--pull"
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ repos:
name: addons-repo-yaml
entry: make template-helm-repository
language: system
files: "hack/addons/mindthegap-helm-registry/repos.yaml"
files: "hack/addons/helm-chart-bundler/repos.yaml"
pass_filenames: false
- id: check-devbox-lock
name: check-devbox-lock
Expand Down
5 changes: 3 additions & 2 deletions charts/cluster-api-runtime-extensions-nutanix/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ A Helm chart for cluster-api-runtime-extensions-nutanix
| helmRepository.images.mindthegap.pullPolicy | string | `"IfNotPresent"` | |
| helmRepository.images.mindthegap.repository | string | `"ghcr.io/mesosphere/mindthegap"` | |
| helmRepository.images.mindthegap.tag | string | `"v1.16.0"` | |
| helmRepository.securityContext.fsGroup | int | `65534` | |
| helmRepository.securityContext.runAsUser | int | `65534` | |
| helmRepository.securityContext.fsGroup | int | `65532` | |
| helmRepository.securityContext.runAsGroup | int | `65532` | |
| helmRepository.securityContext.runAsUser | int | `65532` | |
| hooks.ccm.aws.helmAddonStrategy.defaultValueTemplateConfigMap.create | bool | `true` | |
| hooks.ccm.aws.helmAddonStrategy.defaultValueTemplateConfigMap.name | string | `"default-aws-ccm-helm-values-template"` | |
| hooks.ccm.aws.k8sMinorVersionToCCMVersion."1.27" | string | `"v1.27.9"` | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,47 @@ data:
aws-ccm: |
ChartName: aws-cloud-controller-manager
ChartVersion: 0.0.8
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes.github.io/cloud-provider-aws{{ end }}
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes.github.io/cloud-provider-aws{{ end }}"
aws-ebs-csi: |
ChartName: aws-ebs-csi-driver
ChartVersion: 2.35.1
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes-sigs.github.io/aws-ebs-csi-driver{{ end }}
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes-sigs.github.io/aws-ebs-csi-driver{{ end }}"
cilium: |
ChartName: cilium
ChartVersion: 1.16.2
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://helm.cilium.io/{{ end }}
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://helm.cilium.io/{{ end }}"
cluster-autoscaler: |
ChartName: cluster-autoscaler
ChartVersion: 9.40.0
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes.github.io/autoscaler{{ end }}
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes.github.io/autoscaler{{ end }}"
local-path-provisioner-csi: |
ChartName: local-path-provisioner
ChartVersion: 0.0.29
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://charts.containeroo.ch{{ end }}
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://charts.containeroo.ch{{ end }}"
metallb: |
ChartName: metallb
ChartVersion: 0.14.8
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://metallb.github.io/metallb{{ end }}
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://metallb.github.io/metallb{{ end }}"
nfd: |
ChartName: node-feature-discovery
ChartVersion: 0.16.4
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes-sigs.github.io/node-feature-discovery/charts{{ end }}
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://kubernetes-sigs.github.io/node-feature-discovery/charts{{ end }}"
nutanix-ccm: |
ChartName: nutanix-cloud-provider
ChartVersion: 0.4.1
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://nutanix.github.io/helm/{{ end }}
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://nutanix.github.io/helm/{{ end }}"
nutanix-storage-csi: |
ChartName: nutanix-csi-storage
ChartVersion: 3.1.0
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://nutanix.github.io/helm-releases/{{ end }}
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://nutanix.github.io/helm-releases/{{ end }}"
snapshot-controller: |
ChartName: snapshot-controller
ChartVersion: 3.0.6
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://piraeus.io/helm-charts/{{ end }}
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://piraeus.io/helm-charts/{{ end }}"
tigera-operator: |
ChartName: tigera-operator
ChartVersion: v3.28.2
RepositoryURL: {{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://docs.tigera.io/calico/charts{{ end }}
RepositoryURL: "{{ if .Values.selfHostedRegistry }}oci://helm-repository.{{ .Release.Namespace }}.svc/charts{{ else }}https://docs.tigera.io/calico/charts{{ end }}"
kind: ConfigMap
metadata:
creationTimestamp: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
"fsGroup": {
"type": "integer"
},
"runAsGroup": {
"type": "integer"
},
"runAsUser": {
"type": "integer"
}
Expand Down
5 changes: 3 additions & 2 deletions charts/cluster-api-runtime-extensions-nutanix/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ helmRepository:
tag: "v1.16.0"
pullPolicy: IfNotPresent
securityContext:
runAsUser: 65534
fsGroup: 65534
runAsUser: 65532
runAsGroup: 65532
fsGroup: 65532

# -- Optional secrets used for pulling the container image
imagePullSecrets: []
Expand Down
2 changes: 2 additions & 0 deletions hack/addons/add-warning-helm-configmap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ readonly SCRIPT_DIR
# shellcheck source=hack/common.sh
source "${SCRIPT_DIR}/../common.sh"
ASSETS_DIR="$(mktemp -d -p "${TMPDIR:-/tmp}")"
trap 'rm -rf "${ASSETS_DIR}"' EXIT

mv "${GIT_REPO_ROOT}/charts/cluster-api-runtime-extensions-nutanix/templates/helm-config.yaml" "${ASSETS_DIR}/helm-config.yaml"
# add warning not to edit file directly
cat <<EOF >"${GIT_REPO_ROOT}/charts/cluster-api-runtime-extensions-nutanix/templates/helm-config.yaml"
Expand Down
5 changes: 2 additions & 3 deletions hack/addons/generate-mindthegap-repofile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ readonly SCRIPT_DIR
source "${SCRIPT_DIR}/../common.sh"

ASSETS_DIR="$(mktemp -d -p "${TMPDIR:-/tmp}")"
trap 'rm -rf "${ASSETS_DIR}"' EXIT

cp "${GIT_REPO_ROOT}/charts/cluster-api-runtime-extensions-nutanix/templates/helm-config.yaml" "${ASSETS_DIR}"

# this sed line is needed because the go library is unable to parse yaml with a template string.
sed -i s/"{{ .Values.helmAddonsConfigMap }}"/placeholder/g "${ASSETS_DIR}/helm-config.yaml"
go run "${GIT_REPO_ROOT}/hack/tools/mindthegap-helm-reg/main.go" --input-configmap-file="${ASSETS_DIR}/helm-config.yaml" --output-file="${ASSETS_DIR}/repos.yaml"

# add warning not to edit file directly
cat <<EOF >"${GIT_REPO_ROOT}/hack/addons/mindthegap-helm-registry/repos.yaml"
cat <<EOF >"${GIT_REPO_ROOT}/hack/addons/helm-chart-bundler/repos.yaml"
$(cat "${GIT_REPO_ROOT}/hack/license-header.yaml.txt")
#=================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG MINDTHEGAP_VERSION=v1.16.0

FROM --platform=${BUILDPLATFORM} ghcr.io/mesosphere/mindthegap:${MINDTHEGAP_VERSION} as bundle_builder
# This gets called by goreleaser so the copy source has to be the path relative to the repo root.
RUN --mount=source=./hack/addons/mindthegap-helm-registry/repos.yaml,target=/repos.yaml \
RUN --mount=source=./hack/addons/helm-chart-bundler/repos.yaml,target=/repos.yaml \
["/ko-app/mindthegap", "create", "bundle", "--helm-charts-file=/repos.yaml", "--output-file=/tmp/helm-charts.tar"]

FROM --platform=${TARGETPLATFORM} busybox:1.37.0-musl as static-busybox
Expand Down
8 changes: 8 additions & 0 deletions hack/addons/helm-chart-bundler/repos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2024 Nutanix. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

#=================================================================
# DO NOT EDIT THIS FILE
# IT HAS BEEN GENERATED BY /hack/addons/generate-mindthegap-repofile.sh
#=================================================================
{}
63 changes: 0 additions & 63 deletions hack/addons/mindthegap-helm-registry/repos.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion make/addons.mk
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ generate-mindthegap-repofile: generate-helm-configmap ; $(info $(M) generating h

.PHONY: template-helm-repository
template-helm-repository: generate-mindthegap-repofile ## this is used by gorealeaser to set the helm value to this.
sed -i '/RepositoryURL:/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"
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"

.PHONY: list-images
list-images:
Expand Down

0 comments on commit e738700

Please sign in to comment.