Skip to content

fix(commander): echo registry_mode on cluster update - #59

Open
duckhawk wants to merge 1 commit into
mainfrom
fix/commander-registry-mode-on-update
Open

fix(commander): echo registry_mode on cluster update#59
duckhawk wants to merge 1 commit into
mainfrom
fix/commander-registry-mode-on-update

Conversation

@duckhawk

Copy link
Copy Markdown
Member

Symptom

Every SetMasterCount call in the sds-object suite failed — 5 runs, different clusters, never once succeeded — with a 500 whose body was a raw PostgreSQL error:

PG::NotNullViolation: ERROR:  null value in column "registry_mode"
of relation "cluster_configs" violates not-null constraint

It fails immediately, before any convergence wait, so the two specs that resize the control plane never got to test anything.

Cause

Confirmed by the Commander team: PUT /clusters/:id is a wholesale replace, so a field the request omits is written as NULL — and registry_mode is NOT NULL in cluster_configs. POST /clusters does not need it (the API defaults it there), which is why cluster bootstrap always worked and only updates failed.

Our client never sent the field, and did not even model it: ClusterResponse carried registry_id but no registry_mode, so the value was discarded on the GET we build the PUT from.

Fix

registry_mode is read with the rest of the cluster and echoed back on update.

The cluster's own value is preserved rather than a constant: a cluster can legitimately be Unmanaged, and unconditionally sending Direct would repoint its registry. When the API reports no mode at all, Direct is sent — Commander's default for a cluster pulling from the configured registry — because omitting the field fails the update outright.

Tests

TestUpdateClusterValues_EchoesRegistryMode: the PUT body carries the mode returned by the by-id read (Unmanaged stays Unmanaged), and the Direct fallback applies only when the API reports none.

@duckhawk
duckhawk force-pushed the fix/commander-registry-mode-on-update branch from 4b35dd4 to 0decdc7 Compare July 29, 2026 08:50
duckhawk added a commit to deckhouse/sds-object that referenced this pull request Jul 29, 2026
The pin bumped in the previous commit does not decide which harness code runs: the
reusable pipeline checks storage-e2e out into _storage-e2e and the run script
applies `go mod edit -replace` onto that checkout, so the suite always ran
storage-e2e main — which is why the run on the bumped pin failed the master-count
specs with the same Commander 500 as before.

Point storage_e2e_ref at the branch of deckhouse/storage-e2e#59 so the run actually
exercises the fix. Back to main once it is merged; the go.mod pin follows.

Signed-off-by: v.oleynikov <vasily.oleynikov@flant.com>
Every SetMasterCount call in the sds-object suite failed with a 500 whose body was
a raw PostgreSQL error:

    PG::NotNullViolation: null value in column "registry_mode"
    of relation "cluster_configs" violates not-null constraint

Confirmed by the Commander team: PUT /clusters/:id is a wholesale replace, so a
field the request omits is written as NULL — and registry_mode is NOT NULL. Create
does not need it (the API defaults it there), which is why bootstrap always worked
and only updates failed.

The client now reads registry_mode with the rest of the cluster and sends it back.
The cluster's own value is preserved rather than a constant: a cluster can
legitimately be Unmanaged, and sending Direct would repoint its registry. When the
API reports no mode at all, Direct is sent — the default for a cluster pulling from
the configured registry — because omitting it fails the update outright.

Tested: the PUT body carries the mode from the by-id read, and the fallback applies
only when the API reports none.

Signed-off-by: v.oleynikov <vasily.oleynikov@flant.com>
@duckhawk
duckhawk force-pushed the fix/commander-registry-mode-on-update branch from 0decdc7 to 7fa963a Compare July 29, 2026 13:30
@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Health
github.com/deckhouse/storage-e2e/internal/cluster 0%
github.com/deckhouse/storage-e2e/internal/config 56%
github.com/deckhouse/storage-e2e/internal/infrastructure/ssh 0%
github.com/deckhouse/storage-e2e/internal/infrastructure/ssh/v2 80%
github.com/deckhouse/storage-e2e/internal/kubernetes/clusterlock 75%
github.com/deckhouse/storage-e2e/internal/kubernetes/commander 54%
github.com/deckhouse/storage-e2e/internal/kubernetes/deckhouse 0%
github.com/deckhouse/storage-e2e/internal/kubernetes/kubeaccess 78%
github.com/deckhouse/storage-e2e/internal/kubernetes/storage 0%
github.com/deckhouse/storage-e2e/internal/kubernetes/virtualization 0%
github.com/deckhouse/storage-e2e/internal/logger 53%
github.com/deckhouse/storage-e2e/internal/provisioning/commander 23%
github.com/deckhouse/storage-e2e/internal/provisioning/dvp 63%
github.com/deckhouse/storage-e2e/internal/provisioning/dvp/vm 78%
github.com/deckhouse/storage-e2e/pkg/cluster 4%
github.com/deckhouse/storage-e2e/pkg/clusterprovider 89%
github.com/deckhouse/storage-e2e/pkg/clusterprovider/registry 100%
github.com/deckhouse/storage-e2e/pkg/commander 0%
github.com/deckhouse/storage-e2e/pkg/e2e 41%
github.com/deckhouse/storage-e2e/pkg/kubernetes 5%
github.com/deckhouse/storage-e2e/pkg/retry 94%
github.com/deckhouse/storage-e2e/pkg/storage-e2e 0%
github.com/deckhouse/storage-e2e/pkg/testkit 5%
Summary 24% (3823 / 15831)

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