Closed rm3l closed 5 months ago
Our StatefulSet has never worked with headless service which mean only 1 replica configuration would be working correct. Indeed, to make it work correct with more than one Pod-PV it has to be headless service instead of load-balancing one.
I would not qualify it as a bug though, it is rather a limitation for local (not recommended for production) database schema and, again, it has never worked with headless service yet.
spec.serviceName should not be hardcoded. Instead, it can have a value like backstage-psql-
-hl (and this >headless service should be created by the operator as well)
I do not see why we need "-hl" and "non-hl" service here. If it will work with headless, let's leave only it (backstage-psql-
spec.template.metadata.name should not be hardcoded. Instead, it can have a value like backstage-psql-
Unfortunatelly, looks like Statefulsert does not respect it (otherwise, there were no needs in renaming SS). The template for Pod names are still
/kind bug
Follow-up issue discovered while working on https://github.com/janus-idp/operator/pull/369
What versions of software are you using?
What did you run exactly?
Run the operator against a cluster
In a separate terminal, apply any of the examples, e.g.
examples/bs1.yaml
:Inspect the local DB StatefulSet and the Services created by the operator
kubectl get service --selector=app.kubernetes.io/name=backstage,app.kubernetes.io/instance=bs1
$ kubectl get service --selector=app.kubernetes.io/name=backstage,app.kubernetes.io/instance=bs1 80/TCP 6m36s
backstage-db-bs1 ClusterIP 172.31.20.189 5432/TCP 6m36s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE backstage-bs1 ClusterIP 172.31.39.19
Expected behavior
Per the official K8s docs, a Headless Service is required for StatefulSets and must exist:
Not sure why K8s does not return an error with this non-existing service, but the expected behavior would be:
spec.serviceName
should not be hardcoded. Instead, it can have a value likebackstage-psql-<cr_name>-hl
(and this headless service should be created by the operator as well)spec.template.metadata.name
should not be hardcoded. Instead, it can have a value likebackstage-psql-<cr_name>
Any logs, error output, etc?