Skip to content

Commit cc8aaa4

Browse files
warshawdoppegard
andcommitted
First pass PR
Co-authored-by: Glenn Oppegard <goppegard@vmware.com>
1 parent 77dd0cb commit cc8aaa4

File tree

1 file changed

+66
-0
lines changed
  • content/en/04-tutorials/05-config-map-scripts

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
The following tutorial demonstrates how to configure scripts for Pixie's observability platform using Kubernetes ConfigMaps, rather than the default Control Plane.
2+
3+
## Motivation
4+
5+
This feature is for customers who want to manage their PxL scripts outside of a control plane. It provides to ability to supply PxL scripts via in-cluster ConfigMaps either instead of or in addition to scripts from a control plane.
6+
7+
As an example, if your product needed to install Pixie with a set of scripts pre-loaded, this would solve that problem.
8+
9+
10+
11+
## Turning on the feature
12+
13+
You can enable loading scripts from ConfigMaps by setting the `PL_CRON_SCRIPT_SOURCES` environment variable on the `vizier-query-broker` deployment. The value of this environment variable should be a space-separated list of sources. Currently, the valid sources are `cloud` and `configmaps`. If nothing is supplied, the query broker will default to `cloud` only.
14+
15+
As an example, you could enable both sources by running:
16+
17+
```bash
18+
px deploy -y --patches "vizier-query-broker:{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"env\":[{\"name\":\"PL_CRON_SCRIPT_SOURCES\",\"value\":\"cloud configmaps\"}], \"name\":\"app\"}]}}}}
19+
```
20+
21+
## ConfigMap Format
22+
23+
Each ConfigMap must be in the same namespace as the query broker, and must also have the `purpose=cron-script` label.
24+
25+
Each ConfigMap must contain the following data:
26+
- a `script.pxl` key with the pixel script as its value
27+
- a `cron.yaml` key that a valid YAML string with a `frequency_s` key, whose value controls how frequently in seconds the script is executed
28+
- an optional `configs.yaml` key which contains a YAML string that configures OpenTelemetry data export
29+
30+
An example configured to send data to an OpenTelemetry endpoint:
31+
```yaml
32+
---
33+
apiVersion: v1
34+
kind: ConfigMap
35+
metadata:
36+
name: my-configmap-script
37+
namespace: pl
38+
labels:
39+
purpose: cron-script
40+
data:
41+
script.pxl: |
42+
# YOUR PIXEL SCRIPT
43+
configs.yaml: |
44+
otelEndpointConfig:
45+
insecure: true
46+
url: <otel-url>
47+
cron.yaml: |
48+
frequency_s: 15
49+
```
50+
51+
An example without data export:
52+
```yaml
53+
---
54+
apiVersion: v1
55+
kind: ConfigMap
56+
metadata:
57+
name: my-configmap-script
58+
namespace: pl
59+
labels:
60+
purpose: cron-script
61+
data:
62+
script.pxl: |
63+
# YOUR PIXEL SCRIPT
64+
cron.yaml: |
65+
frequency_s: 15
66+
```

0 commit comments

Comments
 (0)