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

Add SubPathExpr option for additionalVolumes #2463

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smutel
Copy link

@smutel smutel commented Oct 30, 2023

Fix #2464

@smutel
Copy link
Author

smutel commented Oct 30, 2023

SubPathExpr and SubPath are mutually exclusive => I don't know how to implement this. Tell me if you have an idea.

@micabe
Copy link

micabe commented Nov 9, 2023

Hey @hughcapet,
Can we merge this PR ? It's a useful option to have.
Thanx

@rds13
Copy link

rds13 commented Nov 9, 2023

👍
Nice addition.

Name: additionalVolume.Name,
MountPath: additionalVolume.MountPath,
SubPath: additionalVolume.SubPath,
SubPathExpr: additionalVolume.SubPathExpr,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If SubPath and SubPathExpr are mutually exclusive they cannot coexist here, right?

@FxKu
Copy link
Member

FxKu commented Nov 13, 2023

This PR is still lacking a few things. The CDR needs to be extended here and here. If the SubPath and SubPathExpr are mutually exclusive you can use OneOf syntax, I think. So far, we are not using it anywhere so you have to search for examples online.

When adding fields to the Postgres CRD, please also run code generation (./hack/update-codegen.sh). And mind that we also have the helm chart, where this new feature has to be addressed, too.

@FxKu FxKu added this to the 2.0 milestone Nov 13, 2023
@smutel
Copy link
Author

smutel commented Nov 21, 2023

Hello @FxKu,

Thank you for you review.
I did the changes you ask me (I hope).

@smutel smutel force-pushed the AddSubPathExpr branch 3 times, most recently from 25bc8cc to a106df3 Compare November 22, 2023 07:44
@smutel
Copy link
Author

smutel commented Nov 22, 2023

I am facing this kubernetes/apimachinery#18.

@smutel
Copy link
Author

smutel commented Nov 23, 2023

Sounds good now.

@smutel smutel requested a review from FxKu November 28, 2023 10:20
@smutel
Copy link
Author

smutel commented Dec 5, 2023

Any news on this ?

@FxKu
Copy link
Member

FxKu commented Jan 25, 2024

@smutel e2e tests are failing. There's an issue with the CRD schema:

spec.validation.openAPIV3Schema.properties[spec].properties[additionalVolumes].items.oneOf[0].properties[subPath].type: Forbidden: must be empty to be structural, 
spec.validation.openAPIV3Schema.properties[spec].properties[additionalVolumes].items.oneOf[1].properties[subPathExpr].type: Forbidden: must be empty to be structural

@smutel
Copy link
Author

smutel commented Jan 25, 2024

CRDs updated.

@FxKu
Copy link
Member

FxKu commented Jan 25, 2024

Btw. I have just noticed that you did not add any logic to the Go code. It's not enough to just add a new field to the CRD. We use a lot of custom logic and not so much K8s specs. In this case the new SubPathExpr muss be set in generateVolumeMounts function. I would like to see a unit test then to check if the new expression is set when specified.

Sorry for suggesting oneOf here as both fields are optional. It's more typical when you have a required type field which specifies different options. You could even put the SubPathExpr in the SubPath field and use an extra bool flag isSubPathExpr. That makes implementation more straight forward. Hope you understand what I mean here.

@FxKu FxKu modified the milestones: 1.11.0, 2.0 Jan 25, 2024
@smutel
Copy link
Author

smutel commented Jan 29, 2024

I changed my PR regarding your suggestion with boolean.
Perhaps the default value for this boolean is missing but I don't know where to specify this.

@smutel smutel force-pushed the AddSubPathExpr branch 4 times, most recently from bdb32bc to cef0f05 Compare January 29, 2024 13:41
pkg/cluster/k8sres_test.go Outdated Show resolved Hide resolved
@smutel
Copy link
Author

smutel commented Feb 19, 2024

Looks good to you ?

@smutel
Copy link
Author

smutel commented Mar 13, 2024

Any update on this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Open Questions
Development

Successfully merging this pull request may close these issues.

No option SubPathExpr for additionalVolumes
4 participants