Skip to content

Commit 4ba7cf4

Browse files
committed
init commit
0 parents  commit 4ba7cf4

12 files changed

Lines changed: 575 additions & 0 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea/
2+
.vscode/
3+
charts/**/charts/*.tgz

charts/codimd/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/codimd/Chart.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
name: codimd
3+
description: A CodiMD Helm chart for Kubernetes
4+
5+
# This is the chart version. This version number should be incremented each time you make changes
6+
# to the chart and its templates, including the app version.
7+
version: 0.1.0
8+
9+
# This is the version number of the application being deployed. This version number should be
10+
# incremented each time you make changes to the application.
11+
appVersion: 2.0.0
12+
13+
dependencies:
14+
- name: postgresql
15+
version: 8.6.10
16+
condition: postgresql.enabled, global.postgresql.enabled
17+
repository: https://charts.bitnami.com/bitnami

charts/codimd/requirements.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: postgresql
3+
repository: https://charts.bitnami.com/bitnami
4+
version: 8.6.10
5+
digest: sha256:bcf451cb7316ebf38ba4769d636299bf4f5f639922a39355d78e7fad58901d83
6+
generated: "2020-03-31T05:06:22.8997+08:00"

charts/codimd/requirements.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dependencies:
2+
- name: postgresql
3+
version: 8.6.10
4+
condition: postgresql.enabled, global.postgresql.enabled
5+
repository: https://charts.bitnami.com/bitnami
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "codimd.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
6+
{{- end -}}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
*/}}
12+
{{- define "codimd.fullname" -}}
13+
{{- if .Values.fullnameOverride -}}
14+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
15+
{{- else -}}
16+
{{- $name := default .Chart.Name .Values.nameOverride -}}
17+
{{- if contains $name .Release.Name -}}
18+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
19+
{{- else -}}
20+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
21+
{{- end -}}
22+
{{- end -}}
23+
{{- end -}}
24+
25+
{{/*
26+
Create chart name and version as used by the chart label.
27+
*/}}
28+
{{- define "codimd.chart" -}}
29+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
30+
{{- end -}}
31+
32+
{{/*
33+
Common labels
34+
*/}}
35+
{{- define "codimd.labels" -}}
36+
app.kubernetes.io/name: {{ include "codimd.name" . }}
37+
helm.sh/chart: {{ include "codimd.chart" . }}
38+
app.kubernetes.io/managed-by: {{ .Release.Service }}
39+
app.kubernetes.io/instance: {{ .Release.Name }}
40+
app.kubernetes.io/version: {{ default .Chart.AppVersion .Values.image.tag }}
41+
{{- end -}}
42+
43+
44+
{{/*
45+
Return the docker image
46+
*/}}
47+
{{- define "codimd.image" -}}
48+
{{- $registryName := default "nabo.codimd.dev" .Values.image.registry -}}
49+
{{- $repositoryName := default "hackmdio/hackmd" .Values.image.repository -}}
50+
{{- $tag := default .Chart.AppVersion .Values.image.tag -}}
51+
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
52+
{{- end -}}
53+
54+
{{/*
55+
Return the CodiMD domain
56+
*/}}
57+
{{- define "codimd.domain" -}}
58+
{{- $domain := default .Values.codimd.connection.domain .Values.ingress.hostname -}}
59+
{{- printf "%s" $domain -}}
60+
{{- end -}}
61+
62+
{{/*
63+
Embedded PostgreSQL service name
64+
*/}}
65+
{{- define "codimd.postgresql-svc" -}}
66+
{{- if .Values.postgresql.fullnameOverride -}}
67+
{{- .Values.postgresql.fullnameOverride | trunc 63 | trimSuffix "-" -}}
68+
{{- else -}}
69+
{{- $name := default "postgresql" .Values.postgresql.nameOverride -}}
70+
{{- if contains $name .Release.Name -}}
71+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
72+
{{- else -}}
73+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
74+
{{- end -}}
75+
{{- end -}}
76+
{{- end -}}
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: {{ template "codimd.fullname" . }}-auth-env
5+
stringData:
6+
CMD_EMAIL: {{ .Values.codimd.authentication.local.enabled | toString | quote }}
7+
CMD_ALLOW_EMAIL_REGISTER: {{ .Values.codimd.authentication.local.allowRegister | toString | quote }}
8+
9+
{{/* Authentication - Bitbucket */}}
10+
{{ if .Values.codimd.authentication.bitbucket.enabled }}
11+
CMD_BITBUCKET_CLIENTID: {{ .Values.codimd.authentication.bitbucket.key | toString | quote }}
12+
CMD_BITBUCKET_CLIENTSECRET: {{ .Values.codimd.authentication.bitbucket.secret | toString | quote }}
13+
{{ end }}
14+
15+
{{/* Authentication - Dropbox */}}
16+
{{ if .Values.codimd.authentication.dropbox.enabled }}
17+
CMD_DROPBOX_CLIENTID: {{ .Values.codimd.authentication.dropbox.appKey | toString | quote }}
18+
CMD_DROPBOX_CLIENTSECRET: {{ .Values.codimd.authentication.dropbox.appSecret | toString | quote }}
19+
{{ end }}
20+
21+
{{/* Authentication - Facebook */}}
22+
{{ if .Values.codimd.authentication.facebook.enabled }}
23+
CMD_FACEBOOK_CLIENTID: {{ .Values.codimd.authentication.facebook.clientId | toString | quote }}
24+
CMD_FACEBOOK_CLIENTSECRET: {{ .Values.codimd.authentication.facebook.secret | toString | quote }}
25+
{{ end }}
26+
27+
{{/* Authentication - GitHub */}}
28+
{{ if .Values.codimd.authentication.github.enabled }}
29+
{{ if .Values.codimd.authentication.github.enterpriseUrl }}
30+
CMD_GITHUB_ENTERPRISE_URL: {{ .Values.codimd.authentication.github.enterpriseUrl | trim | toString | quote }}
31+
{{ end }}
32+
CMD_GITHUB_CLIENTID: {{ .Values.codimd.authentication.github.clientId | toString | quote }}
33+
CMD_GITHUB_CLIENTSECRET: {{ .Values.codimd.authentication.github.secret | toString | quote }}
34+
{{ end }}
35+
36+
{{/* Authentication - GitLab */}}
37+
{{ if .Values.codimd.authentication.gitlab.enabled }}
38+
{{ if .Values.codimd.authentication.gitlab.domain}}
39+
CMD_GITLAB_BASEURL: {{ .Values.codimd.authentication.gitlab.domain | toString | quote }}
40+
{{ end }}
41+
{{ if .Values.codimd.authentication.gitlab.scope }}
42+
CMD_GITLAB_SCOPE: {{ .Values.codimd.authentication.gitlab.scope | toString | quote }}
43+
{{ end }}
44+
CMD_GITLAB_CLIENTID: {{ .Values.codimd.authentication.gitlab.applicationId | toString | quote }}
45+
CMD_GITLAB_CLIENTSECRET: {{ .Values.codimd.authentication.gitlab.secret | toString | quote }}
46+
{{ end }}
47+
48+
{{/* Authentication - Google */}}
49+
{{ if .Values.codimd.authentication.google.enabled }}
50+
CMD_GOOGLE_CLIENTID: {{ .Values.codimd.authentication.google.clientId | toString | quote }}
51+
CMD_GOOGLE_CLIENTSECRET: {{ .Values.codimd.authentication.google.secret | toString | quote }}
52+
{{ if .Values.codimd.authentication.google.hostedDomain }}
53+
CMD_GOOGLE_HOSTEDDOMAIN: {{ .Values.codimd.authentication.google.hostedDomain | toString | quote }}
54+
{{ end }}
55+
{{ end }}
56+
57+
{{/* Authentication - LDAP */}}
58+
{{ if .Values.codimd.authentication.ldap.enabled }}
59+
CMD_LDAP_PROVIDERNAME: {{ .Values.codimd.authentication.ldap.providerName | toString | quote }}
60+
CMD_LDAP_URL: {{ .Values.codimd.authentication.ldap.url | toString | quote }}
61+
{{ if .Values.codimd.authentication.ldap.tlsCA }}
62+
CMD_LDAP_TLS_CA: {{ .Values.codimd.authentication.ldap.providerName | toString | quote }}
63+
{{ end }}
64+
CMD_LDAP_BINDDN: {{ .Values.codimd.authentication.ldap.bindDN | toString | quote }}
65+
{{ if .Values.codimd.authentication.ldap.bindCredentials }}
66+
CMD_LDAP_BINDCREDENTIALS: {{ .Values.codimd.authentication.ldap.bindCredentials | toString | quote }}
67+
{{ end }}
68+
{{ if .Values.codimd.authentication.ldap.searchBase }}
69+
CMD_LDAP_SEARCHBASE: {{ .Values.codimd.authentication.ldap.searchBase | toString | quote }}
70+
{{ end }}
71+
{{ if .Values.codimd.authentication.ldap.searchFilter }}
72+
CMD_LDAP_SEARCHFILTER: {{ .Values.codimd.authentication.ldap.searchFilter | toString | quote }}
73+
{{ end }}
74+
{{ if .Values.codimd.authentication.ldap.searchAttributes }}
75+
CMD_LDAP_SEARCHATTRIBUTES: {{ .Values.codimd.authentication.ldap.searchAttributes | toString | quote }}
76+
{{ end }}
77+
{{ if .Values.codimd.authentication.ldap.attributes.id}}
78+
CMD_LDAP_USERIDFIELD: {{ .Values.codimd.authentication.ldap.attributes.id | toString | quote }}
79+
{{ end }}
80+
{{ if .Values.codimd.authentication.ldap.attributes.username }}
81+
CMD_LDAP_USERNAMEFIELD: {{ .Values.codimd.authentication.ldap.attributes.username | toString | quote }}
82+
{{ end }}
83+
{{ end }}
84+
85+
{{/* Authentication - Mattermost */}}
86+
{{ if .Values.codimd.authentication.mattermost.enabled }}
87+
CMD_MATTERMOST_BASEURL: {{ .Values.codimd.authentication.mattermost.domain | toString | quote }}
88+
CMD_MATTERMOST_CLIENTID: {{ .Values.codimd.authentication.mattermost.clientId | toString | quote }}
89+
CMD_MATTERMOST_CLIENTSECRET: {{ .Values.codimd.authentication.mattermost.secret | toString | quote }}
90+
{{ end }}
91+
92+
{{/* Authentication - OAuth2 */}}
93+
{{ if .Values.codimd.authentication.oauth2.enabled }}
94+
CMD_OAUTH2_PROVIDERNAME: {{ .Values.codimd.authentication.oauth2.providerName | toString | quote }}
95+
CMD_OAUTH2_BASEURL: {{ .Values.codimd.authentication.oauth2.domain | toString | quote }}
96+
CMD_OAUTH2_CLIENT_ID: {{ .Values.codimd.authentication.oauth2.clientId | toString | quote }}
97+
CMD_OAUTH2_CLIENT_SECRET: {{ .Values.codimd.authentication.oauth2.secret | toString | quote }}
98+
CMD_OAUTH2_AUTHORIZATION_URL: {{ .Values.codimd.authentication.oauth2.authorizationUrl | toString | quote }}
99+
CMD_OAUTH2_TOKEN_URL: {{ .Values.codimd.authentication.oauth2.tokenUrl | toString | quote }}
100+
CMD_OAUTH2_USER_PROFILE_URL: {{ .Values.codimd.authentication.oauth2.userProfileUrl | toString | quote }}
101+
CMD_OAUTH2_SCOPE: {{ .Values.codimd.authentication.oauth2.scope | toString | quote }}
102+
CMD_OAUTH2_USER_PROFILE_USERNAME_ATTR: {{ .Values.codimd.authentication.oauth2.attributes.username | toString | quote }}
103+
CMD_OAUTH2_USER_PROFILE_DISPLAY_NAME_ATTR: {{ .Values.codimd.authentication.oauth2.attributes.displayName | toString | quote }}
104+
CMD_OAUTH2_USER_PROFILE_EMAIL_ATTR: {{ .Values.codimd.authentication.oauth2.attributes.email | toString | quote }}
105+
{{ end }}
106+
107+
{{/* Authentication - OAuth2 */}}
108+
{{ if .Values.codimd.authentication.saml.enabled }}
109+
CMD_SAML_IDPSSOURL: {{ .Values.codimd.authentication.saml.idpSSOUrl | toString | quote }}
110+
{{ if .Values.codimd.authentication.saml.idpCert }}
111+
CMD_SAML_IDPCERT: {{ .Values.codimd.authentication.saml.idpCert | toString | quote }}
112+
{{ end }}
113+
CMD_SAML_ISSUER: {{ .Values.codimd.authentication.saml.issuer | toString | quote }}
114+
CMD_SAML_IDENTIFIERFORMAT: {{ .Values.codimd.authentication.saml.identifierFormat | toString | quote }}
115+
CMD_SAML_DISABLEREQUESTEDAUTHNCONTEXT: {{ .Values.codimd.authentication.saml.disableRequestedAuthnContext | toString | quote }}
116+
CMD_SAML_GROUPATTRIBUTE: {{ .Values.codimd.authentication.saml.groupAttribute | toString | quote }}
117+
CMD_SAML_EXTERNALGROUPS: {{ .Values.codimd.authentication.saml.externalGroups | toString | quote }}
118+
CMD_SAML_REQUIREDGROUPS: {{ .Values.codimd.authentication.saml.requiredGroups | toString | quote }}
119+
CMD_SAML_ATTRIBUTE_ID: {{ .Values.codimd.authentication.saml.attributes.id | toString | quote }}
120+
CMD_SAML_ATTRIBUTE_USERNAME: {{ .Values.codimd.authentication.saml.attributes.username | toString | quote }}
121+
CMD_SAML_ATTRIBUTE_EMAIL: {{ .Values.codimd.authentication.saml.attributes.email | toString | quote }}
122+
{{ end }}
123+
124+
{{/* Authentication - Twitter */}}
125+
{{ if .Values.codimd.authentication.twitter.enabled }}
126+
CMD_TWITTER_CONSUMERKEY: {{ .Values.codimd.authentication.twitter.consumerKey | toString | quote }}
127+
CMD_TWITTER_CONSUMERSECRET: {{ .Values.codimd.authentication.twitter.comsumerSecret | toString | quote }}
128+
{{ end }}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: {{ template "codimd.fullname" . }}-database-secret
5+
stringData:
6+
{{ if .Values.postgresql.enabled }}
7+
connection: "postgres://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.postgresqlPassword }}@{{ template "codimd.postgresql-svc" . }}/{{ .Values.postgresql.postgresqlDatabase }}"
8+
{{ else }}
9+
connection: "{{ .Values.codimd.database.type }}://{{ .Values.codimd.database.username }}:{{ .Values.codimd.database.password }}@{{ .Values.codimd.database.host }}:{{ .Values.codimd.database.port }}/{{ .Values.codimd.database.databaseName }}"
10+
{{ end }}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ template "codimd.fullname" . }}
5+
labels:
6+
app.kubernetes.io/component: server
7+
{{- include "codimd.labels" . | nindent 4 }}
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app.kubernetes.io/component: server
13+
{{- include "codimd.labels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
name: {{ template "codimd.fullname" . }}
17+
labels:
18+
app.kubernetes.io/component: server
19+
{{- include "codimd.labels" . | nindent 8 }}
20+
spec:
21+
{{ if .Values.image.pullSecrets }}
22+
imagePullSecrets:
23+
{{ .Values.image.pullSecrets | nindent 8 }}
24+
{{end }}
25+
containers:
26+
- name: codimd
27+
image: {{ template "codimd.image" . }}
28+
imagePullPolicy: {{ .Values.image.pullPolicy }}
29+
env:
30+
- name: CMD_USE_CDN
31+
value: {{ .Values.codimd.security.useCDN | quote }}
32+
- name: CMD_DB_URL
33+
valueFrom:
34+
secretKeyRef:
35+
name: {{ template "codimd.fullname" . }}-database-secret
36+
key: connection
37+
envFrom:
38+
- secretRef:
39+
name: {{ template "codimd.fullname" . }}-auth-env
40+
ports:
41+
- name: http
42+
containerPort: 3000
43+
restartPolicy: Always
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{{ if .Values.ingress.enabled }}
2+
apiVersion: networking.k8s.io/v1beta1
3+
kind: Ingress
4+
metadata:
5+
name: {{ template "codimd.fullname" . }}
6+
{{ if .Values.ingress.annotation}}
7+
annotations:
8+
{{ .Values.ingress.annotation | nindent 4 }}
9+
{{ end }}
10+
spec:
11+
rules:
12+
- host: {{ .Values.ingress.hostname }}
13+
http:
14+
paths:
15+
- backend:
16+
serviceName: {{ template "codimd.fullname" . }}-svc
17+
servicePort: 80
18+
{{ if .Values.ingress.tlsSecret }}
19+
tls:
20+
- hosts: {{ .Values.ingress.hostname }}
21+
secretName: {{ .Values.ingress.tlsSecret }}
22+
{{ end }}
23+
{{ end }}

0 commit comments

Comments
 (0)