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 configurable storage class name for image resource #1029

Merged
merged 2 commits into from
Sep 26, 2022
Merged

Conversation

tylerphelan
Copy link
Contributor

  • If set, will be used as the storageClassName in the pvc

Copy link
Contributor

@jjbustamante jjbustamante left a comment

Choose a reason for hiding this comment

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

It looks good to me!

@tomkennedy513
Copy link
Collaborator

I'm wondering if we actually need to validate that the storage class exists since that will require additional rbac for our controller. If we create a pod with an invalid storage class can't we just let pod fail?

@tylerphelan tylerphelan marked this pull request as draft September 8, 2022 15:00
@tylerphelan tylerphelan force-pushed the storageclass branch 2 times, most recently from 545d5e3 to 29d6f1c Compare September 15, 2022 21:22
- This can be used to set the storageClassName used for the cache pvc
- The field is immutable as the pvc field is also immutable
- The field is not considered when checking if the image volume cache config
has changed
Copy link
Collaborator

@tomkennedy513 tomkennedy513 left a comment

Choose a reason for hiding this comment

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

This is awesome!

@matthewmcnew
Copy link
Collaborator

Does this need to be supported in v1alpha1 apis? #934 (comment)

@tylerphelan
Copy link
Contributor Author

tylerphelan commented Sep 16, 2022

@matthewmcnew

Does this need to be supported in v1alpha1 apis? #934 (comment)

Let's think of the scenarios:

converting v1alpha1 -> v1alpha2:
storageClassName is always "", v1alpha2 clients will use ""

converting v1alpha2 -> v1alpha1:
v1alpha1 client (old version of kp) patches existing v1alpha2 image, causing storageClassName to be set to "" which will violate the immutability constraint causing blocking error. This is not great.

My 2c is that if an old v1alpha1 client runs into an immutability error it will not lose data. If the storageClassName is unset in v1alpha2 behavior will not be affected by v1alpha1 clients. Users should upgrade kp.

@matthewmcnew
Copy link
Collaborator

matthewmcnew commented Sep 16, 2022

v1alpha1 client (old version of kp) patches existing v1alpha2 image, causing storageClassName to be set to "" which will violate the immutability constraint causing blocking error. This is not great.

This seems rare but, not great. It essentially means we are not supporting v1alpha1.

Users should upgrade kp.

If our strategy for v1alpha1 headaches is to say not use v1alpha1 we should probably just begin removing v1alpha1.

@tylerphelan
Copy link
Contributor Author

It essentially means we are not supporting v1alpha1.

risk seems very high

If our strategy for v1alpha1 headaches is to say not use v1alpha1 we should probably just begin removing v1alpha1.

If we don't do this will we need to migrate all new fields to prevent data loss? ex DefaultProcess, ProjectDescriptorPath, CreationTime ?

@matthewmcnew
Copy link
Collaborator

If we don't do this will we need to migrate all new fields to prevent data loss? ex DefaultProcess, ProjectDescriptorPath, CreationTime

We probably should provide support for these. Hitting an expected immutability constraint seems slightly worse to me.

@tylerphelan
Copy link
Contributor Author

Hitting an expected immutability constraint seems slightly worse to me.

I think data loss is equal if not worse

@tylerphelan tylerphelan linked an issue Sep 19, 2022 that may be closed by this pull request
@tylerphelan
Copy link
Contributor Author

I think we should probably add migrations

@matthewmcnew
Copy link
Collaborator

I think we should probably add migrations

Do you think we should do that as this PR or create an issue to support it for all susceptible fields?

…lients

- Use annotations for conversion
- v1alpha1 clients will be handled correctly
@tylerphelan
Copy link
Contributor Author

I've added the conversion for this one here and have added #1036

@codecov-commenter
Copy link

codecov-commenter commented Sep 19, 2022

Codecov Report

Merging #1029 (425de88) into main (e9d424b) will decrease coverage by 0.06%.
The diff coverage is 54.54%.

@@            Coverage Diff             @@
##             main    #1029      +/-   ##
==========================================
- Coverage   70.53%   70.47%   -0.07%     
==========================================
  Files         122      122              
  Lines        5726     5740      +14     
==========================================
+ Hits         4039     4045       +6     
- Misses       1313     1319       +6     
- Partials      374      376       +2     
Impacted Files Coverage Δ
pkg/apis/build/v1alpha2/image_builds.go 69.49% <0.00%> (-1.61%) ⬇️
pkg/apis/build/v1alpha2/image_types.go 50.00% <ø> (ø)
pkg/cnb/env_vars.go 86.36% <ø> (ø)
pkg/apis/build/v1alpha2/image_conversion.go 85.26% <57.14%> (-3.11%) ⬇️
pkg/apis/build/v1alpha2/image_validation.go 98.21% <100.00%> (+0.01%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@tylerphelan
Copy link
Contributor Author

will merge after 0.7.1 is released

@tylerphelan tylerphelan merged commit 27cd9a9 into main Sep 26, 2022
@tylerphelan tylerphelan deleted the storageclass branch September 26, 2022 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create build cache pvc with specified storageClassName
6 participants