Skip to main content
The write command validates YAML option values and generates deployment artifacts. It supports two output formats: JSON files for all namespace/target combinations, or a single Kubernetes ConfigMap for a specific namespace/target.

Usage

# Generate JSON files
sentry-options-cli write \
  --schemas <SCHEMAS> \
  --root <ROOT> \
  --output-format json \
  --out <OUT>

# Generate ConfigMap
sentry-options-cli write \
  --schemas <SCHEMAS> \
  --root <ROOT> \
  --output-format configmap \
  --namespace <NAMESPACE> \
  --target <TARGET> \
  [--commit-sha <SHA>] \
  [--commit-timestamp <TIMESTAMP>] \
  [--out <FILE>]

Common arguments

--schemas
string
required
Directory containing namespace schema definitions.Expected structure:
schemas/
├── seer/
│   └── schema.json
└── relay/
    └── schema.json
--root
string
required
Root directory of the sentry options values.Expected structure:
option-values/
├── seer/
│   ├── default/
│   │   └── values.yaml
│   └── us/
│       └── values.yaml
└── relay/
    └── default/
        └── values.yaml
--output-format
enum
default:"json"
Output format: json or configmap.
  • json - Generates separate JSON files for each namespace/target combination
  • configmap - Generates a single Kubernetes ConfigMap YAML
--quiet
boolean
Suppress output messages. Only errors will be displayed.

JSON format arguments

--out
string
required
Output directory for JSON files. The directory will be created if it doesn’t exist.Required when --output-format json.

ConfigMap format arguments

--namespace
string
required
Namespace to generate ConfigMap for.Required when --output-format configmap.
--target
string
required
Target to generate ConfigMap for (e.g., us, de, s4s).Required when --output-format configmap.
--commit-sha
string
Git commit SHA for traceability. Added as a ConfigMap annotation.Example: abc123def456789...
--commit-timestamp
string
Git commit timestamp for SLO tracking. Added as a ConfigMap annotation.Example: 2026-03-04T15:30:00Z
--out
string
Output file path for the ConfigMap YAML. If not specified, output is printed to stdout.Optional when --output-format configmap.

Output formats

JSON format

Generates individual JSON files for each namespace/target combination:
{
  "options": {
    "feature.enabled": true,
    "feature.rate_limit": 200,
    "feature.enabled_slugs": ["getsentry", "sentry"]
  },
  "generated_at": "2026-03-04T15:30:00Z"
}
Files are named: sentry-options-{namespace}-{target}.json For example:
  • sentry-options-seer-default.json
  • sentry-options-seer-us.json
  • sentry-options-relay-default.json

ConfigMap format

Generates a Kubernetes ConfigMap:
apiVersion: v1
kind: ConfigMap
metadata:
  name: sentry-options-seer
  labels:
    app.kubernetes.io/managed-by: sentry-options
  annotations:
    generated_at: '2026-03-04T15:30:00Z'
    commit_sha: abc123def456789
    commit_timestamp: '2026-03-04T15:00:00Z'
data:
  values.json: |-
    {"options":{"feature.enabled":true,"feature.rate_limit":200},"generated_at":"2026-03-04T15:30:00Z"}
ConfigMap name format: sentry-options-{namespace} Note: The target is not included in the ConfigMap name. Different targets for the same namespace produce ConfigMaps with the same name but different content.

Examples

Generate all JSON files

sentry-options-cli write \
  --schemas schemas/ \
  --root option-values/ \
  --output-format json \
  --out dist/
Output:
Successfully wrote 6 output files
Directory structure:
dist/
├── sentry-options-seer-default.json
├── sentry-options-seer-us.json
├── sentry-options-seer-de.json
├── sentry-options-relay-default.json
├── sentry-options-relay-us.json
└── sentry-options-relay-de.json

Generate ConfigMap to stdout

sentry-options-cli write \
  --schemas schemas/ \
  --root option-values/ \
  --output-format configmap \
  --namespace seer \
  --target us \
  --commit-sha "$COMMIT_SHA" \
  --commit-timestamp "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
Output:
apiVersion: v1
kind: ConfigMap
metadata:
  name: sentry-options-seer
  labels:
    app.kubernetes.io/managed-by: sentry-options
  annotations:
    generated_at: '2026-03-04T15:30:00Z'
    commit_sha: abc123def456789
    commit_timestamp: '2026-03-04T15:00:00Z'
data:
  values.json: |-
    {"options":{"feature.enabled":true,"feature.rate_limit":200},"generated_at":"2026-03-04T15:30:00Z"}

Generate ConfigMap to file

sentry-options-cli write \
  --schemas schemas/ \
  --root option-values/ \
  --output-format configmap \
  --namespace seer \
  --target us \
  --out configmaps/seer-us.yaml
Output:
Successfully wrote ConfigMap to configmaps/seer-us.yaml

CD pipeline usage

# Generate and apply ConfigMap for each namespace/target combination
for namespace in seer relay; do
  for target in us de s4s; do
    sentry-options-cli write \
      --schemas schemas/ \
      --root option-values/ \
      --output-format configmap \
      --namespace "$namespace" \
      --target "$target" \
      --commit-sha "$COMMIT_SHA" \
      --commit-timestamp "$(date -u +%Y-%m-%dT%H:%M:%SZ)" | \
      kubectl apply -f - --context "cluster-$target"
  done
done

Target merging

The write command merges values from default and target-specific directories:
# option-values/seer/default/values.yaml
options:
  feature.enabled: false
  feature.rate_limit: 100
  feature.enabled_slugs: ["getsentry"]

# option-values/seer/us/values.yaml
options:
  feature.enabled: true  # Overrides default
  feature.rate_limit: 200  # Overrides default
  # feature.enabled_slugs inherits from default
Result for --namespace seer --target us:
{
  "options": {
    "feature.enabled": true,
    "feature.rate_limit": 200,
    "feature.enabled_slugs": ["getsentry"]
  },
  "generated_at": "2026-03-04T15:30:00Z"
}

Option key sorting

Options are sorted alphabetically in the output:
# Input (any order)
options:
  z_option: true
  a_option: 1
  m_option: "hello"
// Output (sorted)
{
  "options": {
    "a_option": 1,
    "m_option": "hello",
    "z_option": true
  }
}

ConfigMap size limits

Kubernetes ConfigMaps have a maximum size of 1MiB. The CLI enforces a limit of 1MiB minus 1000 bytes (for etcd/protobuf overhead). If a ConfigMap exceeds this limit:
$ sentry-options-cli write --output-format configmap ...
ConfigMap 'sentry-options-large' exceeds Kubernetes (1MiB - 1000B margin) limit (currently 1049600 bytes)

Error handling

Missing required argument

$ sentry-options-cli write \
    --schemas schemas/ \
    --root option-values/ \
    --output-format json
--out is required for json output format
$ sentry-options-cli write \
    --schemas schemas/ \
    --root option-values/ \
    --output-format configmap \
    --namespace seer
--target is required for configmap output format

Validation errors

The write command performs the same validations as validate-values. Any validation error will prevent output generation:
$ sentry-options-cli write --schemas schemas/ --root option-values/ ...
Schema validation error: option-values/seer/default/values.yaml
  feature.rate_limit: "invalid" is not of type "integer"

Namespace not found

$ sentry-options-cli write \
    --output-format configmap \
    --namespace nonexistent \
    --target us ...
Namespace 'nonexistent' not found in values

Target not found

$ sentry-options-cli write \
    --output-format configmap \
    --namespace seer \
    --target nonexistent ...
Target 'nonexistent' not found in namespace 'seer'

See also

Build docs developers (and LLMs) love