Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helmfile template --args swallows args #454

Closed
joshuasimon-taulia opened this issue Oct 20, 2022 · 4 comments · Fixed by #457
Closed

helmfile template --args swallows args #454

joshuasimon-taulia opened this issue Oct 20, 2022 · 4 comments · Fixed by #457
Labels
enhancement New feature or request
Milestone

Comments

@joshuasimon-taulia
Copy link

joshuasimon-taulia commented Oct 20, 2022

Operating system

OSX 10.14.6 (18G9323), Ubuntu 22.04.1 LTS

Helmfile Version

0.147.0, 0.144.7

Helm Version

v3.9.0

Bug description

helmfile template seems to be excluding additional --api-versions flags from args

helmfile template --args "--api-versions=networking.k8s.io/v1 --api-versions=networking.k8s.io/v1/Ingress" | grep -i extensions/v1beta1
Adding repo runatlantis https://runatlantis.github.io/helm-charts
"runatlantis" has been added to your repositories

Templating release=atlantis, chart=runatlantis/atlantis
exec: helm template atlantis runatlantis/atlantis --version 4.1.2 --namespace atlantis --values /var/folders/bp/4mgw9f094872yc6v7gyzqqt1frkjzj/T/helmfile311979473/atlantis-atlantis-values-6d77d594d8 --values /var/folders/bp/4mgw9f094872yc6v7gyzqqt1frkjzj/T/helmfile3484799294/atlantis-atlantis-values-6db6b56d9d --api-versions=networking.k8s.io/v1

apiVersion: extensions/v1beta1

in the first example, --api-versions=networking.k8s.io/v1/Ingress is not correctly passed to helmfile template resulting in the wrong api version rendered on the ingress object apiVersion: extensions/v1beta1

helmfile template --args "--api-versions=networking.k8s.io/v1/Ingress --api-versions=networking.k8s.io/v1" | grep -i extensions/v1beta1
Adding repo runatlantis https://runatlantis.github.io/helm-charts
"runatlantis" has been added to your repositories

Templating release=atlantis, chart=runatlantis/atlantis
exec: helm template atlantis runatlantis/atlantis --version 4.1.2 --namespace atlantis --values /var/folders/bp/4mgw9f094872yc6v7gyzqqt1frkjzj/T/helmfile1042919175/atlantis-atlantis-values-6d77d594d8 --values /var/folders/bp/4mgw9f094872yc6v7gyzqqt1frkjzj/T/helmfile1300626385/atlantis-atlantis-values-6db6b56d9d --api-versions=networking.k8s.io/v1/Ingress

possibly related to #450, spf13/cobra#1781, and travisghansen/argo-cd-helmfile#23

Example helmfile.yaml

filepath: ""
environments:
  default:
    values:
    - jx-values.yaml
namespace: atlantis
repositories:
- name: runatlantis
  url: https://runatlantis.github.io/helm-charts
releases:
- chart: runatlantis/atlantis
  version: 4.1.2
  name: atlantis
  values:
  - jx-values.yaml
  - atlantis-values.yaml.gotmpl
templates: {}
renderedvalues: {}

Error message you've seen (if any)

errors occur when trying to apply the above ingress to a k8s 1.22+ cluster

Steps to reproduce

above

Working Helmfile Version

same thing happens on v0.138.7

Relevant discussion

No response

@yxxhero
Copy link
Member

yxxhero commented Oct 21, 2022

@joshuasimon-taulia please show the debug output by adding --debug.

@joshuasimon-taulia
Copy link
Author

joshuasimon-taulia commented Oct 21, 2022

the relevant debug output is in the issue body:

exec: helm template atlantis runatlantis/atlantis --version 4.1.2 --namespace atlantis --values /var/folders/bp/4mgw9f094872yc6v7gyzqqt1frkjzj/T/helmfile311979473/atlantis-atlantis-values-6d77d594d8 --values /var/folders/bp/4mgw9f094872yc6v7gyzqqt1frkjzj/T/helmfile3484799294/atlantis-atlantis-values-6db6b56d9d --api-versions=networking.k8s.io/v1

exec: helm template atlantis runatlantis/atlantis --version 4.1.2 --namespace atlantis --values /var/folders/bp/4mgw9f094872yc6v7gyzqqt1frkjzj/T/helmfile1042919175/atlantis-atlantis-values-6d77d594d8 --values /var/folders/bp/4mgw9f094872yc6v7gyzqqt1frkjzj/T/helmfile1300626385/atlantis-atlantis-values-6db6b56d9d --api-versions=networking.k8s.io/v1/Ingress

here's the rest

helmfile template --args "--api-versions=networking.k8s.io/v1 --api-versions=networking.k8s.io/v1/Ingress"

8s.io/v1"
processing file "helmfile.yaml" in directory "."
changing working directory to "/Users/me/Github/gitops-atlantis/helmfiles/atlantis"
first-pass rendering starting for "helmfile.yaml.part.0": inherited=&{default map[] map[]}, overrode=<nil>
first-pass uses: &{default map[] map[]}
first-pass rendering output of "helmfile.yaml.part.0":
 0: bases:
 1: - ../api-versions.yaml.gotmpl
 2:
 3: filepath: ""
 4: environments:
 5:   default:
 6:     values:
 7:     - jx-values.yaml
 8: namespace: atlantis
 9: repositories:
10: - name: runatlantis
11:   url: https://runatlantis.github.io/helm-charts
12: releases:
13: - chart: runatlantis/atlantis
14:   version: 4.1.2
15:   name: atlantis
16:   values:
17:   - jx-values.yaml
18:   - atlantis-values.yaml.gotmpl
19: templates: {}
20: renderedvalues: {}
21:

error in first-pass rendering: result of "helmfile.yaml.part.0":
 0: bases:
 1: - ../api-versions.yaml.gotmpl
 2:
 3: filepath: ""
 4: environments:
 5:   default:
 6:     values:
 7:     - jx-values.yaml
 8: namespace: atlantis
 9: repositories:
10: - name: runatlantis
11:   url: https://runatlantis.github.io/helm-charts
12: releases:
13: - chart: runatlantis/atlantis
14:   version: 4.1.2
15:   name: atlantis
16:   values:
17:   - jx-values.yaml
18:   - atlantis-values.yaml.gotmpl
19: templates: {}
20: renderedvalues: {}
21:

first-pass produced: &{default map[] map[]}
first-pass rendering result of "helmfile.yaml.part.0": {default map[] map[]}
second-pass rendering result of "helmfile.yaml.part.0":
 0: bases:
 1: - ../api-versions.yaml.gotmpl
 2:
 3: filepath: ""
 4: environments:
 5:   default:
 6:     values:
 7:     - jx-values.yaml
 8: namespace: atlantis
 9: repositories:
10: - name: runatlantis
11:   url: https://runatlantis.github.io/helm-charts
12: releases:
13: - chart: runatlantis/atlantis
14:   version: 4.1.2
15:   name: atlantis
16:   values:
17:   - jx-values.yaml
18:   - atlantis-values.yaml.gotmpl
19: templates: {}
20: renderedvalues: {}
21:

first-pass rendering starting for "../api-versions.yaml.gotmpl.part.0": inherited=&{default map[] map[]}, overrode=<nil>
first-pass uses: &{default map[] map[]}
first-pass rendering output of "../api-versions.yaml.gotmpl.part.0":
 0: apiVersions:
 1: - networking.k8s.io/v1/Ingress

first-pass produced: &{default map[] map[]}
first-pass rendering result of "../api-versions.yaml.gotmpl.part.0": {default map[] map[]}
vals:
map[]
defaultVals:[]
second-pass rendering result of "../api-versions.yaml.gotmpl.part.0":
 0: apiVersions:
 1: - networking.k8s.io/v1/Ingress

merged environment: &{default map[] map[]}
envvals_loader: loaded jx-values.yaml:map[jx:map[imagePullSecrets:[tekton-container-registry-auth] pipelineVariables:map[] releaseCRD:false secrets:map[adminUser:map[password:todo username:todo] hmacToken:todo pipelineUser:map[email:gitops@googlegroups.com token:todo username:gitops-labs-bot]]] jxRequirements:map[autoUpdate:map[enabled:true schedule:] cluster:map[chartRepository:https://bucketrepo-jx.dev.my-org.com/bucketrepo/charts clusterName:atlantis environmentGitOwner:my-org-devops gitKind:github gitName:github gitServer:https://github.com gke:map[projectNumber:] project:atlantiss-asdf provider:gke zone:us-central2] ingress:map[domain:my-org.com externalDNS:true kind:ingress namespaceSubDomain:. tls:map[email:trolol@my-org.com enabled:true production:true secretName:tls-atlantis-my-org-com-p]] pipelineUser:map[username:botzzzz] repository:bucketrepo secretStorage:gsm vault:map[] webhook:lighthouse] jxRequirementsIngressExternalDNS:map[enabled:true] jxRequirementsIngressTLS:map[enabled:true] jxRequirementsKuberhealthy:map[enabled:false] jxRequirementsTLSCheck:map[enabled:false] jxRequirementsVault:map[enabled:false]]
merged environment: &{default map[jx:map[imagePullSecrets:[tekton-container-registry-auth] pipelineVariables:map[] releaseCRD:false secrets:map[adminUser:map[password:todo username:todo] hmacToken:todo pipelineUser:map[email:gitops@googlegroups.com token:todo username:gitops-labs-bot]]] jxRequirements:map[autoUpdate:map[enabled:true schedule:] cluster:map[chartRepository:https://bucketrepo-jx.dev.my-org.com/bucketrepo/charts clusterName:atlantis environmentGitOwner:my-org-devops gitKind:github gitName:github gitServer:https://github.com gke:map[projectNumber:] project:atlantiss-asdf provider:gke zone:us-central2] ingress:map[domain:my-org.com externalDNS:true kind:ingress namespaceSubDomain:. tls:map[email:trolol@my-org.com enabled:true production:true secretName:tls-atlantis-my-org-com-p]] pipelineUser:map[username:botzzzz] repository:bucketrepo secretStorage:gsm vault:map[] webhook:lighthouse] jxRequirementsIngressExternalDNS:map[enabled:true] jxRequirementsIngressTLS:map[enabled:true] jxRequirementsKuberhealthy:map[enabled:false] jxRequirementsTLSCheck:map[enabled:false] jxRequirementsVault:map[enabled:false]] map[]}
helm:ZiFWv> v3.10.1+g9f88ccb
Adding repo runatlantis https://runatlantis.github.io/helm-charts
exec: helm repo add runatlantis https://runatlantis.github.io/helm-charts --force-update
helm:bbHdk> "runatlantis" has been added to your repositories
"runatlantis" has been added to your repositories

1 release(s) found in helmfile.yaml

processing 1 groups of releases in this order:
GROUP RELEASES
1     atlantis/atlantis

processing releases in group 1/1: atlantis/atlantis
Successfully generated the value file at jx-values.yaml. produced:
# NOTE this file is autogenerated - DO NOT EDIT!
#
# This file is created from the jx-requirements.yml and jx-global-values.yaml files.
# For more information see: https://gitops.io/v3/develop/apps/#using-requirements-in-charts
jx:
  imagePullSecrets:
  - tekton-container-registry-auth
  pipelineVariables: {}
  releaseCRD: false
  secrets:
    adminUser:
      password: todo
      username: todo
    hmacToken: todo
    pipelineUser:
      email: gitops@googlegroups.com
      token: todo
      username: gitops-labs-bot
jxRequirements:
  autoUpdate:
    enabled: true
    schedule: ""
  cluster:
    chartRepository: https://bucketrepo-jx.dev.my-org.com/bucketrepo/charts
    clusterName: atlantis
    environmentGitOwner: my-org-devops
    gitKind: github
    gitName: github
    gitServer: https://github.com
    gke:
      projectNumber: ""
    project: atlantiss-asdf
    provider: gke
    zone: us-central2
  ingress:
    domain: my-org.com
    externalDNS: true
    kind: ingress
    namespaceSubDomain: .
    tls:
      email: trolol@my-org.com
      enabled: true
      production: true
      secretName: tls-atlantis-my-org-com-p
  pipelineUser:
    username: botzzzz
  repository: bucketrepo
  secretStorage: gsm
  vault: {}
  webhook: lighthouse
jxRequirementsIngressExternalDNS:
  enabled: true
jxRequirementsIngressTLS:
  enabled: true
jxRequirementsKuberhealthy:
  enabled: false
jxRequirementsTLSCheck:
  enabled: false
jxRequirementsVault:
  enabled: false

Successfully generated the value file at atlantis-values.yaml.gotmpl. produced:
resources:
  requests:
    cpu: 4
    memory: 4Gi
  limits:
    cpu: 4
    memory: 4Gi
...
Templating release=atlantis, chart=runatlantis/atlantis
exec: helm template atlantis runatlantis/atlantis --version 4.1.2 --api-versions networking.k8s.io/v1/Ingress --namespace atlantis --values /var/folders/bp/4mgw9f094872yc6v7gyzqqt1frkjzj/T/helmfile3683901107/atlantis-atlantis-values-7d9bbdd545 --values /var/folders/bp/4mgw9f094872yc6v7gyzqqt1frkjzj/T/helmfile3821859122/atlantis-atlantis-values-578c84c677 --api-versions=networking.k8s.io/v1/Ingress
helm:urjWP> ---
...
---
# Source: atlantis/templates/ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: atlantis
  labels:
    app: atlantis
    chart: atlantis-4.1.2
    release: atlantis
    heritage: Helm
  annotations:
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
spec:
  ingressClassName: nginx
  rules:
    - host: atlantis-ci.my-org.com
      http:
        paths:
          - path: /
            backend:
              serviceName: atlantis
              servicePort: 80

it seems like this issue has been around for a while roboll/helmfile#457

@yxxhero
Copy link
Member

yxxhero commented Oct 22, 2022

helm template atlantis runatlantis/atlantis --version 4.1.2 --api-versions networking.k8s.io/v1/Ingress --namespace atlantis --values /var/folders/bp/4mgw9f094872yc6v7gyzqqt1frkjzj/T/helmfile3683901107/atlantis-atlantis-values-7d9bbdd545 --values /var/folders/bp/4mgw9f094872yc6v7gyzqqt1frkjzj/T/helmfile3821859122/atlantis-atlantis-values-578c84c677 --api-versions=networking.k8s.io/v1/Ingress

--api-versions networking.k8s.io/v1/Ingress
--api-versions=networking.k8s.io/v1/Ingress

I see. I want your origin command. @joshuasimon-taulia

@yxxhero yxxhero added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels Oct 22, 2022
@yxxhero yxxhero linked a pull request Oct 22, 2022 that will close this issue
@yxxhero yxxhero added this to the v0.147.1 milestone Oct 29, 2022
@joshuasimon-taulia
Copy link
Author

joshuasimon-taulia commented Nov 4, 2022

helmfile-built-from-main template --args "--api-versions=networking.k8s.io/v1 --api-versions=networking.k8s.io/v1/Ingress" | grep -i extensions/v1beta1

args are no longer swalled and correct ingress api version is rendered. thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants