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

Improved helm chart Ingress for Kubernetes >1.20 and added more customization for PVC #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/codimd/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ kubeVersion: ">=1.14.0-0"

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
version: 0.1.10
version: 0.1.11

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
Expand Down
2 changes: 2 additions & 0 deletions charts/codimd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@ If you want use ingress, please set `service.type` to be `ClusterIP`
| codimd.imageUpload.s3.secretKey | The AWS s3 secret key | `nil` |
| codimd.imageUpload.s3.bucket | The AWS s3 bucket name | `nil` |
| codimd.imageStorePersistentVolume.enabled | Enable image persistence using PVC | `true` |
| codimd.imageStorePersistentVolume.persistentVolumeClaimName | Use existing PVC with given name instead of creating own | `nil` |
| codimd.imageStorePersistentVolume.size | The size of persistence volume | `10Gi` |
| codimd.imageStorePersistentVolume.storageClass | The storageClass of persistence volume | `-` |
| codimd.imageStorePersistentVolume.accessModes | The accessModes of persistence volume | [`ReadWriteOnce`] |
| codimd.imageStorePersistentVolume.volumeMode | The volumeMode of persistence volume | `Filesystem` |
| codimd.imageStorePersistentVolume.keepPvc | Keep PVC when helm chart is uninstalled | `false` |
| codimd.versionCheck | Enable automatically version checker | `true` |
| codimd.security.useCDN | Whether CodiMD would use static assets served on CDN | `false` |
| codimd.security.sessionSecret | The secret string to sign session, please must change this value | `changeit` |
Expand Down
5 changes: 5 additions & 0 deletions charts/codimd/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ spec:
{{ if .Values.codimd.imageStorePersistentVolume.enabled }}
volumes:
- name: image-store
{{- if .Values.codimd.imageStorePersistentVolume.persistentVolumeClaimName }}
persistentVolumeClaim:
claimName: {{ .Values.codimd.imageStorePersistentVolume.persistentVolumeClaimName }}
{{- else }}
persistentVolumeClaim:
claimName: {{ template "codimd.fullname" . }}
{{- end }}
{{ end }}
18 changes: 16 additions & 2 deletions charts/codimd/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "codimd.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- $apiVersion := .Capabilities.APIVersions -}}
{{- if $apiVersion.Has "networking.k8s.io/v1" }}
apiVersion: networking.k8s.io/v1
{{- else }}
{{- if $apiVersion.Has "networking.k8s.io/v1beta1" }}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
{{- else }}
apiVersion: extensions/v1beta1
{{- end }}
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
Expand Down Expand Up @@ -33,9 +38,18 @@ spec:
paths:
{{- range .paths }}
- path: {{ . }}
{{- if $apiVersion.Has "networking.k8s.io/v1" }}
pathType: ImplementationSpecific
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
backend:
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
6 changes: 6 additions & 0 deletions charts/codimd/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.codimd.imageStorePersistentVolume.persistentVolumeClaimName }}
{{ if .Values.codimd.imageStorePersistentVolume.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -6,6 +7,10 @@ metadata:
labels:
app.kubernetes.io/component: pvc
{{- include "codimd.labels" . | nindent 4}}
{{- if .Values.codimd.imageStorePersistentVolume.keepPvc }}
annotations:
"helm.sh/resource-policy": keep
{{- end }}
spec:
accessModes:
{{ range .Values.codimd.imageStorePersistentVolume.accessModes }}
Expand All @@ -17,3 +22,4 @@ spec:
storage: {{ default "10G" .Values.codimd.imageStorePersistentVolume.size | quote }}
{{- include "codimd.storageClass" . | nindent 2 }}
{{ end }}
{{- end }}
3 changes: 2 additions & 1 deletion charts/codimd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ codimd:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem

keepPvc: 'false'

## for advanced used, manually setup environment for used
extraEnvironmentVariables: {}
# CMD_LOGLEVEL: info
Expand Down