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

Add environment variable to nats-cluster pods #245

Open
nealAR opened this issue Jan 31, 2020 · 0 comments
Open

Add environment variable to nats-cluster pods #245

nealAR opened this issue Jan 31, 2020 · 0 comments

Comments

@nealAR
Copy link

nealAR commented Jan 31, 2020

We are trying to access the pod name in the annotations by using the downward API in the environment variables section. Given the current state of the CRD, we are unable to do this in the yaml config. Can someone suggest a way to either access the pod name in the annotations given the current state of the CRD, or suggest what to add to the config to allow access to this info?

apiVersion: "nats.io/v1alpha2"
kind: "NatsCluster"
metadata:
name: "nats-cluster"
spec:
size: 3
version: "2.0.0"
serverImage: "nats"
pod:
antiAffinity: true
enableMetrics: true
metricsImage: "synadia/prometheus-nats-exporter"
metricsImageTag: "0.3.0"
labels:
app: test
annotations:
ad.datadoghq.com/nats.check_names: '["openmetrics"]'
ad.datadoghq.com/nats.init_configs: '[{}]'
ad.datadoghq.com/nats.instances: '[{"prometheus_url": "http://%%host%%:7777/metrics","namespace":"nats","metrics": ["gnatsd_varz_slow_consumers","gnatsd_varz_subscriptions","gnatsd_varz_connections","gnatsd_varz_out_msgs","gnatsd_varz_out_bytes","gnatsd_varz_in_msgs","gnatsd_varz_in_bytes","gnatsd_varz_mem","gnatsd_varz_cpu"]}]'
template:
spec:
containers:
- name: nats
image: nats:2.0.0
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name

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

1 participant