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

volume: Add support for volume size and env variable overrides (PROJQUAY-1090) #586

Merged
merged 1 commit into from
Dec 3, 2021

Conversation

jonathankingfc
Copy link
Collaborator

@jonathankingfc jonathankingfc commented Nov 4, 2021

  • Add overrides to component spec
  • Add volumeSize to overrides spec field

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

See the ticket for this pull request: https://issues.redhat.com/browse/PROJQUAY-1090

@dmesser
Copy link
Contributor

dmesser commented Nov 4, 2021

I propose to add arbitrary labels as well. This will help with a lot of use cases where customers want to leverage labels to base automation and customization upon. One particular example is router sharding in OpenShift (https://docs.openshift.com/container-platform/4.9/networking/ingress-operator.html#nw-ingress-sharding-route-labels_configuring-ingress)

ComponentMirror = "mirror"
ComponentMonitoring = "monitoring"
ComponentTLS = "tls"
ComponentBase = "base"
Copy link
Contributor

Choose a reason for hiding this comment

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

I would keep these constants typed.

Copy link
Contributor

Choose a reason for hiding this comment

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

The way it was only the ComponentBase had a different type, all the others were strings: https://goplay.space/#C-DHpg_1hcO

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed back to Componentkind type

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you gonna have to add ComponentKind to each line, otherwise only the first one is of type ComponentKind. Can you do that?

Copy link
Contributor

@ricardomaraschini ricardomaraschini left a comment

Choose a reason for hiding this comment

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

Please take a look at my comments.

ComponentMirror = "mirror"
ComponentMonitoring = "monitoring"
ComponentTLS = "tls"
ComponentBase = "base"
Copy link
Contributor

Choose a reason for hiding this comment

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

The way it was only the ComponentBase had a different type, all the others were strings: https://goplay.space/#C-DHpg_1hcO

apis/quay/v1/quayregistry_types.go Outdated Show resolved Hide resolved
apis/quay/v1/quayregistry_types.go Outdated Show resolved Hide resolved
apis/quay/v1/quayregistry_types.go Outdated Show resolved Hide resolved
apis/quay/v1/quayregistry_types.go Outdated Show resolved Hide resolved
apis/quay/v1/quayregistry_types.go Outdated Show resolved Hide resolved
pkg/middleware/middleware.go Outdated Show resolved Hide resolved
pkg/middleware/middleware.go Outdated Show resolved Hide resolved
pkg/middleware/middleware.go Outdated Show resolved Hide resolved
pkg/middleware/middleware.go Outdated Show resolved Hide resolved
Copy link
Contributor

@flavianmissi flavianmissi left a comment

Choose a reason for hiding this comment

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

Hey @jonathankingfc,
I thought we had agreed that we would focus on overrides, but this PR includes both labels and env vars.
What are you plans here?

@jonathankingfc jonathankingfc force-pushed the PROJQUAY-1090 branch 2 times, most recently from d69afd2 to 9ec9cd3 Compare November 30, 2021 14:25
@jonathankingfc
Copy link
Collaborator Author

jonathankingfc commented Nov 30, 2021

Hey @jonathankingfc, I thought we had agreed that we would focus on overrides, but this PR includes both labels and env vars. What are you plans here?

@flavianmissi Updated the PR with fixes proposed by @ricardomaraschini and removed any implementation of env and label overrides (this should be supported in a later PR).

@jonathankingfc jonathankingfc changed the title [WIP] volume: Add support for volume size and env variable overrides (PROJQUAY-1090) volume: Add support for volume size and env variable overrides (PROJQUAY-1090) Nov 30, 2021
apis/quay/v1/quayregistry_types.go Outdated Show resolved Hide resolved
pkg/middleware/middleware.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ricardomaraschini ricardomaraschini left a comment

Choose a reason for hiding this comment

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

Almost there, just clarifying some things below.

var supportsVolumeOverride = []ComponentKind{
ComponentPostgres,
ComponentClair,
ComponentObjectStorage,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does ObjectStorage support Override ? The Jira card has, as an acceptance criteria:

"volume overrides available for every managed component that uses a PersistentVolume (Noobaa Backend, Postgres for Quay, Postgres for Clair)"

I know that we do not set the size of the Nooba Backend but before merging this we better clarify the behavior with the Jira card reporter.

pkg/middleware/middleware.go Outdated Show resolved Hide resolved
apis/quay/v1/quayregistry_types.go Outdated Show resolved Hide resolved
apis/quay/v1/quayregistry_types.go Outdated Show resolved Hide resolved
pkg/middleware/middleware.go Outdated Show resolved Hide resolved
@jonathankingfc jonathankingfc force-pushed the PROJQUAY-1090 branch 2 times, most recently from 5a1ba49 to e93e2c3 Compare December 3, 2021 16:14
Copy link
Contributor

@ricardomaraschini ricardomaraschini left a comment

Choose a reason for hiding this comment

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

All good! Let's just await for @dmesser in the Jira card then we can get this in.

if volumeSizeOverride != nil {
// Ensure that volume size is not being reduced
if pvc.Spec.Resources.Requests.Storage() != nil && volumeSizeOverride.Cmp(*pvc.Spec.Resources.Requests.Storage()) == -1 {
return nil, fmt.Errorf("cannot shrink volume override size from %s to %s", volumeSizeOverride.String(), pvc.Spec.Resources.Requests.Storage().String())
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't from and to inverted here?

Copy link
Contributor

Choose a reason for hiding this comment

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

@jonathankingfc this is the last one, I promise :-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed!

- Add override field to Operator CRD to allow for volume size overrides
- Add tests to reflect changes in API
@jonathankingfc jonathankingfc merged commit a1a1550 into master Dec 3, 2021
jonathankingfc added a commit that referenced this pull request Dec 3, 2021
- Add override field to Operator CRD to allow for volume size overrides
- Add tests to reflect changes in API
jonathankingfc added a commit that referenced this pull request Dec 3, 2021
- Add override field to Operator CRD to allow for volume size overrides
- Add tests to reflect changes in API
@ricardomaraschini ricardomaraschini deleted the PROJQUAY-1090 branch December 15, 2021 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants