2
0
Эх сурвалжийг харах

Merge pull request #3369 from jiangytcn/helm

fix: update helm mongodb dependency
Lauri Ojansivu 4 жил өмнө
parent
commit
d957768a39

+ 4 - 3
helm/wekan/Chart.yaml

@@ -1,7 +1,6 @@
 name: wekan
-version: 1.0.0
-appVersion: 2.x.x
-kubeVersion: "^1.8.0-0"
+version: 1.0.1
+apiVersion: v1
 description: Open Source kanban
 home: https://wekan.github.io/
 icon: https://wekan.github.io/wekan-logo.svg
@@ -10,4 +9,6 @@ sources:
 maintainers:
   - name: technotaff
     email: github@randall.cc
+  - name: jiangytcn
+    email: jiangyt.cn@gmail.com
 engine: gotpl

+ 4 - 4
helm/wekan/requirements.yaml

@@ -1,5 +1,5 @@
 dependencies:
-- name: mongodb-replicaset
-  version: 3.11.x
-  repository: "https://kubernetes-charts.storage.googleapis.com/"
-  condition: mongodb-replicaset.enabled
+- name: mongodb
+  version: 10.0.x
+  repository: "https://charts.bitnami.com/bitnami"
+  condition: mongodb.enabled

+ 13 - 7
helm/wekan/templates/_helpers.tpl

@@ -62,21 +62,27 @@ Create the name of the service account to use for the api component
 Create a default fully qualified mongodb-replicaset name.
 We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
 */}}
-{{- define "wekan.mongodb-replicaset.fullname" -}}
-{{- $name := default "mongodb-replicaset" (index .Values "mongodb-replicaset" "nameOverride") -}}
+{{- define "wekan.mongodb.svcname" -}}
+{{- $name := default "mongodb" (index .Values "mongodb" "nameOverride") -}}
+{{- if eq .Values.mongodb.architecture "replicaset" }}
+{{- printf "%s-%s-headless" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
 {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
 {{- end -}}
+{{- end -}}
 
 {{/*
 Create the MongoDB URL. If MongoDB is installed as part of this chart, use k8s service discovery,
 else use user-provided URL.
 */}}
-{{- define "mongodb-replicaset.url" -}}
-{{- if (index .Values "mongodb-replicaset" "enabled") -}}
-{{- $count := (int (index .Values "mongodb-replicaset" "replicas")) -}}
+{{- define "mongodb.url" -}}
+{{- if (index .Values "mongodb" "enabled") -}}
+{{- $count := (int (index .Values "mongodb" "replicaCount")) -}}
 {{- $release := .Release.Name -}}
-mongodb://{{ $release }}-mongodb-replicaset:27017/admin?replicaSet={{ index .Values "mongodb-replicaset" "replicaSetName" }}
+{{- $replicaSetName := (index .Values "mongodb" "replicaSetName") -}}
+{{- $mongodbSvcName := include "wekan.mongodb.svcname" . -}}
+mongodb://{{- range $v := until $count }}{{ $release }}-mongodb-{{ $v }}.{{ $mongodbSvcName }}:27017{{ if ne $v (sub $count 1) }},{{- end -}}{{- end -}}?replicaSet={{ $replicaSetName }}
 {{- else -}}
-{{- index .Values "mongodb-replicaset" "url" -}}
+{{- index .Values "mongodb" "url" -}}
 {{- end -}}
 {{- end -}}

+ 1 - 1
helm/wekan/templates/deployment.yaml

@@ -36,7 +36,7 @@ spec:
             - name: ROOT_URL
               value: {{ .Values.root_url | default "https://wekan.local" | quote }}
             - name: MONGO_URL
-              value: "{{ template "mongodb-replicaset.url" . }}"
+              value: "{{ template "mongodb.url" . }}"
           {{- range $key := .Values.env }}
           {{- if .value }}
             - name: {{ .name }}

+ 5 - 2
helm/wekan/templates/ingress.yaml

@@ -2,7 +2,7 @@
 {{- $fullName := include "wekan.fullname" . -}}
 {{- $servicePort := .Values.service.port -}}
 {{- $ingressPath := .Values.ingress.path -}}
-apiVersion: extensions/v1beta1
+apiVersion: networking.k8s.io/v1beta1
 kind: Ingress
 metadata:
   name: {{ $fullName }}
@@ -27,6 +27,9 @@ spec:
       secretName: {{ .secretName }}
   {{- end }}
 {{- end }}
+  backend:
+    serviceName: {{ $fullName }}
+    servicePort: 8080
   rules:
   {{- range .Values.ingress.hosts }}
     - host: {{ . }}
@@ -35,6 +38,6 @@ spec:
           - path: {{ $ingressPath }}
             backend:
               serviceName: {{ $fullName }}
-              servicePort: 80
+              servicePort: 8080
   {{- end }}
 {{- end }}

+ 0 - 14
helm/wekan/templates/secrets.yaml

@@ -1,14 +0,0 @@
-apiVersion: v1
-kind: Secret
-metadata:
-  name: {{ template "wekan.fullname" . }}
-  labels:
-    app: {{ template "wekan.name" . }}
-    chart: {{ template "wekan.chart" . }}
-    component: wekan
-    heritage: {{ .Release.Service }}
-    release: {{ .Release.Name }}
-type: Opaque
-data:
-  accessKey: {{ .Values.credentials.accessKey | b64enc }}
-  secretKey: {{ .Values.credentials.secretKey | b64enc }}

+ 0 - 27
helm/wekan/templates/tests/test-cloudserver.yaml

@@ -1,27 +0,0 @@
-apiVersion: v1
-kind: Pod
-metadata:
-  name: {{ template "wekan.fullname" . }}-test
-  annotations:
-    "helm.sh/hook": test-success
-spec:
-  containers:
-  - name: {{ template "wekan.fullname" . }}-test
-    imagePullPolicy: IfNotPresent
-    image: "docker.io/mesosphere/aws-cli:1.14.5"
-    command:
-      - sh
-      - -c
-      - aws s3 --endpoint-url=http://{{ include "wekan.fullname" . }} --region=us-east-1 ls
-    env:
-      - name: AWS_ACCESS_KEY_ID
-        valueFrom:
-          secretKeyRef:
-            name: {{ template "wekan.fullname" . }}
-            key: accessKey
-      - name: AWS_SECRET_ACCESS_KEY
-        valueFrom:
-          secretKeyRef:
-            name: {{ template "wekan.fullname" . }}
-            key: secretKey
-  restartPolicy: Never

+ 6 - 15
helm/wekan/values.yaml

@@ -22,12 +22,6 @@ image:
 
 replicaCount: 1
 
-## Specify wekan credentials
-##
-credentials:
-  accessKey: access-key
-  secretKey: secret-key
-
 ## Specify additional environmental variables for the Deployment
 ##
 env:
@@ -36,7 +30,7 @@ env:
 
 service:
   type: NodePort
-  port: 80
+  port: 8080
   annotations: {}
     # prometheus.io/scrape: "true"
     # prometheus.io/port: "8000"
@@ -104,13 +98,10 @@ autoscaling:
 # MongoDB:
 # ------------------------------------------------------------------------------
 
-mongodb-replicaset:
+mongodb:
   enabled: true
-  replicas: 3
+  architecture: replicaset
+  replicaCount: 3
   replicaSetName: rs0
-  securityContext:
-    runAsUser: 1000
-    fsGroup: 1000
-    runAsNonRoot: true
-  #image:
-  #  tag: 3.2.21
+  auth:
+    enabled: false