Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set helm values (not files) in ArgoCD Application spec

I looked all over the ArgoCD docs for this but somehow I cannot seem to find an answer. I have an application spec like so:

apiVersion: argoproj.io/v1alpha1                                                                                                                                                                                                                                                          
kind: Application                                                                                                                                                                                                                                                                         
metadata:                                                                                                                                                                                                                                                                                 
  name: myapp                                                                                                                                                                                                                                                                            
  namespace: argocd                                                                                                                                                                                                                                                                       
spec:                                                                                                                                                                                                                                                                                     
  destination:                                                                                                                                                                                                                                                                            
    namespace: default                                                                                                                                                                                                                                                                    
    server: https://kubernetes.default.svc                                                                                                                                                                                                                                                
  project: default                                                                                                                                                                                                                                                                        
  source:                                                                                                                                                                                                                                                                                 
    helm:                                                                                                                                                                                                                                                                                 
      valueFiles:                                                                                                                                                                                                                                                                         
      - my-values.yaml                                                                                                                                                                                                                                                     
    path: .                                                                                                                                                                                                                                        
    repoURL: ssh://[email protected]                                                                                                                                                                                                                        
    targetRevision: HEAD

However, I also need to specify a particular helm value (like you'd do with --set in the helm command. I see in the ArgoCD web UI that it has a spot for Values, but I have tried every combination of entries I can think of (somekey=somevalue, somekey:somevalue, somekey,somevalue). I also tried editing the manifest directly, but I still get similar errors trying to do so. ArgoCD Web UI The error is long nonsense that ends with error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type map[string]interface {}

What is the correct syntax to set a single value, either through the web UI or the manifest file?

like image 244
tubensandwich Avatar asked Feb 06 '26 17:02

tubensandwich


1 Answers

To override just a few arbitrary parameters in the values you indeed can use parameters: as the equivalent of Helm's --set option or fileParameters: instead of --set-file:

...
    helm:
      # Extra parameters to set (same as setting through values.yaml, but these take precedence)
      parameters:
      - name: "nginx-ingress.controller.service.annotations.external-dns\\.alpha\\.kubernetes\\.io/hostname"
        value: mydomain.example.com
      - name: "ingress.annotations.kubernetes\\.io/tls-acme"
        value: "true"
        forceString: true # ensures that value is treated as a string

      # Use the contents of files as parameters (uses Helm's --set-file)
      fileParameters:
      - name: config
        path: files/config.json

But to answer your original question, for the "Values" option in the GUI you pass literal YAML block in the manifest, like:

    helm:
      # Helm values files for overriding values in the helm chart
      # The path is relative to the spec.source.path directory defined above
      valueFiles:
      - values-prod.yaml

      # Values file as block file
      values: |
        ingress:
          enabled: true
          path: /
          hosts:
            - mydomain.example.com
          annotations:
            kubernetes.io/ingress.class: nginx
            kubernetes.io/tls-acme: "true"
          labels: {}

Check ArgoCD sample application for more details.

like image 187
Timur Bakeyev Avatar answered Feb 09 '26 11:02

Timur Bakeyev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!