-
Notifications
You must be signed in to change notification settings - Fork 623
Attach additional volume for postgres #4210
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
Attach additional volume for postgres #4210
Conversation
pkg/apis/postgres-operator.crunchydata.com/v1beta1/postgrescluster_types.go
Outdated
Show resolved
Hide resolved
pkg/apis/postgres-operator.crunchydata.com/v1beta1/postgrescluster_types.go
Outdated
Show resolved
Hide resolved
pkg/apis/postgres-operator.crunchydata.com/v1beta1/postgrescluster_types.go
Outdated
Show resolved
Hide resolved
pkg/apis/postgres-operator.crunchydata.com/v1beta1/postgrescluster_types.go
Show resolved
Hide resolved
d9d4932
to
f906775
Compare
pkg/apis/postgres-operator.crunchydata.com/v1beta1/postgrescluster_types.go
Outdated
Show resolved
Hide resolved
pkg/apis/postgres-operator.crunchydata.com/v1beta1/postgrescluster_types.go
Outdated
Show resolved
Hide resolved
pkg/apis/postgres-operator.crunchydata.com/v1beta1/postgrescluster_types.go
Outdated
Show resolved
Hide resolved
pkg/apis/postgres-operator.crunchydata.com/v1/postgrescluster_types.go
Outdated
Show resolved
Hide resolved
88d226d
to
955087a
Compare
Change the API to allow users to specify preexisting PVCs to attach to specified containers in the postgres instance pods. Issues: [PGO-2556]
955087a
to
0f1cf63
Compare
testing/kuttl/e2e/additional-volumes/files/00-cluster-created.yaml
Outdated
Show resolved
Hide resolved
22ab593
to
a7ea055
Compare
// | ||
// +kubebuilder:validation:MinLength=1 | ||
// Max length is less than max 63 to allow prepending `volumes-` to name | ||
// +kubebuilder:validation:MaxLength=55 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Can this be 63 here and AdditionalVolume.Name
override it with 55 there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the spec that results in name having the reqs:
allOf:
- maxLength: 63
- maxLength: 55
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting!
ClaimName string `json:"claimName"` | ||
|
||
// The containers to attach this volume to. | ||
// A blank/unset `Containers` field matches all containers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Where did we land on empty-list? Does it mean all or none?
📝 I've used the phrase "when omitted" or "when this is omitted" to explain what happens when a field is missing from the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't quite understand the use-case for adding a volume that is not mounted into any containers... But I could see how a zero value (empty list) could mean "none" while leaving the field off entirely would mean "all"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the issue is still up for debate, to wit:
- what is the use care for attaching to none? (My squinting suggestion is: you have the volume defined in your sidecar definition and for whatever reason, it's easier to leave it there than to put it into our spec)
- what is the best way to signal none vs. all? I agree that an explicit "[]" looks more like none than leaving the field off, but that's a real thin line.
Ah, what the heck, let's do it.
pkg/apis/postgres-operator.crunchydata.com/v1beta1/postgrescluster_types.go
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
missingContainers = append(missingContainers, names.UnsortedList()...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 Using Delete
to subtract from names
relies on init and regular containers having unique names together. That's correct and fine, but I wonder if it is worth calling out.
🤔 Should the resulting slice be a Set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was about to raise this concern myself... Is it correct though, when you take sidecars into consideration? Couldn't the user add a sidecar to Containers
that has the same name as one in InitContainers
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answering my own question: No, the user could not add a sidecar with the same name as an init container. Ben tried it out and the Pod fails to roll out. He also found this in k8s documentation: “The name of each app and init container in a Pod must be unique; a validation error is thrown for any container sharing a name with another.”
config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml
Outdated
Show resolved
Hide resolved
Co-authored-by: Drew Sessler <36803518+dsessler7@users.noreply.github.com>
Checklist:
Type of Changes:
What is the current behavior (link to any open issues here)?
Only can add additional volumes to database container through abuse of the tablespace volumes.
What is the new behavior (if this is a feature change)?
Ability to add PVC (either BYO or create from template) to multiple containers in the Postgres pod
Other Information:
Issues: [PGO-2556]