diff --git a/overleaf-helm-chart/templates/configmap-mongo-init.yaml b/overleaf-helm-chart/templates/configmap-mongo-init.yaml new file mode 100644 index 0000000..18f3485 --- /dev/null +++ b/overleaf-helm-chart/templates/configmap-mongo-init.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: mongo-init-script + namespace: overleaf +data: + mongodb-init.js: | + rs.initiate({ _id: 'overleaf', members: [{ _id: 0, host: 'mongo:27017' }] }) \ No newline at end of file diff --git a/overleaf-helm-chart/templates/deployment-mongo.yaml b/overleaf-helm-chart/templates/deployment-mongo.yaml index 2e0ad94..1fe2b4b 100644 --- a/overleaf-helm-chart/templates/deployment-mongo.yaml +++ b/overleaf-helm-chart/templates/deployment-mongo.yaml @@ -12,12 +12,18 @@ spec: labels: app: mongo spec: + hostAliases: + - ip: "127.0.0.1" + hostnames: + - "mongo" securityContext: runAsUser: 1001 fsGroup: 0 containers: - name: mongo image: {{ .Values.mongo.image }} + command: ["mongod"] + args: ["--replSet", "{{ .Values.mongo.replSet }}"] ports: - containerPort: {{ .Values.mongo.port }} env: @@ -36,6 +42,9 @@ spec: volumeMounts: - name: mongo-data mountPath: {{ .Values.mongo.volumeMounts.db }} + - name: mongo-init + mountPath: /docker-entrypoint-initdb.d/mongo-init.js + subPath: mongo-init.js resources: requests: cpu: {{ .Values.resources.mongo.requests.cpu }} @@ -46,4 +55,7 @@ spec: volumes: - name: mongo-data persistentVolumeClaim: - claimName: {{ .Values.persistence.mongoData }} \ No newline at end of file + claimName: {{ .Values.persistence.mongoData }} + - name: mongo-init + configMap: + name: mongo-init-script \ No newline at end of file diff --git a/overleaf-helm-chart/templates/deployment-sharelatex.yaml b/overleaf-helm-chart/templates/deployment-sharelatex.yaml index ed1115b..c910397 100644 --- a/overleaf-helm-chart/templates/deployment-sharelatex.yaml +++ b/overleaf-helm-chart/templates/deployment-sharelatex.yaml @@ -23,7 +23,7 @@ spec: - name: OVERLEAF_SITE_LANGUAGE value: {{ .Values.overleaf.siteLanguage | quote }} - name: OVERLEAF_MONGO_URL - value: 'mongodb://{{ .Values.mongo.rootUser }}:{{ .Values.mongo.rootPassword }}@mongo:27017/{{ .Values.mongo.initDb }}?replicaSet={{ .Values.mongo.replSet }}' + value: 'mongodb://{{ .Values.mongo.rootUser | quote }}:{{ .Values.mongo.rootPassword | quote }}@{{ .Values.mongo.host | quote }}:{{ .Values.mongo.port }}/{{ .Values.mongo.initDb | quote }}?authSource=admin&replicaSet={{ .Values.mongo.replSet | quote }}' - name: OVERLEAF_REDIS_HOST value: redis - name: REDIS_HOST diff --git a/overleaf-helm-chart/templates/ingress.yaml b/overleaf-helm-chart/templates/ingress.yaml index ef95100..32ae062 100644 --- a/overleaf-helm-chart/templates/ingress.yaml +++ b/overleaf-helm-chart/templates/ingress.yaml @@ -3,11 +3,7 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: overleaf-ingress - annotations: - kubernetes.io/ingress.class: "traefik" - cert-manager.io/cluster-issuer: "{{ .Values.ingress.certManagerIssuer }}" - # Traefik spezifisch: Enable HTTPS redirect (optional) - traefik.ingress.kubernetes.io/redirect-entry-point: websecure + namespace: {{ .Release.Namespace }} spec: tls: - hosts: @@ -18,7 +14,7 @@ spec: http: paths: - path: / - pathType: Prefix + pathType: ImplementationSpecific backend: service: name: overleaf diff --git a/overleaf-helm-chart/templates/service-mongo.yaml b/overleaf-helm-chart/templates/service-mongo.yaml index f7d32b3..6a3beff 100644 --- a/overleaf-helm-chart/templates/service-mongo.yaml +++ b/overleaf-helm-chart/templates/service-mongo.yaml @@ -2,9 +2,18 @@ apiVersion: v1 kind: Service metadata: name: mongo + namespace: {{ .Values.namespace }} + labels: + app: mongo + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} spec: + type: ClusterIP ports: - port: {{ .Values.mongo.port }} targetPort: {{ .Values.mongo.port }} + protocol: TCP + name: mongo selector: app: mongo diff --git a/overleaf-helm-chart/templates/service-redis.yaml b/overleaf-helm-chart/templates/service-redis.yaml index 07027cb..969e4c9 100644 --- a/overleaf-helm-chart/templates/service-redis.yaml +++ b/overleaf-helm-chart/templates/service-redis.yaml @@ -3,6 +3,7 @@ kind: Service metadata: name: redis spec: + type: ClusterIP ports: - port: {{ .Values.redis.port }} targetPort: {{ .Values.redis.port }} diff --git a/overleaf-helm-chart/templates/service-sharelatex.yaml b/overleaf-helm-chart/templates/service-sharelatex.yaml index 7ce9bb2..2c20732 100644 --- a/overleaf-helm-chart/templates/service-sharelatex.yaml +++ b/overleaf-helm-chart/templates/service-sharelatex.yaml @@ -7,5 +7,6 @@ spec: ports: - port: 80 targetPort: {{ .Values.overleaf.port }} + protocol: TCP selector: app: overleaf diff --git a/overleaf-helm-chart/values.yaml b/overleaf-helm-chart/values.yaml index 0bb9338..a4d3212 100644 --- a/overleaf-helm-chart/values.yaml +++ b/overleaf-helm-chart/values.yaml @@ -23,6 +23,7 @@ mongo: port: 27017 replSet: overleaf initDb: overleaf + host: mongo volumeMounts: db: /data/db rootUser: root