hey folks. I'm trying to deploy Atlantis onto an A...
# atlantis-community
r
hey folks. I'm trying to deploy Atlantis onto an Azure Kubernetes cluster. I have all the credentials from the
values.yaml
stored in Key Vault secrets which are delivered to the cluster by way of External Secrets. For some reason though it seems like the resulting yaml inside the secret is either corrupt or I've formatted it wrong, and I can't tell which it is.
p
the pod dies before any logs?
can you enable debug in atlantis and see if you get any error?
r
so I'm using
environmentSecrets
in
values.yaml
to specify environment variables. this is what that looks like:
Copy code
environmentSecrets:
  - name: ATLANTIS_GH_USER
    secretKeyRef:
      name: atlantis
      key: atlantis-github-user
  - name: ATLANTIS_GH_TOKEN
    secretKeyRef:
      name: atlantis
      key: atlantis-github-token
  - name: ATLANTIS_GH_WEBHOOK_SECRET
    secretKeyRef:
      name: atlantis
      key: atlantis-github-webhook-secret
  - name: ATLANTIS_WEB_USERNAME
    secretKeyRef:
      name: atlantis
      key: atlantis-web-username
  - name: ATLANTIS_WEB_PASSWORD
    secretKeyRef:
      name: atlantis-basicauth
      key: password
  - name: ATLANTIS_API_SECRET
    secretKeyRef:
      name: atlantis
      key: atlantis-api-secret
the secrets are all correct
and yet
this is what the pod logs say
p
this doesn’t have to be the name of the ENV variable too?
name: atlantis
r
why would it need to be?
it's the name of the kubernetes secret that contains the actual environment variable value
p
I’m not a Kubernetes person
the error you see if because atlantis is not seeing one of the ENV variables that is required
even if the value is wrong
r
except I'm supplying those via a kubernetes secret
g
If you shell to the container and run
env
do you see these env variables defined there?
If not, please share the yaml content of your secret, with the values redacted
r
I can't shell to the container, it crashloops quickly enough that I'm not able to get a shell
so this is the yaml in
values.yaml
Copy code
environmentSecrets:
  - name: ATLANTIS_GH_USER
    secretKeyRef:
      name: atlantis
      key: atlantis-github-user
  - name: ATLANTIS_GH_TOKEN
    secretKeyRef:
      name: atlantis
      key: atlantis-github-token
  - name: ATLANTIS_GH_WEBHOOK_SECRET
    secretKeyRef:
      name: atlantis
      key: atlantis-github-webhook-secret
  - name: ATLANTIS_WEB_USERNAME
    secretKeyRef:
      name: atlantis
      key: atlantis-web-username
  - name: ATLANTIS_WEB_PASSWORD
    secretKeyRef:
      name: atlantis-basicauth
      key: password
  - name: ATLANTIS_API_SECRET
    secretKeyRef:
      name: atlantis
      key: atlantis-api-secret
and this is the redacted secret data
Copy code
apiVersion: v1
data:
  atlantis-api-secret: [REDACTED]
  atlantis-gitconfig: [REDACTED]
  atlantis-github-token: [REDACTED]
  atlantis-github-user: [REDACTED]
  atlantis-github-webhook-secret: [REDACTED]
  atlantis-web-password: [REDACTED]
  atlantis-web-username: [REDACTED]
immutable: false
kind: Secret
metadata:
  annotations:
    <http://kubectl.kubernetes.io/last-applied-configuration|kubectl.kubernetes.io/last-applied-configuration>: |
      {"apiVersion":"<http://external-secrets.io/v1beta1|external-secrets.io/v1beta1>","kind":"ExternalSecret","metadata":{"annotations":{},"name":"atlantis","namespace":"atlantis"},"spec":{"data":[{"remoteRef":{"key":"secret/atlantis-github-user"},"secretKey":"atlantis-github-user"},{"remoteRef":{"key":"secret/atlantis-github-token"},"secretKey":"atlantis-github-token"},{"remoteRef":{"key":"secret/atlantis-github-webhook-secret"},"secretKey":"atlantis-github-webhook-secret"},{"remoteRef":{"key":"secret/atlantis-api-secret"},"secretKey":"atlantis-api-secret"},{"remoteRef":{"key":"secret/atlantis-web-username"},"secretKey":"atlantis-web-username"},{"remoteRef":{"key":"secret/atlantis-web-password"},"secretKey":"atlantis-web-password"},{"remoteRef":{"key":"secret/atlantis-gitconfig"},"secretKey":"atlantis-gitconfig"}],"refreshInterval":"1m","secretStoreRef":{"kind":"ClusterSecretStore","name":"mi-infra-worker-extsec"},"target":{"name":"atlantis"}}}
    <http://reconcile.external-secrets.io/data-hash|reconcile.external-secrets.io/data-hash>: 32d77666fd0e3c172f24aa68ac294aae
  creationTimestamp: "2024-04-24T19:29:09Z"
  labels:
    <http://reconcile.external-secrets.io/created-by|reconcile.external-secrets.io/created-by>: 19ff3c0e100bcc589760c06d99fdccf6
  name: atlantis
  namespace: atlantis
  ownerReferences:
  - apiVersion: <http://external-secrets.io/v1beta1|external-secrets.io/v1beta1>
    blockOwnerDeletion: true
    controller: true
    kind: ExternalSecret
    name: atlantis
    uid: 7558f3dd-1421-47b1-8843-a5b139e50819
  resourceVersion: "319569919"
  uid: 27d76e5c-151e-4731-9522-d8d7c6ed3d98
type: Opaque
g
The redacted part is in base64 right?
r
yup
g
Looking at all this it seems ok. Can you confirm on the pod spec that the env configs for the secrets are there?
r
huh. Welp, there's the problem.
Copy code
Environment:
      ATLANTIS_DEFAULT_TF_VERSION:  1.7.4
      ATLANTIS_LOG_LEVEL:           info
      ATLANTIS_SSL_CERT_FILE:       /etc/tls/tls.crt
      ATLANTIS_SSL_KEY_FILE:        /etc/tls/tls.key
      ATLANTIS_DATA_DIR:            /atlantis-data
      ATLANTIS_REPO_ALLOWLIST:      [REDACTED]
      ATLANTIS_PORT:                4141
      ATLANTIS_ATLANTIS_URL:        [REDACTED]
but if I'm using
environmentSecrets
, why isn't the chart pulling it in?
g
Checking the logic now
Are you on the latest chart version?
I would also run a helm template locally to make sure the secrets are part of the statefulset on the env
r
Copy code
apiVersion: v1
appVersion: v0.27.2
description: A Helm chart for Atlantis <https://www.runatlantis.io>
home: <https://www.runatlantis.io>
icon: <https://www.runatlantis.io/hero.png>
keywords:
- terraform
maintainers:
- name: lkysow
- name: jamengual
- name: chenrui333
- name: nitrocode
- name: genpage
- name: gmartinez-sisti
name: atlantis
sources:
- <https://github.com/runatlantis/atlantis>
version: 4.25.0
g
Also confirm that the statefulset has those configs. If they were added after with the pod already failling, sometimes they are not updated on the pod.
r
yeah so the statefulset doesn't have them
should I maybe just do a helm delete and do a fresh install?
g
Try the local helm template to see if they show up
r
looks like they don't
g
Let me try it, we might have a bug 🐛
👍 1
❌ 1
it worked here
Copy code
→ cat test.yaml
environmentSecrets:
  - name: ATLANTIS_GH_USER
    secretKeyRef:
      name: atlantis
      key: atlantis-github-user
  - name: ATLANTIS_GH_TOKEN
    secretKeyRef:
      name: atlantis
      key: atlantis-github-token
  - name: ATLANTIS_GH_WEBHOOK_SECRET
    secretKeyRef:
      name: atlantis
      key: atlantis-github-webhook-secret
  - name: ATLANTIS_WEB_USERNAME
    secretKeyRef:
      name: atlantis
      key: atlantis-web-username
  - name: ATLANTIS_WEB_PASSWORD
    secretKeyRef:
      name: atlantis-basicauth
      key: password
  - name: ATLANTIS_API_SECRET
    secretKeyRef:
      name: atlantis
      key: atlantis-api-secret
Copy code
→ helm template atlantis . -f test.yaml -s templates/statefulset.yaml | yq .spec.template.spec.containers[0].env
- name: ATLANTIS_GH_USER
  valueFrom:
    secretKeyRef:
      name: atlantis
      key: atlantis-github-user
- name: ATLANTIS_GH_TOKEN
  valueFrom:
    secretKeyRef:
      name: atlantis
      key: atlantis-github-token
- name: ATLANTIS_GH_WEBHOOK_SECRET
  valueFrom:
    secretKeyRef:
      name: atlantis
      key: atlantis-github-webhook-secret
- name: ATLANTIS_WEB_USERNAME
  valueFrom:
    secretKeyRef:
      name: atlantis
      key: atlantis-web-username
- name: ATLANTIS_WEB_PASSWORD
  valueFrom:
    secretKeyRef:
      name: atlantis-basicauth
      key: password
- name: ATLANTIS_API_SECRET
  valueFrom:
    secretKeyRef:
      name: atlantis
      key: atlantis-api-secret
- name: ATLANTIS_DATA_DIR
  value: /atlantis-data
- name: ATLANTIS_REPO_ALLOWLIST
  value: "<replace-me>"
- name: ATLANTIS_PORT
  value: "4141"
- name: ATLANTIS_ATLANTIS_URL
  value: http://
looks like your values file is not being correctly sourced.
r
any idea why?
g
how are you deploying it?
r
helm install atlantis runatlantis/atlantis -f values.yaml
?
oh wait hold on
I think I might've found the problem. Let me try to redeploy
💡 1
okay I think that did it. Chalk it up to ID-10T error and letting Copilot run amok.
I had a duplicate
environmentSecrets
block, and a couple of autoco-wrecked-ed secret names
the pod is up at least, but it's not stable yet
g
Almost there 😊
r
okay, so how would I configure the helm chart to use
ClusterIP
instead of
NodePort
for the
service
block?
that's the last piece
everything else is working now