Skip to content

Commit

Permalink
Fix merging for zone definitions
Browse files Browse the repository at this point in the history
Without this commit, setting `metadata.labels` on a zone would delete
some important metadata such as `metadata.name`. To avoid this, we call
`com.makeMergeable()` on the user-provided partial zone object.
  • Loading branch information
simu committed Nov 14, 2024
1 parent e57cb44 commit 495f986
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ local params = inv.parameters.control_api;


local zones = [
controlApi.Zone(name) + params.zones[name] {
controlApi.Zone(name) +
com.makeMergeable(params.zones[name]) {
metadata+: {
labels+: common.DefaultLabels,
},
Expand Down
3 changes: 3 additions & 0 deletions tests/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ parameters:
zones:
example-zone-1:
metadata:
labels:
control.appuio.io/zone-cluster-id: c-appuio-example1
data:
displayName: Example Zone 1
features:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ metadata:
app.kubernetes.io/component: control-api
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: control-api
control.appuio.io/zone-cluster-id: c-appuio-example1
name: example-zone-1
name: example-zone-1
---
Expand Down

0 comments on commit 495f986

Please sign in to comment.