| # |
| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| |
| apiVersion: apps/v1 |
| kind: Deployment |
| metadata: |
| labels: |
| app: {{ template "common.names.fullname" . }} |
| name: {{ template "common.names.fullname" . }} |
| spec: |
| replicas: {{ .Values.compute.replicas | default 1 }} |
| selector: |
| matchLabels: |
| app: {{ template "common.names.fullname" . }} |
| strategy: |
| rollingUpdate: |
| maxSurge: 25% |
| maxUnavailable: 25% |
| type: RollingUpdate |
| template: |
| metadata: |
| labels: |
| app: {{ template "common.names.fullname" . }} |
| spec: |
| {{- if .Values.compute.mysqlConnector.version }} |
| initContainers: |
| - name: download-mysql-jar |
| image: busybox:1.35.0 |
| command: ["sh","-c","wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/{{.Values.compute.mysqlConnector.version}}/mysql-connector-java-{{.Values.compute.mysqlConnector.version}}.jar; |
| wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/{{.Values.compute.mysqlConnector.version}}/mysql-connector-java-{{.Values.compute.mysqlConnector.version}}.jar.md5; |
| if [ $(md5sum /mysql-connector-java-{{.Values.compute.mysqlConnector.version}}.jar | cut -d ' ' -f1) = $(cat /mysql-connector-java-{{.Values.compute.mysqlConnector.version}}.jar.md5) ]; |
| then echo success; |
| else echo failed;exit 1;fi;mv /mysql-connector-java-{{.Values.compute.mysqlConnector.version}}.jar /opt/shardingsphere-proxy/ext-lib"] |
| volumeMounts: |
| - name: mysql-connect-jar |
| mountPath: /opt/shardingsphere-proxy/ext-lib |
| {{- end }} |
| containers: |
| - image: "{{ .Values.compute.image.repository }}:{{ .Values.compute.image.tag | default .Chart.AppVersion }}" |
| imagePullPolicy: {{ .Values.compute.image.pullPolicy }} |
| name: shardingsphere-proxy |
| startupProbe: |
| tcpSocket: |
| port: {{ .Values.compute.startPort }} |
| failureThreshold: 6 |
| periodSeconds: 10 |
| livenessProbe: |
| periodSeconds: 5 |
| tcpSocket: |
| port: {{ .Values.compute.startPort }} |
| readinessProbe: |
| periodSeconds: 5 |
| tcpSocket: |
| port: {{ .Values.compute.startPort }} |
| env: |
| - name: PORT |
| value: "{{ .Values.compute.startPort }}" |
| ports: |
| - name: start-port |
| containerPort: {{ .Values.compute.startPort }} |
| {{- if .Values.compute.resources }} |
| resources: {{- toYaml .Values.compute.resources | nindent 12 }} |
| {{- end }} |
| volumeMounts: |
| - name: config |
| mountPath: /opt/shardingsphere-proxy/conf |
| {{- if .Values.compute.mysqlConnector.version }} |
| - name: mysql-connect-jar |
| mountPath: /opt/shardingsphere-proxy/ext-lib |
| {{- end }} |
| imagePullSecrets: |
| {{- toYaml .Values.compute.imagePullSecrets | nindent 8 }} |
| volumes: |
| - name: config |
| configMap: |
| name: {{ printf "%s-configuration" (include "common.names.fullname" .) }} |
| {{- if .Values.compute.mysqlConnector.version}} |
| - name: mysql-connect-jar |
| emptyDir: { } |
| {{- end}} |