diff --git a/charts/Chart.yaml b/charts/Chart.yaml new file mode 100644 index 0000000000..de991134f8 --- /dev/null +++ b/charts/Chart.yaml @@ -0,0 +1,4 @@ +name: open-event +description: A generated Helm Chart for open-event +version: 0.0.1 +apiVersion: v1 diff --git a/charts/README.md b/charts/README.md new file mode 100644 index 0000000000..d3885b6357 --- /dev/null +++ b/charts/README.md @@ -0,0 +1 @@ +This chart was created by Kompose diff --git a/charts/charts/postgresql-8.6.10.tgz b/charts/charts/postgresql-8.6.10.tgz new file mode 100644 index 0000000000..70aee37a36 Binary files /dev/null and b/charts/charts/postgresql-8.6.10.tgz differ diff --git a/charts/charts/redis-10.5.14.tgz b/charts/charts/redis-10.5.14.tgz new file mode 100644 index 0000000000..1ecbd9a021 Binary files /dev/null and b/charts/charts/redis-10.5.14.tgz differ diff --git a/charts/requirements.lock b/charts/requirements.lock new file mode 100644 index 0000000000..352f5bf828 --- /dev/null +++ b/charts/requirements.lock @@ -0,0 +1,9 @@ +dependencies: +- name: redis + repository: https://charts.bitnami.com/bitnami + version: 10.5.14 +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 8.6.10 +digest: sha256:de67d778c0dfdc8c34628e2ef41e39c41bafc4a9a6d39a79a8522107a5b44066 +generated: "2020-03-29T16:29:15.534092+08:00" diff --git a/charts/requirements.yaml b/charts/requirements.yaml new file mode 100644 index 0000000000..ff127c7f14 --- /dev/null +++ b/charts/requirements.yaml @@ -0,0 +1,7 @@ +dependencies: + - name: redis + version: 10.5.14 + repository: "@bitnami" + - name: postgresql + version: 8.6.10 + repository: "@bitnami" \ No newline at end of file diff --git a/charts/templates/_helpers.tpl b/charts/templates/_helpers.tpl new file mode 100644 index 0000000000..cbebdfbdf6 --- /dev/null +++ b/charts/templates/_helpers.tpl @@ -0,0 +1,28 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "open-event.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "open-event.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "open-event.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} \ No newline at end of file diff --git a/charts/templates/celery-claim0-persistentvolumeclaim.yaml b/charts/templates/celery-claim0-persistentvolumeclaim.yaml new file mode 100644 index 0000000000..2aaa9c4528 --- /dev/null +++ b/charts/templates/celery-claim0-persistentvolumeclaim.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + app.kubernetes.io/name: {{ include "open-event.name" . }} + helm.sh/chart: {{ include "open-event.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "open-event.name" . }} + name: celery-static +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{.Values.celery.storage.static.size}} diff --git a/charts/templates/celery-claim1-persistentvolumeclaim.yaml b/charts/templates/celery-claim1-persistentvolumeclaim.yaml new file mode 100644 index 0000000000..a2b238a466 --- /dev/null +++ b/charts/templates/celery-claim1-persistentvolumeclaim.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + app.kubernetes.io/name: {{ include "open-event.name" . }} + helm.sh/chart: {{ include "open-event.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "open-event.name" . }} + name: celery-generated +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{.Values.celery.storage.generated.size}} diff --git a/charts/templates/celery-deployment.yaml b/charts/templates/celery-deployment.yaml new file mode 100644 index 0000000000..b691f8fbed --- /dev/null +++ b/charts/templates/celery-deployment.yaml @@ -0,0 +1,45 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + labels: + app.kubernetes.io/name: {{ include "open-event.name" . }} + helm.sh/chart: {{ include "open-event.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "open-event.name" . }} + name: celery +spec: + replicas: {{.Values.celery.replicas}} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "open-event.name" . }}-postgres + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "open-event.name" . }}-postgres + spec: + containers: + - name: {{.Values.celery.name}} + image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.imagePullPolicy }} + args: + - celery + {{- if .Values.env }} + env: +{{- toYaml .Values.env | nindent 10 }} + {{end}} + volumeMounts: + - name: celery-static + mountPath: /data/app/static + + - name: celery-generated + mountPath: /data/app/generated + + volumes: + - name: celery-static + persistentVolumeClaim: + claimName: celery-static + - name: celery-generated + persistentVolumeClaim: + claimName: celery-generated diff --git a/charts/templates/frontend-deployment.yaml b/charts/templates/frontend-deployment.yaml new file mode 100644 index 0000000000..4fa955ac31 --- /dev/null +++ b/charts/templates/frontend-deployment.yaml @@ -0,0 +1,36 @@ +{{- if .Values.frontend.enable }} +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/name: {{ include "open-event.name" . }}-frontend + helm.sh/chart: {{ include "open-event.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "open-event.name" . }} + name: {{.Values.frontend.name}} +spec: + replicas: {{.Values.frontend.replicas}} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "open-event.name" . }}-frontend + strategy: + type: RollingUpdate + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "open-event.name" . }}-frontend + spec: + containers: + {{- if .Values.env }} + - env: +{{- toYaml .Values.env | nindent 8 }} + {{- end }} + image: "{{ .Values.frontend.image.repo }}:{{ .Values.frontend.image.tag }}" + imagePullPolicy: {{ .Values.frontend.imagePullPolicy }} + name: {{ .Values.frontend.name }} + ports: + - name: {{ .Values.frontend.serviceName }} + containerPort: {{ .Values.frontend.servicePort }} + protocol: TCP +{{end}} diff --git a/charts/templates/frontend-service.yaml b/charts/templates/frontend-service.yaml new file mode 100644 index 0000000000..148c8fa62f --- /dev/null +++ b/charts/templates/frontend-service.yaml @@ -0,0 +1,20 @@ +{{- if .Values.frontend.enable }} +apiVersion: v1 +kind: Service +metadata: + labels: + app.kubernetes.io/name: {{ include "open-event.name" . }}-frontend + helm.sh/chart: {{ include "open-event.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "open-event.name" . }} + name: {{ .Values.frontend.serviceName }} +spec: + type: {{ .Values.frontend.serviceType }} + ports: + - port: {{ .Values.frontend.exportPort }} + protocol: TCP + targetPort: {{ .Values.frontend.servicePort }} + selector: + app.kubernetes.io/name: {{ include "open-event.name" . }}-frontend +{{end}} \ No newline at end of file diff --git a/charts/templates/ingress.yaml b/charts/templates/ingress.yaml new file mode 100644 index 0000000000..ac556356bb --- /dev/null +++ b/charts/templates/ingress.yaml @@ -0,0 +1,19 @@ +{{- if .Values.frontend.enable }} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + annotations: + cert-manager.io/cluster-issuer: letsencrypt-prod + kubernetes.io/tls-acme: "true" + name: {{ template "open-event.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "open-event.name" . }}-frontend + helm.sh/chart: {{ include "open-event.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "open-event.name" . }} +spec: + backend: + serviceName: {{ .Values.frontend.serviceName }} + servicePort: {{ .Values.frontend.exportPort }} +{{end}} diff --git a/charts/templates/web-claim0-persistentvolumeclaim.yaml b/charts/templates/web-claim0-persistentvolumeclaim.yaml new file mode 100644 index 0000000000..655b6d87f5 --- /dev/null +++ b/charts/templates/web-claim0-persistentvolumeclaim.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + app.kubernetes.io/name: {{ include "open-event.name" . }} + helm.sh/chart: {{ include "open-event.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "open-event.name" . }} + name: server-static +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{.Values.server.storage.static.size}} diff --git a/charts/templates/web-claim1-persistentvolumeclaim.yaml b/charts/templates/web-claim1-persistentvolumeclaim.yaml new file mode 100644 index 0000000000..679547048b --- /dev/null +++ b/charts/templates/web-claim1-persistentvolumeclaim.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + app.kubernetes.io/name: {{ include "open-event.name" . }} + helm.sh/chart: {{ include "open-event.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "open-event.name" . }} + name: server-generated +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{.Values.server.storage.generated.size}} diff --git a/charts/templates/web-deployment.yaml b/charts/templates/web-deployment.yaml new file mode 100644 index 0000000000..94b0f4c1e9 --- /dev/null +++ b/charts/templates/web-deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/name: {{ include "open-event.name" . }}-server + helm.sh/chart: {{ include "open-event.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "open-event.name" . }} + name: open-event-server +spec: + replicas: {{.Values.server.replicas}} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "open-event.name" . }}-server + strategy: + type: {{.Values.server.strategy}} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "open-event.name" . }}-server + spec: + containers: + - name: {{.Values.server.name}} + image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.imagePullPolicy }} + {{- if .Values.env }} + env: +{{- toYaml .Values.env | nindent 8 }} + {{- end }} + volumeMounts: + - name: server-static + mountPath: /data/app/static + - name: server-generated + mountPath: /data/app/generated + ports: + - name: rest + containerPort: {{ .Values.server.containerPort }} + protocol: TCP + volumes: + - name: server-static + persistentVolumeClaim: + claimName: server-static + - name: server-generated + persistentVolumeClaim: + claimName: server-generated + restartPolicy: {{.Values.server.restartPolicy}} + + diff --git a/charts/templates/web-service.yaml b/charts/templates/web-service.yaml new file mode 100644 index 0000000000..d2be4f7667 --- /dev/null +++ b/charts/templates/web-service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app.kubernetes.io/name: {{ include "open-event.name" . }}-web + helm.sh/chart: {{ include "open-event.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/part-of: {{ include "open-event.name" . }} + name: open-event-server +spec: + ports: + - name: rest + port: {{ .Values.server.servicePort }} + targetPort: {{ .Values.server.containerPort }} + selector: + app.kubernetes.io/name: {{ include "open-event.name" . }}-web diff --git a/charts/values.yaml b/charts/values.yaml new file mode 100644 index 0000000000..26c52e1be3 --- /dev/null +++ b/charts/values.yaml @@ -0,0 +1,173 @@ +## OpenEvent configuration +## Ref: https://github.com/fossasia/open-event-server +## +nameOverride: "" +fullnameOverride: "" + + +image: + repo: eventyay/open-event-server + tag: latest + imagePullPolicy: Always + securityContext: {} + imagePullSecrets: [] + +## Celery part of open event server +celery: + replicas: 1 + name: opev-celery + strategy: Recreate + restartPolicy: Always + storage: + static: + size: 100Mi + generated: + size: 100Mi + +## Server part of open event server +server: + replicas: 1 + servicePort: 8080 + containerPort: 8080 + name: open-event-server + restartPolicy: Always + storage: + static: + size: 100Mi + generated: + size: 100Mi + + # ComfigMap for open event server + config: + APP_CONFIG: config.DevelopmentConfig + DATABASE_URL: postgresql://open_event_user:opev_pass@127.0.0.1:5432/oevent + FLASK_APP: app.instance + INTEGRATE_SOCKETIO: "false" + POSTGRES_DB: open_event + POSTGRES_PASSWORD: opev_pass + POSTGRES_USER: open_event_user + TEST_DATABASE_URL: postgresql://open_event_user:opev_pass@127.0.0.1:5432/opev_test + +# Open event environment varibale +env: + - name: ADMIN_EMAIL + value: 'test@gmail.com' + - name: ADMIN_PASSWORD + value: '12345678' + - name: APP_CONFIG + valueFrom: + configMapKeyRef: + name: env + key: APP_CONFIG + - name: C_FORCE_ROOT + value: "true" + - name: DATABASE_URL + valueFrom: + configMapKeyRef: + name: env + key: DATABASE_URL + - name: FLASK_APP + valueFrom: + configMapKeyRef: + name: env + key: FLASK_APP + - name: INTEGRATE_SOCKETIO + valueFrom: + configMapKeyRef: + key: INTEGRATE_SOCKETIO + name: env + - name: POSTGRES_DB + valueFrom: + configMapKeyRef: + name: env + key: POSTGRES_DB + - name: POSTGRES_HOST + value: postgres + - name: POSTGRES_PASSWORD + valueFrom: + configMapKeyRef: + key: POSTGRES_PASSWORD + name: env + - name: POSTGRES_USER + valueFrom: + configMapKeyRef: + key: POSTGRES_USER + name: env + - name: REDIS_URL + value: redis://redis:6379/0 + - name: TEST_DATABASE_URL + valueFrom: + configMapKeyRef: + key: TEST_DATABASE_URL + name: env + +# Postgresql confgiuration +postgresql: + global: + postgresql: + postgresqlPassword: "" + postgresqlDatabase: "" + + persistence: + enabled: true + size: 100Mi + +redis: + name: redis + servicePortHttp: 6379 + + master: + persistence: + enabled: true + ## The path the volume will be mounted at, useful when using different + ## Redis images. + path: /data + ## The subdirectory of the volume to mount to, useful in dev environments + ## and one PV for multiple services. + subPath: "" + ## redis data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + accessModes: + - ReadWriteOnce + size: 100Mi + slave: + persistence: + enabled: true + ## The path the volume will be mounted at, useful when using different + ## Redis images. + path: /data + ## The subdirectory of the volume to mount to, useful in dev environments + ## and one PV for multiple services. + subPath: "" + ## redis data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ##e + accessModes: + - ReadWriteOnce + size: 100Mi + +## Frontend end of open event server +# You need to manually commit and upload it to any register you like +frontend: + # if the enable is true, the open server front will be enable + enable: False + name: open-event-frontend + replicas: 1 + servicePort: 4000 + exportPort: 4200 + serviceType: NodePort + serviceName: rest + repo: eventyay/open-event-frontend + tag: latest + imagePullPolicy: Always + securityContext: {} + imagePullSecrets: []