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

Environment variables support in Pyrra #1117

Open
lukasmrtvy opened this issue Mar 20, 2024 · 2 comments
Open

Environment variables support in Pyrra #1117

lukasmrtvy opened this issue Mar 20, 2024 · 2 comments

Comments

@lukasmrtvy
Copy link

Would be great to support env vars in Pyrra, for example:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: pyrra-api
  namespace: monitoring
spec:
  template:
    spec:
      containers:
        - name: pyrra
          env:
          - name: PASSWORD
            valueFrom:
              secretKeyRef:
                name: secrets
                key: password
          args:
            - api
            - --log-level=info
            - --prometheus-url=http://mimir-gateway.mimir:80/prometheus
            - --prometheus-basic-auth-password=$PASSWORD
            - --prometheus-basic-auth-username=mimir
            - --api-url=http://pyrra-kubernetes:9444
@metalmatze
Copy link
Member

We could implement something like that, however, just like Prometheus, I'm in favour to use files containing passwords. Do you think using files would work too?

@mtthwcmpbll
Copy link

I was exploring this today as we're also trying to connect to a mimir gatewat behind basic augh, and I was able to get the environment variable approach to work if I included parentheses around my environment variables in my args:

spec:
  containers:
  - args:
    - api
    - --api-url=http://pyrra-kubernetes.monitoring.svc.cluster.local:9444
    - --prometheus-url=http://mimir-gateway.monitoring.svc.cluster.local/prometheus
    - --prometheus-basic-auth-username=$(OBSERVABILITY_USERNAME)
    - --prometheus-basic-auth-password=$(OBSERVABILITY_PASSWORD)
    env:
    - name: OBSERVABILITY_USERNAME
      valueFrom:
        secretKeyRef:
          key: username
          name: observability-credentials
    - name: OBSERVABILITY_PASSWORD
      valueFrom:
        secretKeyRef:
          key: password
          name: observability-credentials

For my particular use case, I need to use kustomize on the Pyrra-provided manifests in order to patch those environment variables in and then add the additional args to the existings ones in the provided manifests. I'm not sure how Pyrra would expect to pull a secret from a file, but it seems like that would work here too with a combinations of volumes and a way to point Pyrra at the right file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants