Skip to content

Commit

Permalink
bitnami/kubeapps Improved handling of packaging options for Kubeapps (b…
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
absoludity authored and ComradePashka committed Mar 16, 2022
1 parent 7d1a443 commit e9493c8
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 54 deletions.
4 changes: 2 additions & 2 deletions bitnami/kubeapps/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 15.x.x
condition: redis.enabled
condition: packaging.flux.enabled
description: Kubeapps is a web-based UI for launching and managing applications on Kubernetes. It allows users to deploy trusted applications and operators to control users access to the cluster.
home: https://kubeapps.com
icon: https://raw.githubusercontent.com/kubeapps/kubeapps/main/docs/img/logo.png
Expand All @@ -33,4 +33,4 @@ maintainers:
name: kubeapps
sources:
- https://github.com/kubeapps/kubeapps
version: 7.8.0
version: 7.8.1
32 changes: 20 additions & 12 deletions bitnami/kubeapps/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bitnami/kubeapps/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ To access Kubeapps from outside your K8s cluster, follow the steps below:
##########################################################################################################
{{- end }}

{{ if and (.Values.redis.enabled) (not .Values.redis.existingSecret) (empty .Values.redis.redisPassword) -}}
{{ if and (.Values.packaging.flux.enabled) (not .Values.redis.existingSecret) (empty .Values.redis.redisPassword) -}}
##########################################################################################################
### WARNING: You did not provide a value for the redisPassword so one has been generated randomly ###
##########################################################################################################
Expand Down
49 changes: 29 additions & 20 deletions bitnami/kubeapps/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ Compile all warnings into a single message, and call fail.
{{- define "kubeapps.validateValues" -}}
{{- $messages := list -}}
{{- $messages := append $messages (include "kubeapps.validateValues.ingress.tls" .) -}}
{{- $messages := append $messages (include "kubeapps.validateValues.kubeappsapis.enabledPlugins" .) -}}
{{- $messages := without $messages "" -}}
{{- $message := join "\n" $messages -}}

Expand All @@ -217,27 +216,37 @@ kubeapps: ingress.tls
{{- end -}}
{{- end -}}


{{/*
# Validate values of common mistakes in kubeappsapis.enabledPlugins
# Calculate the kubeappsapis enabledPlugins.
*/}}
{{- define "kubeapps.validateValues.kubeappsapis.enabledPlugins" -}}
{{- if has "flux" .Values.kubeappsapis.enabledPlugins }}
kubeapps: kubeappsapis.enabledPlugins
You enter "flux", perhaps you meant "fluxv2"?
{{- end -}}
{{- if has "kapp_controller" .Values.kubeappsapis.enabledPlugins }}
kubeapps: kubeappsapis.enabledPlugins
You enter "kapp_controller", perhaps you meant "kapp-controller"?
{{- end -}}
{{- if and (has "fluxv2" .Values.kubeappsapis.enabledPlugins) (not .Values.redis.enabled) }}
kubeapps: kubeappsapis.enabledPlugins
If you enable the "fluxv2" plugin, you must also set redis.enabled=true
{{- end -}}
{{- if and (has "fluxv2" .Values.kubeappsapis.enabledPlugins) (has "helm" .Values.kubeappsapis.enabledPlugins) }}
kubeapps: kubeappsapis.enabledPlugins
Please choose just one of the flux2 and helm plugins, since they both operate on Helm releases.
{{- end -}}
{{- define "kubeapps.kubeappsapis.enabledPlugins" -}}
{{- $enabledPlugins := list }}
{{- if .Values.kubeappsapis.enabledPlugins }}
{{- $enabledPlugins = .Values.kubeappsapis.enabledPlugins }}
{{- else }}
{{- if and .Values.packaging.flux.enabled .Values.packaging.helm.enabled }}
{{- fail "packaging: Please enable only one of the flux and helm plugins, since they both operate on Helm releases." }}
{{- end -}}
{{- range $plugin, $options := .Values.packaging }}
{{- if $options.enabled }}
{{- if eq $plugin "carvel" }}
{{- $enabledPlugins = append $enabledPlugins "kapp-controller" }}
{{- else if eq $plugin "flux" }}
{{- $enabledPlugins = append $enabledPlugins "fluxv2" }}
{{- else if eq $plugin "helm" }}
{{- $enabledPlugins = append $enabledPlugins "helm" }}
{{- else }}
{{ $msg := printf "packaging: Unsupported packaging option: %s" $plugin }}
{{- fail $msg }}
{{- end }}
{{- end }}
{{- end }}
{{- if not $enabledPlugins }}
{{- fail "packaging: Please enable at least one of the packaging plugins." }}
{{- end }}
{{- $enabledPlugins = append $enabledPlugins "resources" }}
{{- end }}
{{- $enabledPlugins | toJson }}
{{- end -}}

{{/*
Expand Down
7 changes: 4 additions & 3 deletions bitnami/kubeapps/templates/kubeappsapis/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ spec:
command:
- /kubeapps-apis
args:
{{- range .Values.kubeappsapis.enabledPlugins }}
{{- $enabledPlugins := include "kubeapps.kubeappsapis.enabledPlugins" . | fromJsonArray }}
{{- range $enabledPlugins }}
- --plugin-dir
- /plugins/{{ . }}
{{- end }}
Expand All @@ -90,10 +91,10 @@ spec:
{{- end }}
env:
- name: GOGC
value: "50" # default is 100. 50 means increasing x2 the frequency of GC
value: "50" # default is 100. 50 means increasing x2 the frequency of GC
- name: PORT
value: {{ .Values.kubeappsapis.containerPort | quote }}
{{- if .Values.redis.enabled }}
{{- if .Values.packaging.flux.enabled }}
# REDIS-* vars are required by the plugins for caching functionality
# TODO (gfichtenolt) this as required by the kubeapps apis service (which will
# longer-term pass something to the plugins so that the plugins won't need to
Expand Down
2 changes: 1 addition & 1 deletion bitnami/kubeapps/templates/kubeappsapis/rbac_fluxv2.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if has "fluxv2" .Values.kubeappsapis.enabledPlugins }}
{{- if .Values.packaging.flux.enabled }}
{{- if .Values.rbac.create -}}
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }}
kind: ClusterRole
Expand Down
42 changes: 27 additions & 15 deletions bitnami/kubeapps/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,26 @@ ingress:
##
secrets: []

## @section Kubeapps packaging options
## Note: the helm and flux plugins are mutually exclusive, you can only
## enable one or the other since they both operate on Helm release objects.
## Enabling carvel or flux does *not* install the required related Carvel or
## Flux controllers on your cluster. Please read the documentation for running
## Kubeapps with Carvel or Flux support.
packaging:
## Default helm packaging
## @param packaging.helm.enabled Enable the standard Helm packaging.
helm:
enabled: true
## Carvel packaging
## @param packaging.carvel.enabled Enable support for the Carvel (kapp-controller) packaging.
carvel:
enabled: false
## Flux (v2) packaging
## @param packaging.flux.enabled Enable support for Flux (v2) packaging.
flux:
enabled: false

## @section Frontend parameters

## Frontend parameters
Expand Down Expand Up @@ -1609,16 +1629,14 @@ postgresql:

## @section kubeappsapis parameters
kubeappsapis:
## @param kubeappsapis.enabledPlugins Enabled plugins for the Kubeapps-APIs service
## e.g:
## enabledPlugins:
## - helm
## - fluxv2
## - kapp-controller
## @param kubeappsapis.enabledPlugins Manually override which plugins are enabled for the Kubeapps-APIs service
##
## NOTE: normally this should remain blank, with the top-level `packaging`
## value automatically determining which plugins should be enabled. Only
## set this value if you want to manually override the list of plugins
## enabled for the service.
##
enabledPlugins:
- helm
- resources
pluginConfig:
core:
packages:
Expand Down Expand Up @@ -1848,18 +1866,12 @@ kubeappsapis:
## @section Redis&trade; chart configuration
## ref: https://github.com/bitnami/charts/blob/master/bitnami/redis/values.yaml
##
## Redis will be enabled and installed if `packages.flux.enabled` is true.
redis:
## @param redis.redisPassword Password used in Redis&trade;
## ref: https://github.com/bitnami/bitnami-docker-redis/blob/master/README.md#setting-the-server-password-on-first-run
##
redisPassword: ""
## @param redis.enabled Enable the Redis&trade; deployment when deploying Kubeapps APIs.
## We currently have the situation that Redis is required for the fluxv2 plugin only.
## Until such a point that we're releasing with the fluxv2 plugin enabled, or the
## plugin cache support has been generalised so all plugins use Redis, we'll need
## to manually enable this in dev while ensuring it is false for releases (as it
## is a conditional dependency in the Chart.yaml).
enabled: false
master:
## @param redis.master.extraFlags Array with additional command line flags for Redis&trade; master
extraFlags:
Expand Down

0 comments on commit e9493c8

Please sign in to comment.