Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

appliance: move storage elements to standard feature#62903

Merged
craigfurman merged 2 commits intomainfrom
appliance-refactor-storage
May 28, 2024
Merged

appliance: move storage elements to standard feature#62903
craigfurman merged 2 commits intomainfrom
appliance-refactor-storage

Conversation

@craigfurman
Copy link
Contributor

Please review one commit at a time, in order to give another pair of eyes to this being a pure refactor (the only golden file changes are config hashes and the actual spec structure, with the exception of redis, in which I changed the quantities to make sure we weren't accidentally feeding cache config to store or vice-versa).


appliance: move storage elements to standard feature

Add a new standard block, persistentVolumeConfig, containing a storage
size and storage class name. pvc.NewPersistentVolumeClaim() can fetch
these values when a standard config is (optionally) passed to it,
similar to other standard features.

Remove service-specific code that parses storage quantities out of
config.

Regarding storage class, this makes the reconciler "dumber" and more
verbosely-configured: every PVC must be explicitly assigned a storage
class (or none), rather than taking from the global StorageClassSpec.
Note that this doesn't have direct implications for admin UX: the
appliance web app can still have features to configure a single, global,
storage class name - it can simply copy this field everywhere needed
into the ConfigMap it crafts. This relates to
https://linear.app/sourcegraph/issue/REL-16/appliance-can-create-recommended-storageclasses-for-various-k8s
also - the StorageClassSpec is unused until that feature is implemented.

appliance: consolidate storage tests

Now that we have a standard feature, we can replace most instances of
with-storage tests with one standard fixture. Symbols is the exception,
since there is some logic done on the storage size (to determine a cache
size env var).

Test plan

Golden tests included.

@craigfurman craigfurman requested a review from jdpleiness May 24, 2024 14:09
@cla-bot cla-bot bot added the cla-signed label May 24, 2024
Craig Furman added 2 commits May 28, 2024 10:12
Add a new standard block, persistentVolumeConfig, containing a storage
size and storage class name. pvc.NewPersistentVolumeClaim() can fetch
these values when a standard config is (optionally) passed to it,
similar to other standard features.

Remove service-specific code that parses storage quantities out of
config.

Regarding storage class, this makes the reconciler "dumber" and more
verbosely-configured: every PVC must be explicitly assigned a storage
class (or none), rather than taking from the global StorageClassSpec.
Note that this doesn't have direct implications for admin UX: the
appliance web app can still have features to configure a single, global,
storage class name - it can simply copy this field everywhere needed
into the ConfigMap it crafts. This relates to
https://linear.app/sourcegraph/issue/REL-16/appliance-can-create-recommended-storageclasses-for-various-k8s
also - the StorageClassSpec is unused until that feature is implemented.
Now that we have a standard feature, we can replace most instances of
with-storage tests with one standard fixture. Symbols is the exception,
since there is some logic done on the storage size (to determine a cache
size env var).
@craigfurman craigfurman force-pushed the appliance-refactor-storage branch from b1e675c to 6eb4ad7 Compare May 28, 2024 09:12
Copy link
Contributor

@jdpleiness jdpleiness left a comment

Choose a reason for hiding this comment

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

I checked out the PR, ran the golden tests, and didn't see any divergence on my end either 🎉

Regarding storage class, this makes the reconciler "dumber" and more
verbosely-configured: every PVC must be explicitly assigned a storage
class (or none), rather than taking from the global StorageClassSpec.

While this makes the rec "dumber", I think this is actually a more desirable behavior in the end as it allows more granular control over storage classes if needed.

@craigfurman
Copy link
Contributor Author

For sure, I meant dumber as a good thing in this case. Reconciler dumb, appliance application that serialises the ConfigMap smart. 😁

@craigfurman craigfurman merged commit 3e24871 into main May 28, 2024
@craigfurman craigfurman deleted the appliance-refactor-storage branch May 28, 2024 14:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants