-
Notifications
You must be signed in to change notification settings - Fork 1.3k
sample-app: Add serviceName to postgresql manifest #6205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sample-app: Add serviceName to postgresql manifest #6205
Conversation
Without this, applying the manifest yields: error: error validating "db-service/200-create-postgre.yaml": error validating data: ValidationError(StatefulSet.spec): missing required field "serviceName" in io.k8s.api.apps.v1.StatefulSetSpec; if you choose to ignore these errors, turn validation off with --validate=false Signed-off-by: Guzman <guzman@guzman.fi>
✅ Deploy Preview for knative ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
/cc @Leo6Leo |
@guzalv Thanks for the PR! I have tried the original yaml file to create the StatefulSet in the cluster, it doesn't seem to have the error you have mentioned above. Could you please provide some of your tech spec (e.g your k8s version, minikube/kind, knative version etc...) so that we can figure out the reason why the error happened too you? |
Hi @Leo6Leo, thanks for your comment. Good that you noticed, this was an interesting issue:
I went to reproduce it again, and it failed, as I expected. However I noticed I was using a rather old kubectl version (1.22.5). When I upgraded to 1.30.0, to match my Kubernetes cluster, it didn't fail anymore. So even if the docs still state a serviceName is required, that is actually not enforced by recent kubectl versions: $ kubectl-1.30.0 apply -f ./code-samples/eventing/bookstore-sample-app/solution/db-service/200-create-postgre.yaml
statefulset.apps/postgresql created
$ ./kubectl-1.22.5 apply -f ./code-samples/eventing/bookstore-sample-app/solution/db-service/200-create-postgre.yaml
error: error validating "./code-samples/eventing/bookstore-sample-app/solution/db-service/200-create-postgre.yaml": error validating data: ValidationError(StatefulSet.spec): missing required field "serviceName" in io.k8s.api.apps.v1.StatefulSetSpec; if you choose to ignore these errors, turn validation off with --validate=false (Could it be that the StatefulSets' limitation of requiring a headless service is being removed?) I also checked that this PR works fine with the latest kubectl too, but I'm not familiar enough with the project to know whether it's ok/recommended/discouraged to make a change to support an older version of a tool. What do you think? |
I just tested this out and it worked without setting the @guzalv what version of k8s are you using?
|
This might be a Kubernetes bug in newer versions. I asked in k8s slack and folks were surprised by this behaviour /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso, guzalv The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @dprotaso, $ kubectl version
Client Version: v1.30.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.0 In case the Kubernetes folks want to pick this up: the conclusion from my earlier trials was that the issue lies in kubectl: 1.22.5 complains about the missing serviceName, as expected according to the docs, and 1.30.0 doesn't. Thanks for checking and merging the PR! |
To fix this error:
error: error validating "db-service/200-create-postgre.yaml": error validating data: ValidationError(StatefulSet.spec): missing required field "serviceName" in io.k8s.api.apps.v1.StatefulSetSpec; if you choose to ignore these errors, turn validation off with --validate=false