Skip to content

feat: remove product config & clean up#842

Open
maltesander wants to merge 13 commits into
mainfrom
refactor/remove-product-config
Open

feat: remove product config & clean up#842
maltesander wants to merge 13 commits into
mainfrom
refactor/remove-product-config

Conversation

@maltesander
Copy link
Copy Markdown
Member

Description

  • remove product config
  • move to config map builder step
  • use default features for reqwest (0.12 -> 0.13 bump was in toml, not in lockfile). 0.13 swiched to rust-tls per default. This is reverted with default features, otherwise user-info-fetcher would fail.
  • test cluster names had to be shortened due to ClusterName type checks

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Changes are OpenShift compatible
  • CRD changes approved
  • CRD documentation for all fields, following the style guide.
  • Helm chart can be installed and deployed operator works
  • Integration tests passed (for non trivial changes)
  • Changes need to be "offline" compatible
  • Links to generated (nightly) docs added
  • Release note snippet added

Reviewer

  • Code contains useful comments
  • Code contains useful logging statements
  • (Integration-)Test cases added
  • Documentation added or updated. Follows the style guide.
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added
  • Links to generated (nightly) docs added
  • Release note snippet added
  • Add type/deprecation label & add to the deprecation schedule
  • Add type/experimental label & add to the experimental features tracker

maltesander and others added 12 commits June 4, 2026 18:24
Point operator-rs to the smooth-operator branch (which exposes the v2::
framework module) and bump tokio to 1.52 and clap to 4.6. This is the
foundation for removing the product-config dependency; existing
product-config code still compiles and all tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rewrite the validate step to produce a typed `ValidatedCluster` (name, image,
role_group_configs) instead of the product-config `ValidatedRoleConfigByPropertyKind`.
OPA never used product-config for actual config content: `compute_env/cli/files`
all returned empty maps, so the validated role config only served to enumerate
role groups and to feed the DaemonSet's env vars (which were just merged
`envOverrides`).

- validate() no longer takes a ProductConfigManager; it merges config via the
  existing `OpaCluster::merged_config()` and resolves the cluster name into the
  v2 `ClusterName` type.
- reconcile_opa iterates `role_group_configs` and sources the merged config from
  there.
- The DaemonSet builder drops the `server_config` PropertyNameKind map parameter
  and merges role/role-group `envOverrides` inline, mirroring how `cliOverrides`
  were already merged.
- Remove ProductConfigManager from Ctx and main.rs; the CLI argument is kept but
  ignored for backwards compatibility.
- Derive Ord/PartialOrd on OpaRole so it can key the role_group_configs BTreeMap.

The product-config crate dependency and the now-unused Configuration /
KeyValueOverridesProvider impls are removed in a follow-up commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move the rolegroup ConfigMap and `config.json` building out of the controller
into a dedicated `controller/build/config_map.rs`. The build step now takes the
`ValidatedCluster` and only uses the `OpaCluster` for the owner reference and
object metadata, no longer reading `spec` for config content.

To carry the merged `configOverrides` through `ValidatedCluster`, migrate
`OpaConfigOverrides.config_json` from the non-mergeable
`config_overrides::JsonConfigOverrides` to the v2
`JsonOrKeyValueConfigOverrides`, which:
- implements `Merge`, so role- and role-group-level overrides are merged once in
  the validate step (role group wins) and stored on `OpaRoleGroupConfig`;
- preserves the previous apply order (role patch first, then role group on top)
  via the v2 `JsonConfigOverrides` sequence;
- applies infallibly, removing the config-override error path;
- is CRD-safe (raw object schema), unlike the v2 `JsonConfigOverrides` enum whose
  `JsonPatch` variant cannot be rendered into a structural CRD schema.

`ValidatedCluster` gains a `cluster_config` holding `user_info` so the ConfigMap
build no longer needs the raw spec for `user-info-fetcher.json`.

Add unit tests covering the default `config.json` and role/role-group override
precedence. Regenerate extra/crds.yaml.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the now-dead `impl Configuration for OpaConfigFragment` and
`impl KeyValueOverridesProvider for OpaConfigOverrides` (both no-ops kept only to
satisfy the product-config pipeline, which is no longer used), and remove the
`product-config` crate from the workspace and operator-binary manifests.

OPA never derived real config from product-config, so nothing is lost. The empty
`deploy/config-spec/properties.yaml` is kept (it is still mounted by the Docker
image and Helm chart) and normalized to match the other operators.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Introduce `controller/build/properties/` with one build step per config file and
a `ConfigFileName` enum, mirroring trino/hdfs (adapted for OPA's JSON files, so
the builders return serialized `String`s and there is no key-value writer).

- `properties/config_json.rs`: the `config.json` builder (the former
  `build_config_file` plus the `OpaClusterConfigFile` struct family) with its own
  error type and the default/override-precedence unit tests.
- `properties/user_info_fetcher.rs`: serializes `user-info-fetcher.json`.
- `properties/mod.rs`: the `ConfigFileName` enum and a shared
  `test_support::validated_cluster_from_spec` helper.
- `config_map.rs` shrinks to metadata + dispatch + assembly, wrapping the
  per-file builder errors.

The Vector config file keeps coming from the existing logging call for now; it is
folded into the build step in a follow-up commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move the Vector config building and the `BundleBuilderLogLevel` mapping out of the
top-level `product_logging` module into `controller/build/properties/logging.rs`,
mirroring hdfs. `build_vector_config` returns `Option<String>` (the agent config or
`None` when disabled) and is infallible, so the dead `InvalidLoggingConfig` error
path is dropped. The DaemonSet now imports `BundleBuilderLogLevel` from the build
module, and the standalone `product_logging.rs` is removed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move discovery.rs into controller/build/discovery.rs and refactor
build_discovery_config_map to take the ValidatedCluster + role Service +
cluster_info, reading the TLS scheme/port and secret class from
cluster_config and the app version from the resolved image. The owner object
is used only for the owner reference and object metadata.

ValidatedClusterConfig gains a `tls` field (alongside `user_info`), mirroring
trino/hdfs. The discovery ConfigMap name now comes from `cluster.name`, which
finally consumes that field and removes its `#[allow(dead_code)]`.

Adds unit tests asserting the discovery URL (http/https + port) and the
OPA_SECRET_CLASS entry with and without TLS.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant