0

I'm looking to install the nginx ingress from argocd. In argocd application referring nginx-ingress` public helm chart as source with 2 custom values files. 1 with common values across envs and 2nd with specific. for ex: 1. common-values.yaml

controller:
    ingressClass: nginx-internal
    service:
        internal:
            loadBalancerIP: {{ .Values.public_ip }}
  1. dev-specific.yaml file
public_ip: "1.2.3.4" 

finally I want it looking like this one

controller:
   ingressClass: nginx-internal
   service:
       internal:
           loadBalancerIP: 1.2.3.4

I don't want to keep the same yaml reference in both the values.yaml files which is also possible, because I am going to output specific values from my terraform as json. for example test.json

{
    "internal_ip": "1.2.3.4"
}

Another possible way is to keep one values yaml file in helm template folder and pass values.yaml file and generate a new yaml file with all rendered values, but in my case I cannot play around with ingress helm chart template files, looking for a alternative from values files itself.

I tried creating variables like $public_ip in values.yaml and try pass values from another values and helm chart is not rendering from values.yaml file

rock'n rolla
  • 1,883
  • 1
  • 13
  • 19

1 Answers1

0

With normal helm command, you simply nest several values files and the latest will have the precedence, i.e. if your base values.yaml file has content:

controller:
    ingressClass: nginx-internal
    service:
        internal:
            loadBalancerIP: placeholder_ip

and your specific-values.yaml file has content:

controller:
    service:
        internal:
            loadBalancerIP: 1.2.3.4

And you reference only the specific-values.yaml (base gets used by default as a first entry even if you don't reference it), the result would be:

controller:
    ingressClass: nginx-internal
    service:
        internal:
            loadBalancerIP: 1.2.3.4

Which is I believe what you are looking for.

Finally, if for any reason you need to visualize merged result before passing to helm command, you can use helmvalues functionality of Reliza CLI - https://github.com/relizaio/reliza-cli#18-use-case-override-and-get-merged-helm-chart-values

taleodor
  • 1,849
  • 1
  • 13
  • 15
  • Actually i am trying to avoid the yaml structure in both the yaml files, i am trying to automate the values.yaml for different clusters. i am trying to create few varibales and values of those variables i want to bring in with terraform output. for ex: when i create public ip from terraform code, and going to output that values in json file and going to use that file from my helmcharts. – jitender singh Apr 18 '23 at 13:18
  • "i am trying to avoid the yaml structure in both the yaml files" - this is a bit lol ;) My point is that you should be able construct the 2nd file as a temporary one to override whatever you need to override in the one that is checked in. Maybe I'm not fully following your use case - but possibly you're looking for something more advanced - like this, but you need a 3rd party tool to handle that - https://github.com/relizaio/reliza-cli#72-use-case-replace-tags-on-deployment-templates-to-inject-correct-artifacts-for-gitops-using-instance-and-revision – taleodor Apr 18 '23 at 14:08
  • I want to automate the values that are going to changes as per the env. and those values i will be getting as terraform code output, for example: i do create a public ip with terraform > output the public ip in json format> json is a valid yaml and this values would be like public_ip: 1.2.3.4 and in order to make a fit with helm i have to keep yaml format where we add layers. so that i dont want & looking for a alternate way. – jitender singh Apr 18 '23 at 21:22