Skip to content

Commit 8f12cc5

Browse files
JanakaSandaruwanMirage20
authored andcommitted
docs: update config tutorial to use alpine worker with echo and sleep
Signed-off-by: Janaka Sandaruwan <janakasandaruwan1996@gmail.com>
1 parent 5ba5221 commit 8f12cc5

1 file changed

Lines changed: 27 additions & 13 deletions

File tree

docs/tutorials/deploy-with-configurations.mdx

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
2-
title: Deploy a Service with Configurations and Secrets
3-
description: Learn how to inject environment variables, config files, and secrets into your OpenChoreo service deployments.
2+
title: Deploy a Worker with Configurations and Secrets
3+
description: Learn how to inject environment variables, config files, and secrets into your OpenChoreo worker deployments.
44
sidebar_position: 6
55
---
66

77
import CodeBlock from "@theme/CodeBlock";
88
import { versions } from "../_constants.mdx";
99

10-
# Deploy a Service with Configurations and Secrets
10+
# Deploy a Worker with Configurations and Secrets
1111

12-
This guide walks you through deploying a service that uses environment variables, configuration files, and secrets. OpenChoreo lets you inject all of these into your workload without baking them into your container image.
12+
This guide walks you through deploying a worker that uses environment variables, configuration files, and secrets. OpenChoreo lets you inject all of these into your workload without baking them into your container image.
1313

1414
## Overview
1515

@@ -89,7 +89,7 @@ Each `SecretReference` maps a key from the external store to a Kubernetes secret
8989

9090
## Step 3 — Deploy the Component and Workload
9191

92-
Create a `Component` using the `service-with-configs` ComponentType, and a `Workload` that injects environment variables, a configuration file, and the secrets defined above.
92+
Create a `Component` using the `deployment/worker` ComponentType, and a `Workload` that injects environment variables, a configuration file, and the secrets defined above. The container echoes all injected values and then sleeps indefinitely so you can inspect the output.
9393

9494
```bash
9595
kubectl apply -f - <<EOF
@@ -104,7 +104,7 @@ spec:
104104
projectName: default
105105
componentType:
106106
kind: ClusterComponentType
107-
name: deployment/service
107+
name: deployment/worker
108108
autoDeploy: true
109109
---
110110
apiVersion: openchoreo.dev/v1alpha1
@@ -116,13 +116,21 @@ spec:
116116
owner:
117117
projectName: default
118118
componentName: config-tutorial-app
119-
endpoints:
120-
http:
121-
type: HTTP
122-
port: 80
123-
visibility: [external]
124119
container:
125-
image: "nginx:1.25-alpine"
120+
image: "alpine:3.19"
121+
command:
122+
- sh
123+
- -c
124+
- |
125+
echo "=== Environment Variables ==="
126+
echo "LOG_LEVEL=$LOG_LEVEL"
127+
echo "DATABASE_PASSWORD=$DATABASE_PASSWORD"
128+
echo "=== Config File ==="
129+
cat /conf/application.toml
130+
echo "=== Secret File ==="
131+
cat /conf/gitPAT
132+
echo "=== Done. Sleeping... ==="
133+
sleep infinity
126134
env:
127135
- key: LOG_LEVEL
128136
value: info
@@ -214,6 +222,12 @@ Check that the pods are running:
214222
kubectl get pods -A | grep config-tutorial-app
215223
```
216224

225+
Once the pod is running, inspect the container output to verify the injected values:
226+
227+
```bash
228+
kubectl logs -n <pod-namespace> -l openchoreo.dev/component=config-tutorial-app
229+
```
230+
217231
Verify the ConfigMaps, ExternalSecrets, and Secrets were created for the configurations:
218232

219233
```bash
@@ -224,7 +238,7 @@ kubectl get secrets -A | grep config-tutorial-app
224238

225239
## Summary
226240

227-
You've learned how to deploy a service with environment variables, configuration files, and secrets using OpenChoreo's `Workload` and `SecretReference` resources, and how to override configurations per environment using `ReleaseBinding`.
241+
You've learned how to deploy a worker with environment variables, configuration files, and secrets using OpenChoreo's `Workload` and `SecretReference` resources, and how to override configurations per environment using `ReleaseBinding`.
228242

229243
## Next Steps
230244

0 commit comments

Comments
 (0)