Skip to content

docs: show a realistic unencrypted_regex example - #254

Merged
isindir merged 1 commit into
isindir:masterfrom
bmbferreira:docs/unencrypted-regex-worked-example
Sep 6, 2026
Merged

isindir merged 1 commit into
isindir:masterfrom
bmbferreira:docs/unencrypted-regex-worked-example

Conversation

@bmbferreira

@bmbferreira bmbferreira commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Commit message

docs: show a realistic unencrypted_regex example

Description

Follow up to #252. The example test does not make it clear why the feature is needed. The fixture used the key names PLAIN_CONFIG_VALUE and SECRET_TOKEN, which show the mechanism but not the use case. Read on its own, it does look like something a ConfigMap solves.

Suggested solution

The fixture now holds five environment variables for one application:

stringData:
    LOG_LEVEL: debug
    WEB_CONCURRENCY: '4'
    OTEL_EXPORTER_OTLP_ENDPOINT: https://otel.example.com:4318
    DATABASE_URL: postgres://app:[email protected]:5432/app
    OPENAI_API_KEY: sk-example-not-a-real-key

The first three stay in plain text and the last two are encrypted. This is the case the option is
for: one application with both types of value, in one file. A change to WEB_CONCURRENCY is then
visible in a diff, and the two secrets stay protected.

The README shows the same example, and it puts the rule in .sops.yaml instead of a command line
flag. This also answers your point about an incorrectly written regex: in .sops.yaml the allowlist
is one line in one file which the team reviews, instead of a flag which somebody retypes for each
file.

The README also states that a value in stringData must stay quoted when it looks like a number,
because Kubernetes only accepts strings there.

Alternative solutions considered

A ConfigMap mounted next to the secret holds this data equally well, and for the data alone it is
the simpler answer. The difference for us is the file, not the data. The same variables also live in
.enc.env files for local development and CI, so one .sops.yaml rule covers both places. A
ConfigMap solves only the cluster side, and then a person who adds one environment variable must
decide first whether it is secret, edit a second file, and add another envFrom.

Additional context

No change to the operator or to the CRD. This is the fixture, the assertions and the README.
make test passes, coverage 78.7%.

AI generated code/design contribution

Yes. An AI assistant wrote the example, the README text and this description. I reviewed the change
and ran the tests.

The test fixture used the key names PLAIN_CONFIG_VALUE and SECRET_TOKEN.
Those names show the mechanism, but they do not show why a user needs it.

The fixture now holds five environment variables for one application:
LOG_LEVEL, WEB_CONCURRENCY and OTEL_EXPORTER_OTLP_ENDPOINT stay in plain
text, and DATABASE_URL and OPENAI_API_KEY are encrypted. This is the case
the option is for: one application which has both types of value, in one
file.

The README shows the same example, with the rule in .sops.yaml instead of a
command line flag. A rule in .sops.yaml is in one file which the team
reviews, and nobody has to repeat the flag. The README also states that a
value in stringData must stay quoted when it looks like a number.

Co-authored-by: Cursor <[email protected]>
@bmbferreira
bmbferreira marked this pull request as ready for review August 13, 2026 08:39
@bmbferreira
bmbferreira requested a review from isindir as a code owner August 13, 2026 08:39
@isindir isindir self-assigned this Aug 13, 2026
@isindir
isindir merged commit 3af9605 into isindir:master Sep 6, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants