Skip to content

Commit 1f5a2c2

Browse files
authored
Train 3556 update configmap (#123)
## Description Adds the value for `NEXT_PUBLIC_DD_VERSION_FRONTEND` to the configmap for Storedog. Also sets `DD_ENV` to be set with an environment variable in the configmap. These variables are set when running `subenvt` before applying the configmap. ## How to test Use the k8s sandbox to run Storedog from this branch Check RUM version in Datadog UI
2 parents e7fe321 + 7138628 commit 1f5a2c2

File tree

7 files changed

+28
-14
lines changed

7 files changed

+28
-14
lines changed

k8s-manifests/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ The deployment process uses several environment variables to template image loca
105105
|-------------------------------|---------------------------------------------|---------------------------------|
106106
| `REGISTRY_URL` | Container registry base URL | `localhost:5000` |
107107
| `SD_TAG` | Storedog image tag/version | `latest` |
108+
| `DD_ENV` | Datadog environment | `storedog-k8s` |
108109
| `DD_VERSION_ADS` | Version tag for ads service | `1.0.0` |
109110
| `DD_VERSION_ADS_PYTHON` | Version tag for ads Python service (optional) | `1.0.0` |
110111
| `DD_VERSION_BACKEND` | Version tag for backend & worker services | `1.0.0` |
@@ -139,6 +140,7 @@ export SD_TAG=1.5.0
139140
### Set environment variables for Storedog
140141

141142
```bash
143+
export DD_ENV=storedog-k8s
142144
export DD_VERSION_ADS=1.0.0
143145
export DD_VERSION_ADS_PYTHON=1.0.0
144146
export DD_VERSION_BACKEND=1.0.0
@@ -147,7 +149,7 @@ export DD_VERSION_NGINX=1.28.0
147149
export NEXT_PUBLIC_DD_VERSION_FRONTEND=1.0.0
148150
```
149151

150-
The Datadog environment variable `DD_ENV` is set in two places. Update both values as needed.
152+
The Datadog environment variable `DD_ENV` is set in two places. Update both values as needed. The commands below uses `envsubst` to update the variable values in place before applying the definition file.
151153

152154
* The `datadog/datadog-agent.yaml` file on line 19.
153155
* The `storedog-app/configmaps/storedog-config.yaml` file on line 22.
@@ -169,19 +171,19 @@ helm install datadog-operator datadog/datadog-operator
169171

170172
```bash
171173
kubectl create secret generic datadog-secret \
172-
--from-literal api-key=$DD_API_KEY \
173-
--from-literal app-key=$DD_APP_KEY
174+
--from-literal api-key=${DD_API_KEY} \
175+
--from-literal app-key=${DD_APP_KEY}
174176
```
175177

176-
3. Apply the Datadog Agent definition:
178+
3. Apply the Datadog Agent definition and use `envsubst` to substitute the environment variable in the definition file.
177179

178180
```bash
179-
kubectl apply -f k8s-manifests/datadog/datadog-agent.yaml
181+
envsubst < k8s-manifests/datadog/datadog-agent.yaml | kubectl apply -f -
180182
```
181183

182184
### Deploy Cluster Setup and Storedog
183185

184-
The storedog-app definition files contain variables which need to be set before applying them to the cluster. The command below uses `envsubst` to update the variable values in place before applying the definition file.
186+
The storedog-app definition files contain variables which need to be set before applying them to the cluster. The command below uses `envsubst` to substitute the environment variable in the definition file.
185187

186188
1. **Deploy Cluster Components (one-time setup per cluster):**
187189

k8s-manifests/datadog/datadog-agent.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
secretName: datadog-secret
1717
keyName: app-key
1818
tags:
19-
- "env:storedog-k8s"
19+
- "env:${DD_ENV}"
2020
features:
2121
logCollection: # Logs
2222
enabled: true

k8s-manifests/storedog-app/configmaps/shared-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ data:
1818
NEXT_PUBLIC_SPREE_CLIENT_HOST: /services/backend
1919
NEXT_PUBLIC_SPREE_IMAGE_HOST: /services/backend
2020
NEXT_PUBLIC_SPREE_ALLOWED_IMAGE_DOMAIN: service-proxy
21-
DD_ENV: storedog-k8s
21+
NEXT_PUBLIC_DD_VERSION_FRONTEND: ${NEXT_PUBLIC_DD_VERSION_FRONTEND}
22+
DD_ENV: ${DD_ENV}

k8s-manifests/storedog-app/deployments/frontend.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ spec:
8888
configMapKeyRef:
8989
name: storedog-config
9090
key: NEXT_PUBLIC_SPREE_ALLOWED_IMAGE_DOMAIN
91+
- name: NEXT_PUBLIC_DD_VERSION_FRONTEND
92+
valueFrom:
93+
configMapKeyRef:
94+
name: storedog-config
95+
key: NEXT_PUBLIC_DD_VERSION_FRONTEND
9196
- name: NEXT_PUBLIC_DD_ENV
9297
valueFrom:
9398
configMapKeyRef:
@@ -111,7 +116,10 @@ spec:
111116
- name: DD_SERVICE
112117
value: store-frontend-api
113118
- name: DD_VERSION
114-
value: ${NEXT_PUBLIC_DD_VERSION_FRONTEND}
119+
valueFrom:
120+
configMapKeyRef:
121+
name: storedog-config
122+
key: NEXT_PUBLIC_DD_VERSION_FRONTEND
115123
- name: DD_RUNTIME_METRICS_ENABLED
116124
value: "true"
117125
- name: DD_PROFILING_ENABLED

services/dbm/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ helm install datadog-operator datadog/datadog-operator
186186

187187
```bash
188188
kubectl create secret generic datadog-secret \
189-
--from-literal api-key=$DD_API_KEY \
190-
--from-literal app-key=$DD_APP_KEY \
189+
--from-literal api-key=${DD_API_KEY} \
190+
--from-literal app-key=${DD_APP_KEY} \
191191
--from-literal=dd_application_id=${DD_APPLICATION_ID} \
192192
--from-literal=dd_client_token=${DD_CLIENT_TOKEN}
193193
```

services/dbm/k8s-manifests/datadog/datadog-agent.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spec:
1919
secretName: datadog-secret
2020
keyName: app-key
2121
tags:
22-
- "env:storedog-k8s"
22+
- "env:${DD_ENV}"
2323
features:
2424
logCollection: # Logs
2525
enabled: true

services/dbm/k8s-manifests/storedog-app/deployments/dbm.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,12 @@ spec:
6262
name: storedog-config
6363
key: DB_HOST
6464
- name: DD_ENV
65-
value: ${DD_ENV}
65+
valueFrom:
66+
configMapKeyRef:
67+
name: storedog-config
68+
key: DD_ENV
6669
- name: DD_SERVICE
67-
value: storedog-dbm
70+
value: store-dbm
6871
- name: DD_VERSION
6972
value: ${DD_VERSION_DBM}
7073
- name: DD_DBM_PROPAGATION_MODE

0 commit comments

Comments
 (0)