jenkins-x/jx

Bug(jx-gitops): helmfile resolve won't handle different environment key and namespace

roulettedares opened this issue · 0 comments

namespaceSubDomain won’t be correctly resolved by jx gitops helmfile resolve if environments[$INDEX].key doesn’t match environments[$INDEX].namespace

see the stg-standby environment key for an example

apiVersion: core.jenkins-x.io/v4beta1
kind: Requirements
spec:
  autoUpdate:
    enabled: false
    schedule: ""
  cluster:
    chartRepository: http://jenkins-x-chartmuseum.jx.svc.cluster.local:8080
    clusterName: stg
    environmentGitOwner: my-org
    gitKind: github
    gitName: github
    gitServer: https://github.com
    gke:
      projectNumber: "123456"
    project: bi-my-org
    provider: gke
    zone: us-central1
  environments:
  - gitKind: github
    gitServer: https://github.com
    ingress:
      domain: stg.my-org.com
      externalDNS: true
      kind: ingress
      namespaceSubDomain: .
      tls:
        email: devops@my-org.com
        enabled: true
        production: true
        secretName: tls-stg-my-org-com-p
    key: stg
    namespace: stg
    owner: my-org
    promotionStrategy: Never
    repository: gitops-stg
  - gitKind: github
    gitServer: https://github.com
    ingress:
      domain: stg.my-org.com
      externalDNS: true
      namespaceSubDomain: -standby.
      tls:
        email: ops@my-org.com
        enabled: true
        production: true
        secretName: tls-stg-my-org-com-p
    key: stg-standby
    namespace: standby
    owner: my-org
    promotionStrategy: Never
  ingress:
    domain: stg.my-org.com
    externalDNS: true
    kind: ingress
    namespaceSubDomain: .
    tls:
      email: devops@my-org.com
      enabled: true
      production: true
      secretName: tls-stg-my-org-com-p
  pipelineUser:
    username: weeeeeee-github
  repository: bucketrepo
  secretStorage: local
  vault: {}
  webhook: lighthouse

results in this helmfiles/standby/jx-values.yaml

environments:
  - gitKind: github
    gitServer: https://github.com/
    ingress:
      domain: stg.my-org.com
      externalDNS: true
      kind: ingress
      namespaceSubDomain: .
      tls:
        email: ops@my-org.com
        enabled: true
        production: true
        secretName: tls-stg-my-org-com-p
    key: stg
    namespace: stg
    owner: my-org
    promotionStrategy: Never
    repository: gitops-stg
  - gitKind: github
    gitServer: https://github.com/
    ingress:
      domain: stg.my-org.com
      externalDNS: true
      namespaceSubDomain: -standby.
      tls:
        email: ops@my-org.com
        enabled: true
        production: true
        secretName: tls-stg-my-org-com-p
    key: stg-standby
    namespace: standby
    owner: my-org
    promotionStrategy: Never
  ingress:
    domain: stg.my-org.com
    externalDNS: true
    kind: ingress
    namespaceSubDomain: .
    tls:
      email: devops@my-org.com
      enabled: true
      production: true
      secretName: tls-stg-my-org-com-p

i would expect the rendered jx-values.yaml to look like

  ingress:
    domain: stg.my-org.com
    externalDNS: true
    kind: ingress
    namespaceSubDomain:  -standby.