Skip to content

fix(observability-pipelines-worker): correct sgc_path in bootstrap template - #2883

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits into
mainfrom
ckelner/fix-opw-sgc-path-bootstrap
Sep 2, 2026
Merged

fix(observability-pipelines-worker): correct sgc_path in bootstrap template#2883
gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits into
mainfrom
ckelner/fix-opw-sgc-path-bootstrap

Conversation

@ckelner

@ckelner ckelner commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Removes hardcoded sgc_path from bootstrap.yaml template, deferring to OPW's built-in default (/opt/.../bin/sgc since 2.13.0)
  • Prevents duplicate secret: YAML block when both bootstrap.config and secretFileContents are set
  • Uses hasKey instead of dig truthiness to correctly detect key presence regardless of value

Problem

The bootstrap.yaml template hardcoded sgc_path as /opt/datadog/observability-pipelines-worker/bin/datadog-secret-backend, but the binary was renamed to sgc in 2.15.1:

# Dockerfile:32
cp /opt/datadog-agent/embedded/bin/secret-generic-connector \
   /opt/datadog/observability-pipelines-worker/bin/sgc

OPW already defaults to the correct path when sgc_path is omitted (lib/config/src/bootstrap/mod.rs:35):

const DEFAULT_SGC_INSTALL_PATH: &str = "/opt/datadog/observability-pipelines-worker/bin/sgc";

When secretFileContents was used, OPW failed to load pipeline config:

ERROR: Failed to reload remote configuration.
  "Error while retrieving secret from backend \"exec_backend\": No such file or directory (os error 2)"

Additionally, providing bootstrap.config.secret alongside secretFileContents to override the path produced a duplicate secret: YAML key, which OPW rejects.

Fix

Three changes to templates/bootstrap.yaml:

  1. Remove sgc_path line entirely, deferring to OPW's built-in default
  2. Skip emitting the auto-generated secret: block when bootstrap.config already defines one
  3. Use hasKey instead of dig to detect key presence (handles empty/null values correctly)

Test plan - helm template render results

All 6 permutations verified locally via helm template:

Case 1: secretFileContents only (most common path)

Expected: single secret: block with backend_type/backend_config, no sgc_path

bootstrap.yaml: |-
  secret:
    backend_type: json
    backend_config:
      file_path: /etc/observability-pipelines-secrets/secrets.json

Result: PASS - single block, no sgc_path, OPW uses default

Case 2: bootstrap.config.secret (vault) + secretFileContents

Expected: only user's vault config, no duplicate auto-generated block

bootstrap.yaml: |-
  secret:
    backend_type: vault
    sgc_path: /custom/sgc

Result: PASS - user config wins, no duplicate

Case 3: bootstrap.config.secret="" + secretFileContents (codex edge case)

Expected: user's secret: "" rendered, no duplicate auto block

bootstrap.yaml: |-
  secret: ""

Result: PASS - hasKey detects key presence despite empty value, no duplicate

Case 4: bootstrap.config (non-secret keys) + secretFileContents

Expected: user's non-secret config + auto secret: block (secret key absent from config)

bootstrap.yaml: |-
  api:
    enabled: true
  secret:
    backend_type: json
    backend_config:
      file_path: /etc/observability-pipelines-secrets/secrets.json

Result: PASS - auto block correctly added when user config has no secret key

Case 5: bootstrap.config.secret only (no secretFileContents)

Expected: user's config only, no auto block

bootstrap.yaml: |-
  secret:
    backend_type: aws

Result: PASS - unchanged behavior

Case 6: Neither bootstrap.config nor secretFileContents

Expected: no bootstrap configmap rendered at all

Result: PASS - 0 matches for "bootstrap" in rendered output

🤖 Generated with Claude Code

…mplate

The bootstrap.yaml template hardcodes sgc_path as
`datadog-secret-backend` when secretFileContents is used, but the
container image only has the binary as `sgc` (renamed from
`secret-generic-connector` in the Dockerfile). This causes OPW to fail
to load pipeline config with "No such file or directory" when resolving
pipeline identifiers via the secrets backend.

Also prevents emitting a duplicate `secret:` YAML block when both
`bootstrap.config.secret` and `secretFileContents` are provided, which
previously caused "duplicate field 'secret'" deserialization errors.

Fixes:
- sgc_path: .../datadog-secret-backend -> .../sgc
- Skip auto-generated secret block when bootstrap.config already defines one

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ckelner
ckelner requested a review from a team as a code owner August 28, 2026 00:58
@github-actions github-actions Bot added the chart/observability-pipelines-worker This issue or pull request is related to the observability-pipelines-worker chart label Aug 28, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ccb904388e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread charts/observability-pipelines-worker/templates/bootstrap.yaml Outdated
@datadog-datadog-prod-us1

This comment has been minimized.

{{- if and .Values.datadog.bootstrap.secretFileContents (not (dig "secret" nil .Values.datadog.bootstrap.config)) }}
secret:
sgc_path: /opt/datadog/observability-pipelines-worker/bin/datadog-secret-backend
sgc_path: /opt/datadog/observability-pipelines-worker/bin/sgc

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like OPW defaults secret.sgc_path when it's omitted -- see the default setting to /sgc in 2.21.1 & this test

That default matches the sgc binary since 2.13.0, whereas the change to /sgc happened in 2.15.1. Should we simply omit secret.sgc_path from the template and defer to the worker default?

(note i haven't seen the google doc yet)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok yeah I stand by this after looking at the doc. Changing the hardcoded path works too but omitting it fully to defer to the default feels a tad nicer

@tessneau tessneau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we add a changelog entry and bump the chart version for this ? this looks like a previous example #2814

Address review feedback:
- Remove sgc_path entirely instead of changing the value; OPW defaults
  to the correct path (/opt/.../bin/sgc) since 2.13.0
- Add CHANGELOG.md entry for 2.21.2
- Bump chart version to 2.21.2

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ckelner

ckelner commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Addressed all review feedback in 1fe094c:

@tessneau - Good call on omitting sgc_path entirely. Updated to defer to OPW's built-in default (/opt/.../bin/sgc since 2.13.0). Also added CHANGELOG entry for 2.21.2 and bumped the chart version.

Fixes edge case where bootstrap.config.secret is set to an empty or
null value: dig returns a falsy value, not evaluates to true, and the
template emits a duplicate secret: block. hasKey checks key presence
regardless of the value.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@DataDog DataDog deleted a comment from chatgpt-codex-connector Bot Aug 31, 2026

@tessneau tessneau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you !

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 9a17bea into main Sep 2, 2026
37 of 38 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the ckelner/fix-opw-sgc-path-bootstrap branch September 2, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chart/observability-pipelines-worker This issue or pull request is related to the observability-pipelines-worker chart mergequeue-status: done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants