From f553558d7c7e23167137ca02a5ab1620c205ec7d Mon Sep 17 00:00:00 2001 From: Boris Komraz Date: Fri, 27 Oct 2023 23:41:08 +0300 Subject: [PATCH] render values by tpl function Signed-off-by: Boris Komraz --- charts/argo-cd/README.md | 33 ++++++++++++++++++++++++++++++++- charts/argo-cd/README.md.gotmpl | 33 +++++++++++++++++++++++++++++++++ charts/argo-cd/values.yaml | 20 ++++++++++++++++++-- 3 files changed, 83 insertions(+), 3 deletions(-) diff --git a/charts/argo-cd/README.md b/charts/argo-cd/README.md index b2101038..5cc64d51 100644 --- a/charts/argo-cd/README.md +++ b/charts/argo-cd/README.md @@ -734,7 +734,7 @@ NAME: my-release | server.ingressGrpc.awsALB.serviceType | string | `"NodePort"` | Service type for the AWS ALB gRPC service | | server.ingressGrpc.enabled | bool | `false` | Enable an ingress resource for the Argo CD server for dedicated [gRPC-ingress] | | server.ingressGrpc.extraPaths | list | `[]` | Additional ingress paths for dedicated [gRPC-ingress] | -| server.ingressGrpc.hosts | list | `[]` | List of ingress hosts for dedicated [gRPC-ingress] | +| server.ingressGrpc.hosts | list | `[]` | List of ingress hosts for dedicated [gRPC-ingress] Hosts value may [reference other values] | | server.ingressGrpc.https | bool | `false` | Uses `server.service.servicePortHttps` instead `server.service.servicePortHttp` | | server.ingressGrpc.ingressClassName | string | `""` | Defines which ingress controller will implement the resource [gRPC-ingress] | | server.ingressGrpc.isAWSALB | bool | `false` | Setup up gRPC ingress to work with an AWS ALB | @@ -1218,6 +1218,36 @@ If you want to use an existing Redis (eg. a managed service from a cloud provide | notifications.topologySpreadConstraints | list | `[]` (defaults to global.topologySpreadConstraints) | Assign custom [TopologySpreadConstraints] rules to the application controller | | notifications.triggers | object | `{}` | The trigger defines the condition when the notification should be sent | +## Values that reference other values +Some value may reference other values. +When to use it: For example in case of multiple environments you can use the same argocd values when environment specific +values are defined in separate environment file that is used by multiple helm charts +``` +# env1-values.yaml +global: + dnsDomain: .my.domain.com +``` + +``` +# env2-values.yaml +global: + dnsDomain: .my.other-domain.com +``` + +``` +# argocd's values.yaml +server: + ingress: + hosts: + - "argocd {{ .Values.global.dnsDomain }}" # be sure protect by quotation marks +``` + +``` +helm install my-release argo/argo-cd --context env1 -f env/global/configuration/env1-values.yaml +helm install my-release argo/argo-cd --context env2 -f env/global/configuration/env2-values.yaml + +``` + ---------------------------------------------- Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs) @@ -1245,3 +1275,4 @@ Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/ [tini]: https://github.com/argoproj/argo-cd/pull/12707 [EKS EoL]: https://endoflife.date/amazon-eks [Kubernetes Compatibility Matrix]: https://argo-cd.readthedocs.io/en/stable/operator-manual/installation/#supported-versions +[reference other values]: https://github.com/bkomraz1/argo-helm/blob/main/charts/argo-cd/README.md#reference-other-values diff --git a/charts/argo-cd/README.md.gotmpl b/charts/argo-cd/README.md.gotmpl index 5dc048b4..2400bd2d 100644 --- a/charts/argo-cd/README.md.gotmpl +++ b/charts/argo-cd/README.md.gotmpl @@ -535,6 +535,38 @@ If you want to use an existing Redis (eg. a managed service from a cloud provide {{- end }} {{- end }} + +## Values that reference other values +Some value may reference other values. +When to use it: For example in case of multiple environments you can use the same argocd values when environment specific +values are defined in separate environment file that is used by multiple helm charts +``` +# env1-values.yaml +global: + dnsDomain: .my.domain.com +``` + +``` +# env2-values.yaml +global: + dnsDomain: .my.other-domain.com +``` + +``` +# argocd's values.yaml +server: + ingress: + hosts: + - "argocd {{`{{ .Values.global.dnsDomain }}`}}" # be sure protect by quotation marks +``` + +``` +helm install my-release argo/argo-cd --context env1 -f env/global/configuration/env1-values.yaml +helm install my-release argo/argo-cd --context env2 -f env/global/configuration/env2-values.yaml + +``` + + ---------------------------------------------- Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs) @@ -562,3 +594,4 @@ Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/ [tini]: https://github.com/argoproj/argo-cd/pull/12707 [EKS EoL]: https://endoflife.date/amazon-eks [Kubernetes Compatibility Matrix]: https://argo-cd.readthedocs.io/en/stable/operator-manual/installation/#supported-versions +[reference other values]: https://github.com/bkomraz1/argo-helm/blob/main/charts/argo-cd/README.md#reference-other-values diff --git a/charts/argo-cd/values.yaml b/charts/argo-cd/values.yaml index 5d58cd31..4612795a 100644 --- a/charts/argo-cd/values.yaml +++ b/charts/argo-cd/values.yaml @@ -1909,7 +1909,22 @@ server: ## Argo Ingress. ## Hostnames must be provided if Ingress is enabled. ## Secrets must be manually created in the namespace - ## Hosts value may reference other values by {{ .Values.otherValue }} (be sure protect by quotation marks) + ## + ## Hosts value may reference other values. + ## For example in case of multiple environments you can use the same argocd values when environment specific + ## values are defined in separate environment file that is used by multiple helm charts + ## + ## # env-values.yaml + ## global: + ## dnsDomain: .my.domain.com + ## + ## # values.yaml + ## hosts: + ## - "argocd {{ .Values.global.dnsDomain }}" # be sure protect by quotation marks + ## + ## helm install my-release argo/argo-cd -f global/env/configuration/env1-values.yaml + ## + hosts: [] # - argocd.example.com @@ -1965,10 +1980,11 @@ server: backendProtocolVersion: HTTP2 # -- List of ingress hosts for dedicated [gRPC-ingress] + # Hosts value may [reference other values] ## Argo Ingress. ## Hostnames must be provided if Ingress is enabled. ## Secrets must be manually created in the namespace - ## Hosts value may reference other values by {{ .Values.otherValue }} (be sure protect by quotation marks) + ## hosts: [] # - argocd.example.com