Skip to content

Commit a26e1bd

Browse files
feat(apps): mark objects whose children exclude each other atomic
The worker image of a node pool takes one of builtin and factory, a vm-disk source one of disk, http, image and upload, and a kubernetes oidc customConfig one of config and secretRef, and each chart refuses a spec that sets two. An installation default for one child merged into an application that chose another built exactly that spec, and nothing warned at create time. The x-kubernetes-map-type: atomic marker makes the defaults merge replace the object whole. Nothing else reads it, so existing applications render as before. The tests run the merge against the three real schemas. Assisted-by: LLM Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 70280d0 commit a26e1bd

12 files changed

Lines changed: 93 additions & 11 deletions

File tree

‎api/apps/v1alpha1/kubernetesnodes/types.go‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/apps/kubernetes-nodes/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ the parent cluster `kubernetes-<cluster>` in the same namespace, plus a
7272

7373
| Name | Description | Type | Value |
7474
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------ |
75-
| `osImage` | Worker OS image source for this pool. Default (omitted): import over HTTP from the `talos.*` Image Factory. Set `osImage.builtin` to clone a golden from the opt-in worker image catalog instead. Editing this on an existing pool re-images that pool. | `object` | `{}` |
75+
| `osImage` | Worker OS image source for this pool. Default (omitted): import over HTTP from the `talos.*` Image Factory. Set `osImage.builtin` to clone a golden from the opt-in worker image catalog instead. Editing this on an existing pool re-images that pool. The object is atomic: its two sources exclude each other, so a value that sets one of them replaces the whole object and is never completed from a default. | `object` | `{}` |
7676
| `osImage.builtin` | Clone a golden image from the worker image catalog. Requires a StorageClass whose volumes are reachable from any node, in practice a replicated/DRBD class: the clone is a storage-layer copy, and on a node-pinned class its two ends land on unrelated nodes -- the golden binds where CDI imported it, a worker disk where its VM is scheduled. | `*object` | `null` |
7777
| `osImage.builtin.schematicID` | Talos schematic ID of the golden to clone. Defaults to `talos.schematicID`. | `string` | `""` |
7878
| `osImage.builtin.version` | Talos version of the golden to clone. Defaults to `talos.version`. | `string` | `""` |

‎packages/apps/kubernetes-nodes/values.schema.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245
]
246246
},
247247
"osImage": {
248-
"description": "Worker OS image source for this pool. Default (omitted): import over HTTP from the `talos.*` Image Factory. Set `osImage.builtin` to clone a golden from the opt-in worker image catalog instead. Editing this on an existing pool re-images that pool.",
248+
"description": "Worker OS image source for this pool. Default (omitted): import over HTTP from the `talos.*` Image Factory. Set `osImage.builtin` to clone a golden from the opt-in worker image catalog instead. Editing this on an existing pool re-images that pool. The object is atomic: its two sources exclude each other, so a value that sets one of them replaces the whole object and is never completed from a default.",
249249
"type": "object",
250250
"default": {},
251251
"properties": {
@@ -281,7 +281,8 @@
281281
}
282282
}
283283
}
284-
}
284+
},
285+
"x-kubernetes-map-type": "atomic"
285286
},
286287
"talos": {
287288
"description": "Talos worker image configuration. Keep in sync with the parent cluster's `talos`.",

‎packages/apps/kubernetes-nodes/values.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ version: "v1.35"
131131
## @field {*WorkerImageBuiltin} [builtin] - Clone a golden image from the worker image catalog. Requires a StorageClass whose volumes are reachable from any node, in practice a replicated/DRBD class: the clone is a storage-layer copy, and on a node-pinned class its two ends land on unrelated nodes -- the golden binds where CDI imported it, a worker disk where its VM is scheduled.
132132
## @field {*WorkerImageFactory} [factory] - Import from an Image Factory / mirror (default).
133133

134-
## @param {WorkerImage} [osImage] - Worker OS image source for this pool. Default (omitted): import over HTTP from the `talos.*` Image Factory. Set `osImage.builtin` to clone a golden from the opt-in worker image catalog instead. Editing this on an existing pool re-images that pool.
134+
## @param {WorkerImage} [osImage] - Worker OS image source for this pool. Default (omitted): import over HTTP from the `talos.*` Image Factory. Set `osImage.builtin` to clone a golden from the opt-in worker image catalog instead. Editing this on an existing pool re-images that pool. The object is atomic: its two sources exclude each other, so a value that sets one of them replaces the whole object and is never completed from a default.
135+
## @x-kubernetes-map-type atomic
135136
osImage: {}
136137

137138
## @typedef {struct} Talos - Talos worker image configuration.

‎packages/apps/kubernetes/values.schema.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,8 @@
10231023
}
10241024
}
10251025
}
1026-
}
1026+
},
1027+
"x-kubernetes-map-type": "atomic"
10271028
},
10281029
"mode": {
10291030
"description": "Identity mode. `None`: no OIDC, only the static admin kubeconfig works. `System`: trust the platform Keycloak realm (`cozy` by default) via a per-cluster public client with audience binding; zero-config default. `CustomConfig`: trust a tenant-supplied issuer directly (BYO); `cozy` is not in the path.",

‎packages/apps/kubernetes/values.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ talos:
388388
## @typedef {struct} OIDC - OIDC selector for the tenant cluster (Phase 1 — per-cluster audience binding; no per-tenant Keycloak realm).
389389
## @field {OIDCMode} mode - Identity mode. `None`: no OIDC, only the static admin kubeconfig works. `System`: trust the platform Keycloak realm (`cozy` by default) via a per-cluster public client with audience binding; zero-config default. `CustomConfig`: trust a tenant-supplied issuer directly (BYO); `cozy` is not in the path.
390390
## @field {OIDCCustomConfig} [customConfig] - Tenant-supplied AuthenticationConfiguration; consumed only when `mode: CustomConfig`.
391+
## @x-kubernetes-map-type atomic
391392
## @field {[]OIDCUser} [users] - Users granted access to the tenant cluster; each entry produces one ClusterRoleBinding inside the tenant cluster. Works for both `System` and `CustomConfig` modes.
392393

393394
## @param {OIDC} oidc - OIDC authentication and per-user RBAC for the tenant kube-apiserver. See https://cozystack.io/docs/v1.6/kubernetes/oidc-authentication/ for the operator guide.

‎packages/apps/vm-disk/values.schema.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
"rule": "self == oldSelf",
6060
"message": "source is immutable"
6161
}
62-
]
62+
],
63+
"x-kubernetes-map-type": "atomic"
6364
},
6465
"optical": {
6566
"description": "Defines if disk should be considered optical.",

‎packages/apps/vm-disk/values.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
## @field {*SourceDisk} [disk] - Clone an existing vm-disk.
2222

2323
## @param {Source} source - The source image location used to create a disk.
24+
## @x-kubernetes-map-type atomic
2425
## @immutable
2526
source: {}
2627

‎packages/system/kubernetes-nodes-rd/cozyrds/kubernetes-nodes.yaml‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/system/kubernetes-rd/cozyrds/kubernetes.yaml‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)