Skip to content
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

Allow creation of ephemeral clusters #618

Open
jberkus opened this issue Jul 15, 2019 · 11 comments · May be fixed by #2691
Open

Allow creation of ephemeral clusters #618

jberkus opened this issue Jul 15, 2019 · 11 comments · May be fixed by #2691

Comments

@jberkus
Copy link

jberkus commented Jul 15, 2019

For running tests and for local development, it would be useful if it were possible to run the operator with ephemeral storage, such as emptyDir.

I would swear that this was possible with earlier versions of the operator, but I can't find any way to do so now.

@Jan-M
Copy link
Member

Jan-M commented Jul 16, 2019

We use it locally with minikube and kind, and this is pretty ephemeral.

Maybe we need to look into how storage class config can be supported?

Otherwise for the cloud is there a difference? You want to use node local storage? I think this gets our attention once we have i3 and i3en pools of worker nodes to properly support more io heavy scenario.

@jberkus
Copy link
Author

jberkus commented Jul 16, 2019

No, I mean really ephemeral.

Node-local storage works now using hostPath and the hostPath Dynamic Provisioner. Someday in the future Kubernetes will support dynamic provisioning of LocalPV, and that'll get even simpler.

This came up because I wanted to use the postgres-operator for a training, but the learning environment doesn't support real PVs. The same situation would apply if you wanted to run automated testing on a real cluster instead of using Kind, which you would want to do if you wanted to do automated failover tests through node restart.

If it's a serious PITA, then never mind, but I'd think that it would be possible to offer a keyword that would just create emptydir()s, like "emptydir" or "ephemeral" in place of the StorageClass.

@jberkus
Copy link
Author

jberkus commented Jul 16, 2019

For that matter, outside of the test scenario, I've had clients who used Postgres as their caching layer, so there's also production reasons to support having emptydir nodes.

@Jan-M
Copy link
Member

Jan-M commented Jul 16, 2019

It is good to have the problem and the use cases outlined and then we or someone who wants to work on this can implement this. Right now we don't have this need on our mind.

I had not judged the implementation effort at all.

Thanks for the hints on the local storage, one needs to keep up with all the changes.

@jberkus
Copy link
Author

jberkus commented Jul 18, 2019

In case I write this ... is the approach of using a keyword in place of StorageClass the right approach, or do we want to add an additional field (ephemeral, defaulting to False)?

@Jan-M
Copy link
Member

Jan-M commented Jul 25, 2019

If I understand this right we would if enabled for a particular cluster have the pgdata volume not via volume claim template, but explicitly set to emptyDir volume.

volumes:
  - name: pgdata
    emptyDir: {}

So if done right the operator config would have something like:

allow_ephemeral_volumes: False(default)

And the Postgres CRD would allow for:

useEphemeralVolume: False(default)

And if bold we also have

ephemeralVolumeType: "disk" (default) or "memory"

That should be fairly straight forward to do in the generate statefulset.

(edit for proper camel case in config map and snake in crd)

@Jan-M
Copy link
Member

Jan-M commented Jul 25, 2019

Risk
How should we deal with migrations? How to deal with ephemeral to non ephemeral migration?

@neelasha-09
Copy link
Contributor

@jberkus - Please confirm if you found the solution for same :)

@cortopy
Copy link

cortopy commented Dec 5, 2022

it's been some time, but just to say there may be users like me who are also interested in this feature

@ivanov-danil
Copy link

It would be great if you'll develop an emptyDir

@jberkus
Copy link
Author

jberkus commented May 20, 2024

Nope. I'm not supporting postgres-operator in production anymore, so I never got around to writing the code for this. Someone else should take it on!

@nicholascioli nicholascioli linked a pull request Jul 12, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants