chore: Minor improvement for Helm, remove dependency & namespace (#9928)

This commit is contained in:
geekup-legodevops 2021-12-28 14:20:37 +07:00 committed by GitHub
parent 8c6bae6f71
commit 269e3a786d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 228 additions and 65 deletions

View File

@ -1,6 +0,0 @@
dependencies:
- name: common
repository: https://charts.bitnami.com/bitnami
version: 0.3.1
digest: sha256:a6d6b7927942884d4abd2291b1561b6c86db71aedeb08b33ccd5a4228a776257
generated: "2021-09-09T10:54:25.247689+07:00"

View File

@ -4,17 +4,12 @@ apiVersion: v2
appVersion: "1.16.0"
name: appsmith
type: application
dependencies:
# This dependency is used to render common declaration (tplvalues.render, storage.class, labels.standard)
# in Deployment, PVC, Service, ServiceAccount and TLS-Secret template
- name: common
version: 0.3.1
repository: https://charts.bitnami.com/bitnami
description: Appsmith is an open source framework to build admin panels, CRUD apps and workflows. Build everything you need, 10x faster.
maintainer:
maintainers:
- email: tech@appsmith.com
name: Appsmith
sources:
- https://github.com/appsmithorg/appsmith
- https://www.appsmith.com/
version: 1.4.0
home: https://www.appsmith.com/
icon: https://assets.appsmith.com/appsmith-icon.png
version: 1.4.1

View File

@ -0,0 +1,116 @@
## Prerequisites
- Helm V3: [Install Helm V3](https://helm.sh/docs/intro/install/)
- AWS CLI: [Install AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)
- AWS CLI Configure: [Configure AWS credential](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html)
## Initialize, Package and publish charts in the Amazon S3 Helm repository
* Create S3 bucket for Helm chart (naming as `helm.appsmith.com` \- Hosting S3 as Static web requires bucket name be the same with the domain\)
* Clone your Helm charts (ignore if already have Appsmith repo on machine)
* Package the local Helm chart
```
helm package ./deploy/helm
```
* Store the local package in the Amazon S3 Helm repository
```
aws s3 cp ./appsmith-1.4.1.tgz s3://helm.appsmith.com/
```
* Initialize the Amazon S3 Helm repository
```
helm repo index --url https://helm.appsmith.com
```
* Upload `index.yaml` to S3 bucket
```
aws s3 cp ./index.yaml s3://helm.appsmith.com
```
* Verify the newly created Helm repository by checking that the `index.yml` file was created in the S3 bucket
```
aws s3 ls s3://helm.appsmith.com
```
## Search for and install a chart from the Amazon S3 Helm repository
* Add Helm repo with S3 bucket URL (or Helm URL `https://helm.appsmith.com`)
```
helm repo add appsmith http://helm.appsmith.com
```
* Search for all versions of the my-app chart. Run following command to search all available version of Helm chart
```
helm search repo appsmith --versions
```
* Install a chart from the Amazon S3 Helm repository
```
helm install appsmith appsmith/appsmith --version 1.4.1
```
## Upgrade your Helm repository (If need)
* Modify the chart
* Package Helm chart
```
helm package ./deploy/helm
```
* Push the new version to the Helm repository in Amazon S3
```
aws s3 cp ./appsmith-1.4.1.tgz s3://helm.appsmith.com
```
* Create index file
```
helm repo index --url http://helm.appsmith.com
```
* Push new `index.yaml` file into S3 bucket
```
aws s3 cp ./index.yaml s3://helm.appsmith.com
```
* Verify the updated Helm chart
```
helm repo update
helm search repo appsmith
```
## Install Appsmith Helm Chart Using Helm URL
* Add Helm repo
```
helm repo add appsmith http://helm.appsmith.com
```
* Update Helm repo
```
helm repo update
```
* Install Helm chart
```
helm install appsmith appsmith/appsmith
```

View File

@ -8,11 +8,11 @@ API Support: CURL importer for REST APIs Database Support: PostgreSQL, MongoDB,
## TL;DR
---
```
helm repo add appsmith https://appsmithorg.github.io/appsmith
helm repo add stable-appsmith http://helm.appsmith.com
helm repo update
helm install appsmith/appsmith --generate-name
helm install stable-appsmith/appsmith --generate-name
```
## Introduction
@ -23,7 +23,7 @@ This chart bootstrap an [Appsmith](https://github.com/appsmithorg/appsmith) depl
---
* Install Helm package manager: [https://helm.sh/docs/intro/install/](https://helm.sh/docs/intro/install/)
* Ensure `kubectl` is installed and configured to connect to your cluster
* Install kubeclt: [kubernetes.io/vi/docs/tasks/tools/install-kubectl/](https://kubernetes.io/vi/docs/tasks/tools/install-kubectl/)
* Install kubectl: [kubernetes.io/vi/docs/tasks/tools/install-kubectl/](https://kubernetes.io/vi/docs/tasks/tools/install-kubectl/)
* Minikube: [Setup Kubectl](https://minikube.sigs.k8s.io/docs/handbook/kubectl/)
* Google Cloud Kubernetes: [Configuring cluster access for kubectl](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl)
* Aws EKS: [Create a kubeconfig for Amazon EKS](https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html)
@ -43,7 +43,7 @@ This chart bootstrap an [Appsmith](https://github.com/appsmithorg/appsmith) depl
---
To install the chart with the release `appsmith`
```
helm install appsmith/appsmith --generate-name
helm install stable-appsmith/appsmith --generate-name
```
The command deploys Appsmith application on Kubernetes cluster in the default configuration. The [Parameters](https://github.com/appsmithorg/appsmith/tree/release/deploy/helm#paramters) section lists the parameters that can be configured during installation.
## Uninstalling the Chart
@ -99,7 +99,7 @@ The command uninstalls the release and removes all Kubernetes resources associat
### Appsmith namespace parameters
| Name | Description | Value |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------- | ------- |
| ----------------- | ------------------------------------------------------------------------------------- | ------- |
| `namespace.create`| Enable creation of `Namespace` | `true` |
### Appsmith service account parameters
@ -115,6 +115,7 @@ The command uninstalls the release and removes all Kubernetes resources associat
| `service.type` | Appsmith service type | `ClusterIP` |
| `service.port` | Appsmith service port | `80` |
| `service.portName` | Appsmith service port name | `appsmith` |
| `service.nodePort` | Appsmith service node port to expose to expose | `8000` |
| `service.clusterIP` | Appsmith service Cluster | `""` |
| `service.loadBalancerIP` | Appsmith service Load Balancer IP | `""` |
| `service.loadBalancerSourceRanges` | Appsmith service Load Balancer sources | `[]` |
@ -125,12 +126,14 @@ The command uninstalls the release and removes all Kubernetes resources associat
| `ingress.secrets` | Custom TLS certificates as secrets | `[]` |
| `ingress.certManager` | Enable ingress to use TLS certificates provided by Cert Manager | `false` |
| `ingress.certManagerTls` | Specify TLS secret resources created by Cert Manager | `[]` |
| `ingress.className` | Configure Ingress class that being used in ingress resource | `""` |
### Persistence parameters
| Name | Description | Value |
| ----------------------------------- | --------------------------------------------------------------------- | ------------------- |
| `persistence.enabled` | Enable persistence using Persistent Volume Claims | `true` |
| `persistence.storageClass` | Persistent Volume storage class | `""` |
| `persistence.annotations` | Additional custom annotations for the PVC | `{}` |
| `persistence.localStorage` | Enable persistent volume using local storage | `false` |
| `persistence.storagePath` | Local storage path | `/tmp/hostpath_pv` |
| `persistence.localCluster` | Local running cluster to provide storage space | `[minikube]` |
@ -154,15 +157,15 @@ The command uninstalls the release and removes all Kubernetes resources associat
Specify each parameter using `--set key=value[,key=value]` argument to helm install. For example:
```
helm install appsmith \
helm install \
--set persistence.storageClass=appsmith-pv \
deploy/helm
stable-appsmith/appsmith --generate-name
```
The above command deploys Appsmith application and configure application to use storage class name `appsmith-pv`
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
```
helm install -f values.yaml appsmith/appsmith --generate-name
helm install -f values.yaml stable-appsmith/appsmith --generate-name
```
*Tip: You can use the default [values.yaml](https://github.com/appsmithorg/appsmith/blob/release/deploy/helm/values.yaml)*

View File

@ -2,7 +2,7 @@
Expand the name of the chart.
*/}}
{{- define "appsmith.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- default .Chart.Name .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
@ -14,7 +14,7 @@ If release name contains chart name it will be used as a full name.
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- $name := default .Chart.Name .Values.fullnameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
@ -77,8 +77,58 @@ Allow the release namespace to be overridden for multi-namespace deployments in
{{- end -}}
{{/*
Return the appropriate apiVersion for the object
Kubernetes standard labels
*/}}
{{- define "apiVersion" -}}
{{- default "storage.k8s.io/v1" .Values.apiVersion -}}
{{- define "labels.standard" -}}
app.kubernetes.io/name: {{ include "names.name" . }}
helm.sh/chart: {{ include "names.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Expand the name of the chart.
*/}}
{{- define "names.name" -}}
{{- default .Chart.Name .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "names.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Storage Class
*/}}
{{- define "storage.class" -}}
{{- $storageClass := .persistence.storageClass -}}
{{- if .global -}}
{{- if .global.storageClass -}}
{{- $storageClass = .global.storageClass -}}
{{- end -}}
{{- end -}}
{{- if $storageClass -}}
{{- if (eq "-" $storageClass) -}}
{{- printf "storageClassName: \"\"" -}}
{{- else }}
{{- printf "storageClassName: %s" $storageClass -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Renders a value that contains template.
*/}}
{{- define "tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}

View File

@ -30,9 +30,10 @@ metadata:
namespace: {{ include "appsmith.namespace" . }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
kind: Role
metadata:
name: imago
namespace: {{ include "appsmith.namespace" . }}
rules:
- apiGroups:
- ""
@ -64,12 +65,13 @@ rules:
- list
- update
---
kind: ClusterRoleBinding
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: imago
namespace: {{ include "appsmith.namespace" . }}
roleRef:
kind: ClusterRole
kind: Role
name: imago
apiGroup: rbac.authorization.k8s.io
subjects:

View File

@ -91,7 +91,7 @@ spec:
- metadata:
name: data
{{- if .Values.persistence.annotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.annotations "context" $) | nindent 10 }}
annotations: {{- include "tplvalues.render" (dict "value" .Values.persistence.annotations "context" $) | nindent 10 }}
{{- end }}
spec:
accessModes:
@ -102,7 +102,7 @@ spec:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.volumeClaimTemplates.selector }}
selector: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.volumeClaimTemplates.selector "context" $) | nindent 10 }}
selector: {{- include "tplvalues.render" (dict "value" .Values.persistence.volumeClaimTemplates.selector "context" $) | nindent 10 }}
{{- end }}
{{ include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) }}
{{ include "storage.class" (dict "persistence" .Values.persistence "global" .Values.global) }}
{{- end }}

View File

@ -1,6 +0,0 @@
{{- if .Values.namespace.create }}
apiVersion: v1
kind: Namespace
metadata:
name: {{ include "appsmith.namespace" . }}
{{- end }}

View File

@ -12,5 +12,5 @@ spec:
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{ include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) }}
{{ include "storage.class" (dict "persistence" .Values.persistence "global" .Values.global) }}
{{- end }}

View File

@ -8,10 +8,10 @@ metadata:
{{- if or .Values.service.annotations .Values.commonAnnotations }}
annotations:
{{- if .Values.service.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $) | nindent 4 }}
{{- include "tplvalues.render" ( dict "value" .Values.service.annotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- include "tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
spec:

View File

@ -11,7 +11,7 @@ metadata:
{{ toYaml .Values.serviceAccount.annotations | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- include "tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end }}
secrets:

View File

@ -1,5 +1,5 @@
{{- if and .Values.storageClass.enabled .Values.persistence.localStorage }}
apiVersion: {{ template "apiVersion" }}
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ .Values.persistence.storageClass }}
@ -7,7 +7,7 @@ provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
---
{{- else if .Values.storageClass.enabled }}
apiVersion: {{ template "apiVersion" }}
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ .Values.persistence.storageClass }}

View File

@ -8,12 +8,12 @@ kind: Secret
metadata:
name: {{ printf "%s-tls" .host }}
namespace: {{ include "appsmith.namespace" $ }}
labels: {{- include "common.labels.standard" $ | nindent 4 }}
labels: {{- include "labels.standard" $ | nindent 4 }}
{{- if $.Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 4 }}
{{- include "tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if $.Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }}
annotations: {{- include "tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:
@ -31,12 +31,12 @@ kind: Secret
metadata:
name: {{ printf "%s-tls" .host }}
namespace: {{ include "appsmith.namespace" $ }}
labels: {{- include "common.labels.standard" $ | nindent 4 }}
labels: {{- include "labels.standard" $ | nindent 4 }}
{{- if $.Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- include "tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if $.Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
annotations: {{- include "tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: kubernetes.io/tls
data:

View File

@ -4,14 +4,12 @@
## Current available global Docker image parameters: imageRegistry, imagePullSecrets and storageClass
##
## @param global.imageRegistry Global Docker image registry
## @param global.imagePullSecrets Global Docker registry secret names as an array
## @param global.storageClass Global StorageClass for Persistent Volume(s)
## @param global.namespaceOverride Override the namespace for resource deployed by the chart, but can itself be overridden by the local namespaceOverride
##
global:
storageClass: ""
namespaceOverride: "appsmith"
namespaceOverride: ""
## @param fullnameOverride String to fully override appsmith.fullname template
##
fullnameOverride: ""
@ -82,6 +80,9 @@ service:
## @param service.port; service port
##
port: 80
## @param service.nodePort; Node port to expose if service type is "LoadBalancer" or "NodePort"
##
nodePort: 8000
## @param service.portName Appsmith; service port name
##
portName: appsmith
@ -156,6 +157,11 @@ ingress:
## - appsmith-domain.me
## secretName: appsmith-tls
certManagerTls: []
## @parm ingress.className Configure Ingress class that being used in ingress resource
## e.g:
## className: "nginx"
##
className: ""
resources:
# We usually recommend not to specify default resources and to leave this as a conscious
@ -191,6 +197,9 @@ persistence:
## @param persistence.storageClass PVC Storage Class
##
storageClass: ""
## @param persistence.annotations Additional custom annotations for the PVC
##
annotations: {}
## @param persistence.localStorage - Use local storage for PVC
##
localStorage: false