Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/stackable-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ All notable changes to this project will be documented in this file.
### Fixed

- [v2] Don't require the `attributed_string_type` macro caller to have `std::str::FromStr` in scope ([#1244]).
- [v2] Fix the JSON schema of `JsonConfigOverrides` ([#1245]).

[#1244]: https://github.com/stackabletech/operator-rs/pull/1244
[#1245]: https://github.com/stackabletech/operator-rs/pull/1245

## [0.113.2] - 2026-07-07

Expand Down
26 changes: 14 additions & 12 deletions crates/stackable-operator/crds/DummyCluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ spec:
- required:
- jsonMergePatch
- required:
- jsonPatches
- jsonPatch
- required:
- userProvided
properties:
Expand All @@ -989,22 +989,23 @@ spec:
[RFC 7396](https://datatracker.ietf.org/doc/html/rfc7396) JSON merge patch.
type: object
x-kubernetes-preserve-unknown-fields: true
jsonPatches:
jsonPatch:
description: |-
List of [RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902) JSON patches.
An [RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902) JSON patch.

Can be used when more flexibility is needed, e.g. to only modify elements
in a list based on a condition.

A patch looks something like

`{"op": "test", "path": "/0/name", "value": "Andrew"}`
`- {"op": "test", "path": "/0/name", "value": "Andrew"}`

or

`{"op": "add", "path": "/0/happy", "value": true}`
`- {"op": "add", "path": "/0/happy", "value": true}`
items:
type: string
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
userProvided:
description: |-
Expand Down Expand Up @@ -1657,7 +1658,7 @@ spec:
- required:
- jsonMergePatch
- required:
- jsonPatches
- jsonPatch
- required:
- userProvided
properties:
Expand All @@ -1667,22 +1668,23 @@ spec:
[RFC 7396](https://datatracker.ietf.org/doc/html/rfc7396) JSON merge patch.
type: object
x-kubernetes-preserve-unknown-fields: true
jsonPatches:
jsonPatch:
description: |-
List of [RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902) JSON patches.
An [RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902) JSON patch.

Can be used when more flexibility is needed, e.g. to only modify elements
in a list based on a condition.

A patch looks something like

`{"op": "test", "path": "/0/name", "value": "Andrew"}`
`- {"op": "test", "path": "/0/name", "value": "Andrew"}`

or

`{"op": "add", "path": "/0/happy", "value": true}`
`- {"op": "add", "path": "/0/happy", "value": true}`
items:
type: string
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
userProvided:
description: |-
Expand Down
33 changes: 30 additions & 3 deletions crates/stackable-operator/src/v2/config_overrides.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ use serde_json::json;
use tracing::warn;

use crate::{
config::merge::Merge, k8s_openapi::DeepMerge, schemars, utils::crds::raw_object_schema,
config::merge::Merge,
k8s_openapi::DeepMerge,
schemars,
utils::crds::{raw_object_list_schema, raw_object_schema},
};

// Variant of [`crate::config_overrides::KeyValueConfigOverrides`] that implements
Expand Down Expand Up @@ -93,10 +96,34 @@ pub enum JsonConfigOverrides {
/// or
///
/// `- {"op": "add", "path": "/0/happy", "value": true}`
#[schemars(schema_with = "raw_object_schema")]
#[schemars(schema_with = "raw_object_list_schema")]
JsonPatch(json_patch::Patch),

/// Override the entire config file with the specified JSON value.
/// Override the entire config file with the specified JSON document.
///
/// Please note that you can in-line JSON into YAML as follows:
///
/// ```yaml
/// # ... other YAML content
/// userProvided: {
/// "myString": "test",
/// "myList": ["test"],
/// "myBool": true,
/// "my": {"nested.field.with.dots": 42}
/// }
/// ```
///
/// As an alternative you can also stick to YAML:
///
/// ```yaml
/// # ... other YAML content
/// userProvided:
/// myString: test
/// myList: [test]
/// myBool: true
/// my:
/// nested.field.with.dots: 42
/// ```
#[schemars(schema_with = "raw_object_schema")]
UserProvided(serde_json::Value),

Expand Down
8 changes: 6 additions & 2 deletions crates/xtask/src/crd/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ use serde::{Deserialize, Serialize};
use stackable_operator::{
commons::resources::{JvmHeapLimits, Resources},
config::fragment::Fragment,
config_overrides::{JsonConfigOverrides, KeyValueConfigOverrides, KeyValueOverridesProvider},
crd::{authentication, authentication::oidc, git_sync::v1alpha2::GitSync},
config_overrides::{KeyValueConfigOverrides, KeyValueOverridesProvider},
crd::{
authentication::{self, oidc},
git_sync::v1alpha2::GitSync,
},
database_connections::{
databases::{
derby::DerbyConnection, mysql::MysqlConnection, postgresql::PostgresqlConnection,
Expand All @@ -21,6 +24,7 @@ use stackable_operator::{
role_utils::Role,
schemars::JsonSchema,
status::condition::ClusterCondition,
v2::config_overrides::JsonConfigOverrides,
versioned::versioned,
};
use strum::EnumIter;
Expand Down