postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

Direct CRD yaml edition issue

Open lkhomenk opened this issue 7 years ago • 10 comments

** Which example are you working with? ** Docs for 3.5 tells: "Metadata about the Postgres cluster deployments are stored within these CRD resources which act as the source of truth for the Operator." But direct edit on pgcluster CRD doesn't apply any changes. Is there any possible way to interact with postgres-operator w/o pgo tool? but same issue - updating cluster with pgo scale doesn't apply any changes to pgcluster yaml What is the current behavior? no update for CRD object after manual yaml edition What is the expected behavior? operator supposed to pick up updates and apply them. pgo tool should update crd yaml too Other information (e.g. detailed explanation, related issues, etc) Operator log after yaml edition: level=debug msg="pgcluster test updated" and that's all Please tell us about your environment:

  • Operating System: Fedora 29 + minishift(openshift v3.11.0+1a90c5c-83)
  • Where is this running ( Local , Cloud Provider) : local
  • Storage being used (NFS, Hostpath, Gluster, etc): hostpath
  • Container Image Tag: centos7-3.5.0-rc4
  • PostgreSQL Version: centos7-11.1-2.3.0-rc3
  • Platform (Docker, Kubernetes, OpenShift): Minishift
  • Platform Version: v1.29.0+72fa7b2

lkhomenk avatar Jan 14 '19 13:01 lkhomenk

@jmccormick2001 Could you please suggest anything here?

lkhomenk avatar Jan 25 '19 10:01 lkhomenk

I'll try this today.

jmccormick2001 avatar Jan 25 '19 14:01 jmccormick2001

https://github.com/CrunchyData/postgres-operator/tree/develop/examples/create-by-resource

that seems to work for me, give it a try and let me know your results. regards.

jmccormick2001 avatar Jan 25 '19 15:01 jmccormick2001

Hi Jeff,

This is a significant ease-of-use improvement over the pgo client from my perspective. Thanks, Note that I will give it a try and provide feedback.

In the documentation, please be careful to distinguish between Custom Resources Definitions (CRDs) and Custom Resources as instances of CRDs. For example, the documentation https://github.com/CrunchyData/postgres-operator/blob/develop/examples/create-by-resource/NOTES.md#pgcluster-crd includes the following statement which I find confusing:

To cause the Operator to create a Postgres cluster, it is looking for a pgcluster CRD to be created...

It is my understanding that the actual pgcluster CRD is created here: https://github.com/CrunchyData/postgres-operator/blob/6807fbf110080078cecca74a037d7d6d126006b4/deploy/crd.yaml#L22 as part of the Operator installation. The NOTES.md document OTOH, is creating a Pgcluster Custom Resource and not a pgclusters.cr.client-go.k8s.io CustomResourceDefinition. Does that make sense?

Finally, I would recommend that the following example Pgcluster Custom Resource creation file use yaml instead of json: https://github.com/CrunchyData/postgres-operator/blob/develop/examples/create-by-resource/fromcrd.json. Most of the operator documentation I have seen use yaml to create Custom Resources rather than json.

Thanks again,

Ron

ron1 avatar Jan 25 '19 15:01 ron1

@jmccormick2001 that's a bit another case. I meant more something like: 1)create pgcluster test_pg - with pgo or from yamls with replica 1 2)go and edit pgcluster test_pg object - oc edit pgclusters.cr.client-go.k8s.io test_pg set spec.replicas=3 3.1)postgres_operator just notices that cluster level=debug msg="pgcluster test_pg updated" , without making any changes alternatively: 3.2)scale up +1 replica test_pg with pgo - verify changes oc get pgclusters.cr.client-go.k8s.io test_pg -o yaml - replica count is still 3

Which means that metadata of CRDs is not a golden source of truth. or maybe there's another metadata I could miss.

lkhomenk avatar Jan 27 '19 21:01 lkhomenk

@lkhomenk, according to https://github.com/CrunchyData/postgres-operator/blob/develop/examples/create-by-resource/fromcrd.json, spec.replicas (with an 's') is the metadata field to control the number of replicas and not spec.replica which you mention in your comment. Was the use of "replica" vs "replicas" a typo in your above comment?

ron1 avatar Jan 29 '19 03:01 ron1

@ron1 you are right. I made a typo.it should be replicas.

lkhomenk avatar Jan 29 '19 10:01 lkhomenk

replicas are defined in the pgreplica CRD, that replicas field in pgclusters defines the initial request for replicas for the cluster when a user specifies --replica-count. cheers.

On Tue, Jan 29, 2019 at 4:11 AM Leo Khomenko [email protected] wrote:

@ron1 https://github.com/ron1 you are right. I made a typo.it should be replicas.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/CrunchyData/postgres-operator/issues/537#issuecomment-458483151, or mute the thread https://github.com/notifications/unsubscribe-auth/AA0r66Y-XXEfYnsA7ohJUR7oxQewHeapks5vIB5JgaJpZM4Z-QG6 .

-- Jeff McCormick [email protected] 843-327-5754 / Dallas-Fort Worth

jmccormick2001 avatar Jan 29 '19 14:01 jmccormick2001

@jmccormick2001 amount of replicas is just an example, which shows that pgcluster yaml is not a golden source of truth. It means that yamls just show initial state of the object and any further editions of the object do not apply any changes

lkhomenk avatar Jan 29 '19 14:01 lkhomenk

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 30 '19 14:03 stale[bot]