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

bitnami/kubeapps Improved handling of packaging options for Kubeapps #9063

Merged

Conversation

absoludity
Copy link
Contributor

@absoludity absoludity commented Feb 17, 2022

Description of the change

This change contains the changes landed in our Kubeapps chart at vmware-tanzu/kubeapps#4265 , but without the update to the plugin paths for now.

Adding Antonio and Rafa as reviewers just to ensure we're on the same page about landing this change now.

Benefits

It gives us a better UX for choosing which packaging system to use with Kubeapps, by allowing the user to choose just the packaging system, while the chart then calculates the required plugins. It also allows the chart to conditionally enable/disable chart dependencies based on the chosen packaging.

Backwards compatible as setting the kubeappsapis.enabledPlugins will override (see paste below)
Possible drawbacks

I understand the readme-generator-for-helm check failure is known (it doesn't deal with nil values yet), but I'm confused about the Error: Detected changes in charts without version bump in Chart.yaml. Charts changed: 1 bitnami/kubeapps Version bumps detected: 99
error, given that I have bumped the patch version of the chart?

Applicable issues

  • fixes #

Additional information

Here's the output from testing the change by comparing the output of helm template:

# Default plugins are helm and resources:
➜  kubeapps git:(3695-dont-require-explicit-enable-redis-2) ✗ git --no-pager diff docs/user/manifests/kubeapps-local-dev-values.yaml
➜  kubeapps git:(3695-dont-require-explicit-enable-redis-2) ✗ make deploy-dev-kubeapps | grep "\- /kubeapps-apis" -A 5              
            - /kubeapps-apis
          args:
            - --plugin-dir
            - /plugins/helm
            - --plugin-dir
            - /plugins/resources

# Enabling carvel updates the enabled plugins.
➜  kubeapps git:(3695-dont-require-explicit-enable-redis-2) ✗ git --no-pager diff docs/user/manifests/kubeapps-local-dev-values.yaml
diff --git a/docs/user/manifests/kubeapps-local-dev-values.yaml b/docs/user/manifests/kubeapps-local-dev-values.yaml
index 3b7518cc..ff73074b 100644
--- a/docs/user/manifests/kubeapps-local-dev-values.yaml
+++ b/docs/user/manifests/kubeapps-local-dev-values.yaml
@@ -30,3 +30,6 @@ ingress:
     nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
     # Required for ingress-nginx 1.0.0 for a valid ingress.
     kubernetes.io/ingress.class: nginx
+packaging:
+  carvel:
+    enabled: true
➜  kubeapps git:(3695-dont-require-explicit-enable-redis-2) ✗ make deploy-dev-kubeapps | grep "\- /kubeapps-apis" -A 7
            - /kubeapps-apis
          args:
            - --plugin-dir
            - /plugins/kapp-controller
            - --plugin-dir
            - /plugins/helm
            - --plugin-dir
            - /plugins/resources

# Enabling flux results in an error as helm is also enabled:
➜  kubeapps git:(3695-dont-require-explicit-enable-redis-2) ✗ git --no-pager diff docs/user/manifests/kubeapps-local-dev-values.yaml
diff --git a/docs/user/manifests/kubeapps-local-dev-values.yaml b/docs/user/manifests/kubeapps-local-dev-values.yaml
index 3b7518cc..7117cbaa 100644
--- a/docs/user/manifests/kubeapps-local-dev-values.yaml
+++ b/docs/user/manifests/kubeapps-local-dev-values.yaml
@@ -30,3 +30,8 @@ ingress:
     nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
     # Required for ingress-nginx 1.0.0 for a valid ingress.
     kubernetes.io/ingress.class: nginx
+packaging:
+  carvel:
+    enabled: true
+  flux:
+    enabled: true
➜  kubeapps git:(3695-dont-require-explicit-enable-redis-2) ✗ make deploy-dev-kubeapps | grep "\- /kubeapps-apis" -A 7              
Error: execution error at (kubeapps/templates/kubeappsapis/deployment.yaml:71:35): packaging: Please enable only one of the flux and helm plugins, since they both operate on Helm releases.

Use --debug flag to render out invalid YAML
make: *** [script/makefiles/deploy-dev.mk:40: deploy-dev-kubeapps] Error 1

# Disabling helm gets things going as expected:
➜  kubeapps git:(3695-dont-require-explicit-enable-redis-2) ✗ git --no-pager diff docs/user/manifests/kubeapps-local-dev-values.yaml
diff --git a/docs/user/manifests/kubeapps-local-dev-values.yaml b/docs/user/manifests/kubeapps-local-dev-values.yaml
index 3b7518cc..ba928fcc 100644
--- a/docs/user/manifests/kubeapps-local-dev-values.yaml
+++ b/docs/user/manifests/kubeapps-local-dev-values.yaml
@@ -30,3 +30,10 @@ ingress:
     nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
     # Required for ingress-nginx 1.0.0 for a valid ingress.
     kubernetes.io/ingress.class: nginx
+packaging:
+  carvel:
+    enabled: true
+  flux:
+    enabled: true
+  helm:
+    enabled: false
➜  kubeapps git:(3695-dont-require-explicit-enable-redis-2) ✗ make deploy-dev-kubeapps | grep "\- /kubeapps-apis" -A 7              
            - /kubeapps-apis
          args:
            - --plugin-dir
            - /plugins/kapp-controller
            - --plugin-dir
            - /plugins/fluxv2
            - --plugin-dir
            - /plugins/resources

# Adding some other key to the packaging value causes a fail:
Use --debug flag to render out invalid YAML
make: *** [script/makefiles/deploy-dev.mk:40: deploy-dev-kubeapps] Error 1
➜  kubeapps git:(3695-dont-require-explicit-enable-redis-2) ✗ git --no-pager diff docs/user/manifests/kubeapps-local-dev-values.yaml
diff --git a/docs/user/manifests/kubeapps-local-dev-values.yaml b/docs/user/manifests/kubeapps-local-dev-values.yaml
index 3b7518cc..c3a43886 100644
--- a/docs/user/manifests/kubeapps-local-dev-values.yaml
+++ b/docs/user/manifests/kubeapps-local-dev-values.yaml
@@ -30,3 +30,12 @@ ingress:
     nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
     # Required for ingress-nginx 1.0.0 for a valid ingress.
     kubernetes.io/ingress.class: nginx
+packaging:
+  carvel:
+    enabled: true
+  flux:
+    enabled: true
+  helm:
+    enabled: false
+  unknownpkg:
+    enabled: true
➜  kubeapps git:(3695-dont-require-explicit-enable-redis-2) ✗ make deploy-dev-kubeapps | grep "\- /kubeapps-apis" -A 7              
Error: execution error at (kubeapps/templates/kubeappsapis/deployment.yaml:71:35): packaging: Unsupported packaging option: unknownpkg

Use --debug flag to render out invalid YAML
make: *** [script/makefiles/deploy-dev.mk:40: deploy-dev-kubeapps] Error 1

# Manually overriding the enabled plugins is still possible:
➜  kubeapps git:(3695-dont-require-explicit-enable-redis-2) ✗ git --no-pager diff docs/user/manifests/kubeapps-local-dev-values.yaml
diff --git a/docs/user/manifests/kubeapps-local-dev-values.yaml b/docs/user/manifests/kubeapps-local-dev-values.yaml
index 3b7518cc..e1fe4b91 100644
--- a/docs/user/manifests/kubeapps-local-dev-values.yaml
+++ b/docs/user/manifests/kubeapps-local-dev-values.yaml
@@ -18,6 +18,9 @@ postgresql:
   existingSecret: postgresql-db
 kubeappsapis:
   replicaCount: 1
+  enabledPlugins:
+  - unknownpkg
+  - anotherunknownpkg
 ingress:
   enabled: true
   hostname: localhost
@@ -30,3 +33,12 @@ ingress:
     nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
     # Required for ingress-nginx 1.0.0 for a valid ingress.
     kubernetes.io/ingress.class: nginx
+packaging:
+  carvel:
+    enabled: true
+  flux:
+    enabled: true
+  helm:
+    enabled: false
+  unknownpkg:
+    enabled: true
➜  kubeapps git:(3695-dont-require-explicit-enable-redis-2) ✗ make deploy-dev-kubeapps | grep "\- /kubeapps-apis" -A 7              
            - /kubeapps-apis
          args:
            - --plugin-dir
            - /plugins/unknownpkg
            - --plugin-dir
            - /plugins/anotherunknownpkg
            - --clusters-config-path=/config/clusters.conf
            - --plugin-config-path=/config/kubeapps-apis/plugins.conf

Checklist

  • Chart version bumped in Chart.yaml according to semver.
  • Variables are documented in the values.yaml and added to the README.md using (readme-generator-for-helm)[https://github.com/bitnami-labs/readme-generator-for-helm]
  • Title of the PR starts with chart name (e.g. [bitnami/<name_of_the_chart>])
  • All commits signed off and in agreement of Developer Certificate of Origin (DCO)

@absoludity absoludity changed the title Improved handling of packaging options for Kubeapps bitnami/kubeapps Improved handling of packaging options for Kubeapps Feb 17, 2022
@absoludity absoludity force-pushed the kubeapps-better-packaging-options branch from 159d1f5 to 1c04af7 Compare February 17, 2022 23:39
@absoludity absoludity marked this pull request as ready for review February 18, 2022 05:25
@castelblanque
Copy link
Contributor

LGTM!

Sorry for not pointing this out in the original PR on Kubeapps, if this is set up:

packaging:
  [...]
  flux:
    enabled: true
[...]
kubeappsapis:
  enabledPlugins:
    - helm
    - resources

Installation ends up having Redis but no Flux. I know it might be an edge case, but to avoid this kind of duplicity why not removing the enabledPlugins option completely?

@absoludity
Copy link
Contributor Author

Switching this back to draft as I've just noticed an issue with it (we still refer to .Values.redis.enabled in other parts. I need to test this more thoroughly on Monday.

@absoludity absoludity marked this pull request as draft February 18, 2022 08:57
@absoludity
Copy link
Contributor Author

LGTM!

Sorry for not pointing this out in the original PR on Kubeapps, if this is set up:

packaging:
  [...]
  flux:
    enabled: true
[...]
kubeappsapis:
  enabledPlugins:
    - helm
    - resources

Installation ends up having Redis but no Flux. I know it might be an edge case, but to avoid this kind of duplicity why not removing the enabledPlugins option completely?

As Antonio pointed out elsewhere, if people create their own plugins, or we work on new plugins, we may want to set the enabledPlugins explicitly.

@javsalgar
Copy link
Contributor

Could you merge from master? We just found an issue with the GH action. Sorry for the inconvenience

@absoludity absoludity force-pushed the kubeapps-better-packaging-options branch from 69c0899 to 05296a2 Compare February 18, 2022 11:32
@absoludity absoludity marked this pull request as ready for review February 18, 2022 11:33
@absoludity
Copy link
Contributor Author

Merged master and fixed the issue I mentioned earlier (changes from vmware-tanzu/kubeapps#4309 )

Copy link
Contributor

@antgamdia antgamdia left a comment

Choose a reason for hiding this comment

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

Great! Thanks for the changes, much better UX for enabling the packaging plugins.

@javsalgar
Copy link
Contributor

Could you check the issues in the actions? It seems that there's missing metadata in the README

@antgamdia
Copy link
Contributor

Could you check the issues in the actions? It seems that there's missing metadata in the README

It's a known issue in the readme-generator project, bitnami/readme-generator-for-helm#31

@absoludity
Copy link
Contributor Author

Could you check the issues in the actions? It seems that there's missing metadata in the README

It's a known issue in the readme-generator project, bitnami-labs/readme-generator-for-helm#31

Can we merge this, given that the issue for the failing check is known. We don't need to wait for that issue in the readme generator to be fixed to land this (as we similarly landed #8981)

@javsalgar javsalgar merged commit a000a97 into bitnami:master Feb 22, 2022
JMSwag pushed a commit to JMSwag/charts-1 that referenced this pull request Feb 26, 2022
…itnami#9063)

* Improved handling of packaging options for Kubeapps

Signed-off-by: Michael Nelson <[email protected]>

* Run readme generator.

Signed-off-by: Michael Nelson <[email protected]>

* Fix other use of redis.enabled from vmware-tanzu/kubeapps#4309

Signed-off-by: Michael Nelson <[email protected]>
Signed-off-by: JMSwag <[email protected]>
ComradePashka pushed a commit to ComradePashka/charts that referenced this pull request Mar 16, 2022
…itnami#9063)

* Improved handling of packaging options for Kubeapps

Signed-off-by: Michael Nelson <[email protected]>

* Run readme generator.

Signed-off-by: Michael Nelson <[email protected]>

* Fix other use of redis.enabled from vmware-tanzu/kubeapps#4309

Signed-off-by: Michael Nelson <[email protected]>
Signed-off-by: Pavel Sokolov <[email protected]>
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.

4 participants