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

fix: Post-process clusterconfig CRDs for supported CSI providers #695

Merged
merged 2 commits into from
Jun 10, 2024

Conversation

jimmidyson
Copy link
Member

Only supported CSI providers should be available on each CAPI provider. This
commit enforces that via the API, without changing handler logic to allow
for easier extensibility later, by simply updating the supported CSI provider
names in the API definitions.

This can only happen as CRD post-processing as kubebuilder annotations are
specified on API types in go. To use that approach for CSI providers here
would require changing the whole API structure to provide CAPI provider
specific types with CAPI provider specific annotations, which would be a
maintenance headache.

This issue arose for me when adding the local-path CSI provider for Docker
as I did not want this to be available on AWS or Nutanix clusters, as well
as the opposite way round for Docker clusters (no aws-ebs or nutanix
support).

Only supported CSI providers should be available on each CAPI provider. This
commit enforces that via the API, without changing handler logic to allow
for easier extensibility later, by simply updating the supported CSI provider
names in the API definitions.

This can only happen as CRD post-processing as kubebuilder annotations are
specified on API types in go. To use that approach for CSI providers here
would require changing the whole API structure to provide CAPI provider
specific types with CAPI provider specific annotations, which would be a
maintenance headache.

This issue arose for me when adding the `local-path` CSI provider for Docker
as I did not want this to be available on AWS or Nutanix clusters, as well
as the opposite way round for Docker clusters (no `aws-ebs` or `nutanix`
support).
@jimmidyson jimmidyson enabled auto-merge (squash) June 3, 2024 19:07
make/addons.mk Show resolved Hide resolved
@jimmidyson jimmidyson merged commit 2cb6ec5 into main Jun 10, 2024
17 checks passed
@jimmidyson jimmidyson deleted the jimmi/supported-csi-providers branch June 10, 2024 11:47
@github-actions github-actions bot mentioned this pull request Jun 10, 2024
jimmidyson added a commit that referenced this pull request Jun 10, 2024
**What problem does this PR solve?**:
PR #695 was merged before I pushed the refactoring to move the logic
into a script - this commit contains those changes.

**Which issue(s) this PR fixes**:
Fixes #

**How Has This Been Tested?**:
<!--
Please describe the tests that you ran to verify your changes.
Provide output from the tests and any manual steps needed to replicate
the tests.
-->

**Special notes for your reviewer**:
<!--
Use this to provide any additional information to the reviewers.
This may include:
- Best way to review the PR.
- Where the author wants the most review attention on.
- etc.
-->
jimmidyson added a commit that referenced this pull request Jun 18, 2024
This commit removes the `providerName` from `defaultStorage`
configuration, just requiring that the `storageClassConfigName` exists
for one of the configured providers. This commit also adds validation to
ensure that the storage class configs have unique names across
providers, current behaviour could have led to conflicts if the storage
class name was used in multiple provider configurations.

When adding the `local-path` CSI provisioner for Docker clusters, I
found that the `providerName` in default storage class config was
redundant and led to unnecessary duplication of values. Removing this
unnecessary field reduces the duplication from:

```
defaultStorage:
  providerName: local-path
  storageClassConfigName: local-path
providers:
  - name: local-path
    storageClassConfig:
      - name: local-path
    strategy: HelmAddon
```

To:

```
defaultStorage:
  storageClassConfigName: local-path
providers:
  - name: local-path
    storageClassConfig:
      - name: local-path
    strategy: HelmAddon
```

While this may seem like only a small change, a single line removed, it
is always good to keep APIs as terse as possible while still retaining
strict behaviour. I think this commit achieves that.

Depends on #695.
faiq pushed a commit that referenced this pull request Jun 24, 2024
🤖 I have created a release *beep* *boop*
---


## 0.10.0 (2024-06-24)

<!-- Release notes generated using configuration in .github/release.yaml
at main -->

## What's Changed
### Exciting New Features 🎉
* feat: Upgrade to Cilium v1.15.5 by @jimmidyson in
#689
* feat: Upgrade to Calico v3.28.0 by @jimmidyson in
#688
* feat: bumps caaph to v0.2.3 by @faiq in
#691
* feat: Add local-path-provisioner CSI by @jimmidyson in
#693
* feat: cluster-api v1.7.3 by @jimmidyson in
#714
* feat: bumps caaph to 0.2.4 by @faiq in
#718
* feat: Controller that copies ClusterClasses to namespaces by
@dlipovetsky in
#715
* feat: adds a mindthegap container and deployment by @faiq in
#637
* feat: implements BeforeClusterUpgrade hook by @faiq in
#682
### Fixes 🔧
* fix: use external Nutanix API types directly by @dkoshkin in
#698
* fix: Post-process clusterconfig CRDs for supported CSI providers by
@jimmidyson in
#695
* fix: nutanix credentials Secrets owner refs by @dkoshkin in
#711
* fix: credential provider response secret ownership by @dkoshkin in
#709
* fix: static credentials Secret generation by @dkoshkin in
#717
* fix: set ownerReference on imageRegistry and globalMirror Secrets by
@dkoshkin in
#720
* fix: Allow Nutanix CSI snapshot controller & webhook to run on CP
nodes by @dlipovetsky in
#723
* refactor: Use maps for CSI providers and storage classes by
@jimmidyson in
#696
* fix: CredentialProviderConfig matchImages to support registries with
port by @dkoshkin in
#724
* fix: Allow Node Feature Discovery garbage collector to run on
control-plane nodes by @dlipovetsky in
#722
* fix: RBAC role for namespace-sync controller to watch,list namespaces
by @dkoshkin in
#738
* fix: image registries not handling CA certificates by @dkoshkin in
#729
* fix: adds a docker buildx step before release-snapshot by @faiq in
#741
### Other Changes
* docs: Add released version to helm and clusterctl install by
@jimmidyson in
#683
* revert: Temporary lint config fix until next golangci-lint release
(#629) by @jimmidyson in
#686
* refactor: Delete unused code by @jimmidyson in
#687
* refactor: Reduce log verbosity for skipped handlers by @jimmidyson in
#692
* build: update Go to 1.22.4 by @dkoshkin in
#700
* build(deps): Upgrade CAPX version to v1.4.0 by @thunderboltsid in
#707
* build: Move CSI supported provider logic to script by @jimmidyson in
#703
* build: Add testifylint linter by @jimmidyson in
#706
* build: Update all tools by @jimmidyson in
#704
* refactor: rename credential provider response secret by @dkoshkin in
#710
* refactor: Simplify code by using slices.Clone by @jimmidyson in
#712
* refactor: consistently use the same SetOwnerReference function by
@dkoshkin in
#713
* refactor: kube-vip commands by @dkoshkin in
#699
* build: Fix an incorrect make variable passed to goreleaser by
@dlipovetsky in
#716
* build: Add 'chart-docs' make target by @dlipovetsky in
#727
* build: Make CAREN mindthegap reg multiarch by @jimmidyson in
#730
* Add helm values schema plugin by @dlipovetsky in
#728
* test(e2e): Use mesosphere fork with CRSBinding fix by @jimmidyson in
#736

## New Contributors
* @thunderboltsid made their first contribution in
#707

**Full Changelog**:
v0.9.0...v0.10.0

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants