Skip to content

Commit

Permalink
Remove MongoDB option from chart. (#2040)
Browse files Browse the repository at this point in the history
* Remove mongodb from the chart and circleci tests.

* Update chart dependencies.
  • Loading branch information
absoludity committed Sep 16, 2020
1 parent e49b5ee commit 12f0714
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 151 deletions.
32 changes: 0 additions & 32 deletions .circleci/config.yml
Expand Up @@ -35,27 +35,13 @@ workflows:
<<: *build_always
- build_dashboard:
<<: *build_always
- local_e2e_tests_mongodb_helm2:
<<: *build_always
requires:
- test_go
- test_dashboard
- build_go_images
- build_dashboard
- local_e2e_tests_postgresql_helm2:
<<: *build_always
requires:
- test_go
- test_dashboard
- build_go_images
- build_dashboard
- local_e2e_tests_mongodb_helm3:
<<: *build_always
requires:
- test_go
- test_dashboard
- build_go_images
- build_dashboard
- local_e2e_tests_postgresql_helm3:
<<: *build_always
requires:
Expand Down Expand Up @@ -96,8 +82,6 @@ workflows:
requires:
- local_e2e_tests_postgresql_helm2
- local_e2e_tests_postgresql_helm3
- local_e2e_tests_mongodb_helm2
- local_e2e_tests_mongodb_helm3
- GKE_1_15_MASTER
- GKE_1_15_LATEST_RELEASE
- GKE_1_16_MASTER
Expand All @@ -107,8 +91,6 @@ workflows:
requires:
- local_e2e_tests_postgresql_helm2
- local_e2e_tests_postgresql_helm3
- local_e2e_tests_mongodb_helm2
- local_e2e_tests_mongodb_helm3
- GKE_1_15_MASTER
- GKE_1_15_LATEST_RELEASE
- GKE_1_16_MASTER
Expand All @@ -118,8 +100,6 @@ workflows:
requires:
- local_e2e_tests_postgresql_helm2
- local_e2e_tests_postgresql_helm3
- local_e2e_tests_mongodb_helm2
- local_e2e_tests_mongodb_helm3
- GKE_1_15_MASTER
- GKE_1_15_LATEST_RELEASE
- GKE_1_16_MASTER
Expand Down Expand Up @@ -318,24 +298,12 @@ jobs:
steps:
- checkout
- run: REPO_DOMAIN=kubeapps REPO_NAME=kubeapps ./script/create_release.sh ${CIRCLE_TAG}
local_e2e_tests_mongodb_helm2:
machine: true
environment:
KUBEAPPS_DB: "mongodb"
HELM_VERSION: "v2.16.3"
<<: *local_e2e_steps
local_e2e_tests_postgresql_helm2:
machine: true
environment:
HELM_VERSION: "v2.16.3"
KUBEAPPS_DB: "postgresql"
<<: *local_e2e_steps
local_e2e_tests_mongodb_helm3:
machine: true
environment:
HELM_VERSION: "v3.0.2"
KUBEAPPS_DB: "mongodb"
<<: *local_e2e_steps
local_e2e_tests_postgresql_helm3:
machine: true
environment:
Expand Down
8 changes: 1 addition & 7 deletions chart/kubeapps/README.md
Expand Up @@ -33,7 +33,7 @@ helm install kubeapps --namespace kubeapps bitnami/kubeapps --set useHelm3=true

This chart bootstraps a [Kubeapps](https://kubeapps.com) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

It also packages the [Bitnami MongoDB chart](https://github.com/bitnami/charts/tree/master/bitnami/mongodb) or the [Bitnami PostgreSQL chart](https://github.com/bitnami/charts/tree/master/bitnami/postgresql) which is required for bootstrapping a deployment for the database requirements of the Kubeapps application.
It also packages the [Bitnami PostgreSQL chart](https://github.com/bitnami/charts/tree/master/bitnami/postgresql) which is required for bootstrapping a deployment for the database requirements of the Kubeapps application.

## Prerequisites

Expand Down Expand Up @@ -94,12 +94,6 @@ helm install kubeapps --namespace kubeapps -f custom-values.yaml bitnami/kubeapp

By default, Kubeapps will track the [community Helm charts](https://github.com/helm/charts) and the [Kubernetes Service Catalog charts](https://github.com/kubernetes-incubator/service-catalog). To change these defaults, override with your desired parameters the `apprepository.initialRepos` object present in the [values.yaml](values.yaml) file.

### Configuring the database to use

Kubeapps supports two database types: MongoDB or PostgreSQL. By default MongoDB is installed. If you want to enable PostgreSQL instead set the following values when installing the application: `mongodb.enabled=false` and `postresql.enabled=true`.

> **Note**: Changing the database type when upgrading is not supported.
### Enabling Operators

Since v1.9.0, Kubeapps supports to deploy and manage Operators within its dashboard. To enable this feature, set the flag `featureFlags.operators=true`. More information about how to enable and use this feature can be found in [this guide](https://github.com/kubeapps/kubeapps/blob/master/docs/user/operators.md).
Expand Down
7 changes: 2 additions & 5 deletions chart/kubeapps/requirements.lock
@@ -1,9 +1,6 @@
dependencies:
- name: mongodb
repository: https://charts.bitnami.com/bitnami
version: 8.3.1
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 8.10.14
digest: sha256:ce6e6371f8977ae429201629ac850d50337f7ecd86204bbe4c9629ad0557ac85
generated: "2020-08-19T12:25:21.196478996+10:00"
digest: sha256:e87985dc8080008817974fd28a410163fd252193dbf2257a7a24eaa5bf0fb76f
generated: "2020-09-16T13:56:30.262329051+10:00"
5 changes: 0 additions & 5 deletions chart/kubeapps/requirements.yaml
@@ -1,13 +1,8 @@
dependencies:
- name: mongodb
version: ">= 8.2.1"
repository: https://charts.bitnami.com/bitnami
condition: mongodb.enabled
- name: postgresql
# TODO(andresmgot): Unable to upgrade to 9.X at the moment due to a breaking change
# in https://github.com/bitnami/charts/pull/3021, if we need to upgrade, it's necessary
# to tell users to execute this before:
# kubectl delete statefulset -n kubeapps kubeapps-postgresql-master kubeapps-postgresql-slave
version: "~ 8.10.11"
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
10 changes: 0 additions & 10 deletions chart/kubeapps/templates/_helpers.tpl
Expand Up @@ -75,16 +75,6 @@ Also, we can't use a single if because lazy evaluation is not an option
{{- end -}}
{{- end -}}

{{/*
Create a default fully qualified app name for MongoDB dependency.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "kubeapps.mongodb.fullname" -}}
{{- $name := default "mongodb" .Values.mongodb.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}


{{/*
Create a default fully qualified app name for PostgreSQL dependency.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
Expand Down
10 changes: 0 additions & 10 deletions chart/kubeapps/templates/apprepository-deployment.yaml
Expand Up @@ -45,22 +45,12 @@ spec:
- --repo-sync-image={{ template "kubeapps.image" (list .Values.apprepository.syncImage .Values.global) }}
- --repo-sync-cmd=/asset-syncer
- --namespace={{ .Release.Namespace }}
{{- if .Values.mongodb.enabled }}
- --database-secret-name={{ .Values.mongodb.auth.existingSecret }}
- --database-secret-key=mongodb-root-password
- --database-type=mongodb
- --database-url={{ template "kubeapps.mongodb.fullname" . }}
- --database-user=root
- --database-name=charts
{{- end }}
{{- if .Values.postgresql.enabled }}
- --database-secret-name={{ .Values.postgresql.existingSecret }}
- --database-secret-key=postgresql-password
- --database-type=postgresql
- --database-url={{ template "kubeapps.postgresql.fullname" . }}:5432
- --database-user=postgres
- --database-name=assets
{{- end }}
{{- if .Values.apprepository.crontab }}
- --crontab={{ .Values.apprepository.crontab }}
{{- end }}
Expand Down
16 changes: 1 addition & 15 deletions chart/kubeapps/templates/apprepository-jobs-postupgrade.yaml
Expand Up @@ -44,31 +44,17 @@ spec:
- /asset-syncer
args:
- invalidate-cache
{{- if .Values.mongodb.enabled }}
- --database-type=mongodb
- --database-url={{ template "kubeapps.mongodb.fullname" . }}
- --database-user=root
- --database-name=charts
{{- end }}
{{- if .Values.postgresql.enabled }}
- --database-type=postgresql
- --database-url={{ template "kubeapps.postgresql.fullname" . }}:5432
- --database-user=postgres
- --database-name=assets
{{- end }}
env:
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.mongodb.enabled }}
key: mongodb-root-password
name: {{ .Values.mongodb.auth.existingSecret }}
{{- end }}
{{- if .Values.postgresql.enabled }}
key: postgresql-password
name: {{ .Values.postgresql.existingSecret }}
{{- end }}
{{- if and .Values.postgresql.enabled .Values.postgresql.existingSecret }}
{{- if .Values.postgresql.existingSecret }}
initContainers:
# Helm 3.1 supports a lookup template tag to create a secret if it does not exist
# but we can't yet restrict to helm 3.1, hence manually doing this with an initContainer.
Expand Down
19 changes: 0 additions & 19 deletions chart/kubeapps/templates/assetsvc-deployment.yaml
Expand Up @@ -39,24 +39,6 @@ spec:
imagePullPolicy: {{ .Values.assetsvc.image.pullPolicy | quote }}
command:
- /assetsvc
{{- if .Values.mongodb.enabled }}
args:
- --database-type=mongodb
- --database-user=root
- --database-name=charts
- --database-url={{ template "kubeapps.mongodb.fullname" . }}
env:
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.mongodb.auth.existingSecret }}
key: mongodb-root-password
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- end }}
{{- if .Values.postgresql.enabled }}
args:
- --database-type=postgresql
- --database-user=postgres
Expand All @@ -72,7 +54,6 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- end }}
ports:
- name: http
containerPort: {{ .Values.assetsvc.service.port }}
Expand Down
12 changes: 1 addition & 11 deletions chart/kubeapps/templates/db-secret-bootstrap.yaml
@@ -1,13 +1,8 @@
{{- if or .Values.mongodb.auth.existingSecret .Values.postgresql.existingSecret -}}
{{- if .Values.postgresql.existingSecret -}}
apiVersion: v1
kind: Secret
metadata:
{{- if .Values.mongodb.enabled }}
name: {{ .Values.mongodb.auth.existingSecret }}
{{- end }}
{{- if .Values.postgresql.enabled }}
name: {{ .Values.postgresql.existingSecret }}
{{- end }}
annotations:
helm.sh/hook: pre-install
labels:
Expand All @@ -18,11 +13,6 @@ metadata:
heritage: {{ .Release.Service }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
{{- if .Values.mongodb.enabled }}
mongodb-root-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- if .Values.postgresql.enabled }}
postgresql-password: {{ randAlphaNum 10 | b64enc | quote }}
postgresql-replication-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- end -}}
2 changes: 1 addition & 1 deletion chart/kubeapps/templates/db-secret-jobs-cleanup.yaml
Expand Up @@ -41,4 +41,4 @@ spec:
- /bin/sh
args:
- -c
- "kubectl delete secret -n {{ .Release.Namespace }} {{ .Values.mongodb.auth.existingSecret }} {{ .Values.postgresql.existingSecret }}|| true"
- "kubectl delete secret -n {{ .Release.Namespace }} {{ .Values.postgresql.existingSecret }}|| true"
36 changes: 0 additions & 36 deletions chart/kubeapps/values.yaml
Expand Up @@ -572,46 +572,10 @@ dashboard:
##
tolerations: {}

## MongoDB chart configuration
## ref: https://github.com/bitnami/charts/blob/master/bitnami/mongodb/values.yaml
##
mongodb:
## Whether to deploy a mongodb server to satisfy the applications database requirements.
enabled: false
## Kubeapps uses MongoDB as a cache and persistence is not required
##
persistence:
enabled: false
size: 8Gi
## MongoDB credentials are handled by kubeapps to facilitate upgrades
##
auth:
existingSecret: kubeapps-mongodb
## Pod Security Context
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
##
securityContext:
enabled: false
## MongoDB containers' resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
resources:
## Default values set based on usage data from running Kubeapps instances
## ref: https://github.com/kubeapps/kubeapps/issues/478#issuecomment-422979262
##
limits:
cpu: 500m
memory: 512Mi
requests:
cpu: 50m
memory: 256Mi

## PostgreSQL chart configuration
## ref: https://github.com/bitnami/charts/blob/master/bitnami/postgresql/values.yaml
##
postgresql:
## Whether to deploy a postgresql server to satisfy the applications database requirements.
enabled: true
## Enable replication for high availability
replication:
enabled: true
Expand Down

0 comments on commit 12f0714

Please sign in to comment.