Skip to content

Publish prebuilt operator-render binaries (e.g. as GitHub Release assets) #3522

Description

@cyrille-leclerc

Description

operator-render (the CLI that renders a DatadogAgent CRD into the plain Kubernetes manifests the Operator would apply, without needing a live cluster) is very useful for generating documentation/examples and for CI checks that diff rendered output. Today the only way to get it is to clone the repo and run make build-renderer yourself.

It would help downstream consumers a lot if prebuilt operator-render executables were published as release artifacts (e.g. attached to GitHub Releases, one per OS/arch, alongside the existing datadog-operator/datadog-operator-init release binaries), instead of requiring a local build.

Why

We use operator-render in a Makefile target to keep a set of example DatadogAgent manifests up to date in DataDog/opentelemetry-examples (see guides/kubernetes/configuration/opentelemetry-kube-stack/Makefile). Building it locally has a couple of rough edges that a published binary would sidestep:

  1. It requires a full git clone of datadog-operator plus a Go toolchain just to render a single YAML file — heavier than the task needs.
  2. The binary bakes an absolute, compile-time path to the DDAI CRD YAML file into itself (via runtime.Caller), so it only works when run from the exact same filesystem path it was built in/against. Building it in one location (e.g. a scratch clone) and copying the binary elsewhere breaks it with an error like:
    error: reading DDAI CRD at /path/from/build/time/config/crd/bases/v1/datadoghq.com_datadogagentinternals.yaml: open ...: no such file or directory
    
    A published, self-contained release binary (with the CRD embedded via go:embed rather than a runtime.Caller-derived path, if that's not already the case) would avoid this footgun entirely for anyone consuming the tool rather than developing the Operator itself.

Suggested solution

  • Add operator-render to the project's release pipeline so a binary per OS/arch is published for each datadog-operator release (GitHub Release assets, similar to how other Operator binaries are distributed).
  • If not already the case, embed the CRD YAML(s) operator-render reads (e.g. via go:embed) instead of resolving them from a runtime.Caller-derived filesystem path, so the published binary is portable and doesn't depend on where/how it was built.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions