From 29c41b286d4880894a4cac3c0c30e14fdcd12b21 Mon Sep 17 00:00:00 2001 From: sangdammad <86688098+sangdammad@users.noreply.github.com> Date: Tue, 23 Aug 2022 13:06:07 -0500 Subject: [PATCH] fix:fix the helm values reference and standardize chart folder (#14) fix:fix the helm values reference and standerdize chart folder Co-authored-by: Sangeetha Madamanchi --- .charts/overwhelm/values.yaml | 21 ------------------- .github/workflows/helm-chart-releaser.yaml | 2 +- Makefile | 6 +++--- {.charts => charts}/overwhelm/Chart.yaml | 2 +- ...pplications.core.expediagroup.com-crd.yaml | 0 ...erwhelm-controller-manager-deployment.yaml | 12 +++++------ ...ontroller-manager-metrics-service-svc.yaml | 0 .../overwhelm-controller-manager-sa.yaml | 0 .../overwhelm-leader-election-role-role.yaml | 0 ...rwhelm-leader-election-rolebinding-rb.yaml | 0 .../overwhelm-manager-config-cm.yaml | 0 .../templates/overwhelm-manager-role-cr.yaml | 0 .../overwhelm-manager-rolebinding-crb.yaml | 0 .../overwhelm-metrics-reader-cr.yaml | 0 .../templates/overwhelm-proxy-role-cr.yaml | 0 .../overwhelm-proxy-rolebinding-crb.yaml | 0 charts/overwhelm/values.yaml | 20 ++++++++++++++++++ config/helm-manifest/kustomization.yaml | 8 ++++++- .../manager_deployment_patch.yaml | 10 ++++----- scripts/helm-charts/update.go | 4 ++-- 20 files changed, 45 insertions(+), 40 deletions(-) delete mode 100644 .charts/overwhelm/values.yaml rename {.charts => charts}/overwhelm/Chart.yaml (89%) rename {.charts => charts}/overwhelm/templates/applications.core.expediagroup.com-crd.yaml (100%) rename {.charts => charts}/overwhelm/templates/overwhelm-controller-manager-deployment.yaml (74%) rename {.charts => charts}/overwhelm/templates/overwhelm-controller-manager-metrics-service-svc.yaml (100%) rename {.charts => charts}/overwhelm/templates/overwhelm-controller-manager-sa.yaml (100%) rename {.charts => charts}/overwhelm/templates/overwhelm-leader-election-role-role.yaml (100%) rename {.charts => charts}/overwhelm/templates/overwhelm-leader-election-rolebinding-rb.yaml (100%) rename {.charts => charts}/overwhelm/templates/overwhelm-manager-config-cm.yaml (100%) rename {.charts => charts}/overwhelm/templates/overwhelm-manager-role-cr.yaml (100%) rename {.charts => charts}/overwhelm/templates/overwhelm-manager-rolebinding-crb.yaml (100%) rename {.charts => charts}/overwhelm/templates/overwhelm-metrics-reader-cr.yaml (100%) rename {.charts => charts}/overwhelm/templates/overwhelm-proxy-role-cr.yaml (100%) rename {.charts => charts}/overwhelm/templates/overwhelm-proxy-rolebinding-crb.yaml (100%) create mode 100644 charts/overwhelm/values.yaml diff --git a/.charts/overwhelm/values.yaml b/.charts/overwhelm/values.yaml deleted file mode 100644 index 9532929..0000000 --- a/.charts/overwhelm/values.yaml +++ /dev/null @@ -1,21 +0,0 @@ ---- -overwhelm: - deployment: - image: - manager: - repository: ghcr.io/expediagroup/overwhelm - tag: latest - kubeRbacProxy: - repository: gcr.io/kubebuilder/kube-rbac-proxy - tag: v0.8.0 - labels: - control-plane: controller-manager - replicas: 2 - resources: - limits: - cpu: 1024m - memory: 1Gi - requests: - cpu: 128m - memory: 64Mi - diff --git a/.github/workflows/helm-chart-releaser.yaml b/.github/workflows/helm-chart-releaser.yaml index cfca83a..2eb1fc9 100644 --- a/.github/workflows/helm-chart-releaser.yaml +++ b/.github/workflows/helm-chart-releaser.yaml @@ -27,6 +27,6 @@ jobs: - name: Run chart-releaser uses: helm/chart-releaser-action@v1.1.0 with: - charts_dir: .charts + charts_dir: charts env: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/Makefile b/Makefile index 8868b51..55ca73a 100644 --- a/Makefile +++ b/Makefile @@ -144,10 +144,10 @@ install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~ .PHONY: helmManifests helmManifests: manifests kustomize kubernetes-split-yaml ## Create Helm Templates to deploy manifests using Helm - $(KUSTOMIZE) build config/helm-manifest >> .charts/tmp.yaml + $(KUSTOMIZE) build config/helm-manifest >> charts/tmp.yaml go run scripts/helm-charts/update.go - $(KUBERNETES_SPLIT_YAML) --outdir .charts/overwhelm/templates .charts/tmp.yaml - rm .charts/tmp.yaml + $(KUBERNETES_SPLIT_YAML) --outdir charts/overwhelm/templates charts/tmp.yaml + rm charts/tmp.yaml .PHONY: helmInstall helmInstall: diff --git a/.charts/overwhelm/Chart.yaml b/charts/overwhelm/Chart.yaml similarity index 89% rename from .charts/overwhelm/Chart.yaml rename to charts/overwhelm/Chart.yaml index 5ffa02a..c6e77af 100644 --- a/.charts/overwhelm/Chart.yaml +++ b/charts/overwhelm/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: overwhelm -version: 1.0.0 +version: 1.0.1 maintainers: - name: "Expedia Group" url: "https://github.com/ExpediaGroup/overwhelm" \ No newline at end of file diff --git a/.charts/overwhelm/templates/applications.core.expediagroup.com-crd.yaml b/charts/overwhelm/templates/applications.core.expediagroup.com-crd.yaml similarity index 100% rename from .charts/overwhelm/templates/applications.core.expediagroup.com-crd.yaml rename to charts/overwhelm/templates/applications.core.expediagroup.com-crd.yaml diff --git a/.charts/overwhelm/templates/overwhelm-controller-manager-deployment.yaml b/charts/overwhelm/templates/overwhelm-controller-manager-deployment.yaml similarity index 74% rename from .charts/overwhelm/templates/overwhelm-controller-manager-deployment.yaml rename to charts/overwhelm/templates/overwhelm-controller-manager-deployment.yaml index a4533d7..ea09be8 100755 --- a/.charts/overwhelm/templates/overwhelm-controller-manager-deployment.yaml +++ b/charts/overwhelm/templates/overwhelm-controller-manager-deployment.yaml @@ -6,16 +6,16 @@ metadata: name: overwhelm-controller-manager namespace: overwhelm-system spec: - replicas: {{ .Values.overwhelm.deployment.replicas }} + replicas: {{ .Values.deployment.replicas }} selector: matchLabels: control-plane: controller-manager template: metadata: annotations: -{{ toYaml .Values.overwhelm.deployment.annotations | indent 8 }} +{{ toYaml .Values.deployment.annotations | indent 8 }} labels: -{{ toYaml .Values.overwhelm.deployment.labels | indent 8 }} +{{ toYaml .Values.deployment.labels | indent 8 }} spec: containers: - args: @@ -24,7 +24,7 @@ spec: - --leader-elect command: - /manager - image: {{ .Values.overwhelm.deployment.image.manager.repository }}:{{ .Values.overwhelm.deployment.image.manager.tag }} + image: {{ .Values.deployment.image.manager.repository }}:{{ .Values.deployment.image.manager.tag }} livenessProbe: httpGet: path: /healthz @@ -39,7 +39,7 @@ spec: initialDelaySeconds: 5 periodSeconds: 10 resources: -{{ toYaml .Values.overwhelm.deployment.resources | indent 10 }} +{{ toYaml .Values.deployment.resources | indent 10 }} securityContext: allowPrivilegeEscalation: false - args: @@ -47,7 +47,7 @@ spec: - --upstream=http://127.0.0.1:8080/ - --logtostderr=true - --v=0 - image: {{ .Values.overwhelm.deployment.image.kubeRbacProxy.repository }}:{{ .Values.overwhelm.deployment.image.kubeRbacProxy.tag }} + image: {{ .Values.deployment.image.kubeRbacProxy.repository }}:{{ .Values.deployment.image.kubeRbacProxy.tag }} name: kube-rbac-proxy ports: - containerPort: 8443 diff --git a/.charts/overwhelm/templates/overwhelm-controller-manager-metrics-service-svc.yaml b/charts/overwhelm/templates/overwhelm-controller-manager-metrics-service-svc.yaml similarity index 100% rename from .charts/overwhelm/templates/overwhelm-controller-manager-metrics-service-svc.yaml rename to charts/overwhelm/templates/overwhelm-controller-manager-metrics-service-svc.yaml diff --git a/.charts/overwhelm/templates/overwhelm-controller-manager-sa.yaml b/charts/overwhelm/templates/overwhelm-controller-manager-sa.yaml similarity index 100% rename from .charts/overwhelm/templates/overwhelm-controller-manager-sa.yaml rename to charts/overwhelm/templates/overwhelm-controller-manager-sa.yaml diff --git a/.charts/overwhelm/templates/overwhelm-leader-election-role-role.yaml b/charts/overwhelm/templates/overwhelm-leader-election-role-role.yaml similarity index 100% rename from .charts/overwhelm/templates/overwhelm-leader-election-role-role.yaml rename to charts/overwhelm/templates/overwhelm-leader-election-role-role.yaml diff --git a/.charts/overwhelm/templates/overwhelm-leader-election-rolebinding-rb.yaml b/charts/overwhelm/templates/overwhelm-leader-election-rolebinding-rb.yaml similarity index 100% rename from .charts/overwhelm/templates/overwhelm-leader-election-rolebinding-rb.yaml rename to charts/overwhelm/templates/overwhelm-leader-election-rolebinding-rb.yaml diff --git a/.charts/overwhelm/templates/overwhelm-manager-config-cm.yaml b/charts/overwhelm/templates/overwhelm-manager-config-cm.yaml similarity index 100% rename from .charts/overwhelm/templates/overwhelm-manager-config-cm.yaml rename to charts/overwhelm/templates/overwhelm-manager-config-cm.yaml diff --git a/.charts/overwhelm/templates/overwhelm-manager-role-cr.yaml b/charts/overwhelm/templates/overwhelm-manager-role-cr.yaml similarity index 100% rename from .charts/overwhelm/templates/overwhelm-manager-role-cr.yaml rename to charts/overwhelm/templates/overwhelm-manager-role-cr.yaml diff --git a/.charts/overwhelm/templates/overwhelm-manager-rolebinding-crb.yaml b/charts/overwhelm/templates/overwhelm-manager-rolebinding-crb.yaml similarity index 100% rename from .charts/overwhelm/templates/overwhelm-manager-rolebinding-crb.yaml rename to charts/overwhelm/templates/overwhelm-manager-rolebinding-crb.yaml diff --git a/.charts/overwhelm/templates/overwhelm-metrics-reader-cr.yaml b/charts/overwhelm/templates/overwhelm-metrics-reader-cr.yaml similarity index 100% rename from .charts/overwhelm/templates/overwhelm-metrics-reader-cr.yaml rename to charts/overwhelm/templates/overwhelm-metrics-reader-cr.yaml diff --git a/.charts/overwhelm/templates/overwhelm-proxy-role-cr.yaml b/charts/overwhelm/templates/overwhelm-proxy-role-cr.yaml similarity index 100% rename from .charts/overwhelm/templates/overwhelm-proxy-role-cr.yaml rename to charts/overwhelm/templates/overwhelm-proxy-role-cr.yaml diff --git a/.charts/overwhelm/templates/overwhelm-proxy-rolebinding-crb.yaml b/charts/overwhelm/templates/overwhelm-proxy-rolebinding-crb.yaml similarity index 100% rename from .charts/overwhelm/templates/overwhelm-proxy-rolebinding-crb.yaml rename to charts/overwhelm/templates/overwhelm-proxy-rolebinding-crb.yaml diff --git a/charts/overwhelm/values.yaml b/charts/overwhelm/values.yaml new file mode 100644 index 0000000..f306847 --- /dev/null +++ b/charts/overwhelm/values.yaml @@ -0,0 +1,20 @@ +--- +deployment: + image: + manager: + repository: ghcr.io/expediagroup/overwhelm + tag: latest + kubeRbacProxy: + repository: gcr.io/kubebuilder/kube-rbac-proxy + tag: v0.8.0 + labels: + control-plane: controller-manager + replicas: 2 + resources: + limits: + cpu: 1024m + memory: 1Gi + requests: + cpu: 128m + memory: 64Mi + diff --git a/config/helm-manifest/kustomization.yaml b/config/helm-manifest/kustomization.yaml index 454390e..da20a11 100644 --- a/config/helm-manifest/kustomization.yaml +++ b/config/helm-manifest/kustomization.yaml @@ -3,6 +3,12 @@ bases: patchesStrategicMerge: - manager_deployment_patch.yaml + - |- + apiVersion: v1 + kind: Namespace + metadata: + name: overwhelm-system + $patch: delete patchesJson6902: # We use Json6902 patches for inline replacement patches which are not possible with Strategic Merge patches - target: @@ -13,4 +19,4 @@ patchesJson6902: # We use Json6902 patches for inline replacement patches which patch: |- - op: replace path: /spec/template/spec/containers/0/resources - value: toYaml .Values.overwhelm.deployment.resources | indent 10 + value: toYaml .Values.deployment.resources | indent 10 diff --git a/config/helm-manifest/manager_deployment_patch.yaml b/config/helm-manifest/manager_deployment_patch.yaml index 01f27b7..811f2b2 100644 --- a/config/helm-manifest/manager_deployment_patch.yaml +++ b/config/helm-manifest/manager_deployment_patch.yaml @@ -5,15 +5,15 @@ metadata: name: overwhelm-controller-manager namespace: overwhelm-system spec: - replicas: .Values.overwhelm.deployment.replicas + replicas: .Values.deployment.replicas template: metadata: $patch: replace - annotations: toYaml .Values.overwhelm.deployment.annotations | indent 8 - labels: toYaml .Values.overwhelm.deployment.labels | indent 8 + annotations: toYaml .Values.deployment.annotations | indent 8 + labels: toYaml .Values.deployment.labels | indent 8 spec: containers: - name: manager - image: .Values.overwhelm.deployment.image.manager.repository : .Values.overwhelm.deployment.image.manager.tag + image: .Values.deployment.image.manager.repository : .Values.deployment.image.manager.tag - name: kube-rbac-proxy - image: .Values.overwhelm.deployment.image.kubeRbacProxy.repository : .Values.overwhelm.deployment.image.kubeRbacProxy.tag \ No newline at end of file + image: .Values.deployment.image.kubeRbacProxy.repository : .Values.deployment.image.kubeRbacProxy.tag \ No newline at end of file diff --git a/scripts/helm-charts/update.go b/scripts/helm-charts/update.go index c961917..c85921e 100644 --- a/scripts/helm-charts/update.go +++ b/scripts/helm-charts/update.go @@ -6,7 +6,7 @@ import ( ) func main() { - d, err := os.ReadFile(".charts/tmp.yaml") + d, err := os.ReadFile("charts/tmp.yaml") if err != nil { panic(err) } @@ -15,7 +15,7 @@ func main() { data = strings.ReplaceAll(data, "", "{{") data = strings.ReplaceAll(data, "", "}}") data = strings.ReplaceAll(data, "{{ toYaml", "\n{{ toYaml") - if err = os.WriteFile(".charts/tmp.yaml", []byte(data), 0644); err != nil { + if err = os.WriteFile("charts/tmp.yaml", []byte(data), 0644); err != nil { panic(err) } }