Adding auth to a running NatsCluster never rolls out #39
Labels
No labels
accessibility
bug
dependencies
documentation
duplicate
enhancement
go
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
mikluko/nats-operator#39
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adding
authto a runningNatsClusterthat has none never rolls out.The rollout waits for
Settledbefore it restarts the first server, and the cluster controller cannot observeSettleduntil a server has restarted with the new config.Steps to reproduce
NatsClusterwithoutauth, with JetStream and three servers, and wait forReadyandSettled.authwithtrustRef,systemCredentialsandaccountTrustRefs, and apply it.Observed with nats-operator 0.3.1 and nats-server 2.15.0.
What happens
The conditions stay as follows, and no server restarts:
status.rolloutkeeps all three servers pending, with the gate waiting forSettled:Why
The controller observes the cluster over the system account, with the credentials that
auth.systemCredentialsnames.A server that still runs the config without
authhas no system account, so nothing answers$SYS.REQ.SERVER.PING.STATSZ.SettledstaysUnknown, and the gate before the first restart never opens.The cluster keeps serving on the old config.
Expected
The rollout from no
authtoauthcompletes, one server at a time, as other rollouts do.Some ways to get there:
authwithout$SYS, for example from each server's monitoring port, until the servers run the new config.Workaround
Delete the
NatsClusterand the PersistentVolumeClaims of its servers, then apply it withauth.The servers start on the new config, and the JetStream data is lost.
With 0.4.0 the gate opens and the first server restarts, but the rollout still cannot finish. A server with
authand a server without it cannot route to each other.After the first restart, the restarted server stays at 1/2 ready, and its log repeats:
The servers still on the config without
authcarry the global account$Gover their routes. Under operator mode$Gis not a valid account key, so the restarted server drops every route. It cannot rejoin the cluster or the JetStream meta group, never goes Ready, and the gate before the next restart waits forSettledindefinitely:Every intermediate state of a one-server-at-a-time rollout from no
authtoauthis a split cluster, so that rollout cannot succeed whatever the gate does. It takes restarting every server together, with the outage that implies, or recreating the cluster. Observed with nats-operator 0.4.0 and nats-server 2.15.0.Reopened: 0.4.0 (#42) opens the gate, but a server with
authand one without cannot route to each other, so no one-at-a-time rollout across that boundary can finish.The fix will refuse the in-place transition: the
NatsClusterkeeps its current servers andProgressinggoes False with a reason naming the way out. An annotation will opt into restarting every server together, accepting the outage; recreating the cluster stays the other path. Removingauthwill be checked for the same split.Fix in #55: adding or removing
authon a runningNatsClusteris held withProgressingFalse, reasonAuthChangeBlocked; the annotationcluster.nats-operator.io/restart-allrestarts every server together, or recreate theNatsCluster. Removingauthsplits the same way (each side refuses the route pinned to the other's system account), so both directions are held.