blob: c88f0411967903962b5ccc8f1a560b10b1317b2f [file] [log] [blame]
#
# 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: v1
kind: ServiceAccount
metadata:
name: "submarine-server"
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: "default"
---
apiVersion: v1
kind: Service
metadata:
name: "submarine-server"
labels:
app: "submarine-server"
spec:
ports:
- port: 8080
targetPort: 8080
protocol: TCP
name: http
selector:
app: "submarine-server"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: "submarine-server"
spec:
selector:
matchLabels:
app: "submarine-server"
replicas: 1
template:
metadata:
labels:
app: "submarine-server"
spec:
serviceAccountName: "submarine-server"
initContainers:
- name: check-database-connection
image: busybox:1.28
command: [ "sh", "-c",
"until nc -z submarine-database 3306;
do echo waiting for database connection;
sleep 10; done" ]
- name: submarine-server-initcontainer
image: "minio/mc"
command: ["/bin/bash", "-c",
"cnt=0;
while ! /bin/bash -c 'mc --config-dir /tmp/.mc config host add minio http://submarine-minio-service:9000
${MINIO_ACCESS_KEY} ${MINIO_SECRET_KEY}' 2>&1;
do
sleep 15;
((cnt=cnt+1));
if [ $cnt -eq 80 ];then
echo 'ERROR: wait too long for minio pod';
exit 1;
fi;
done;
if /bin/bash -c 'mc --config-dir /tmp/.mc ls minio/submarine' >/dev/null 2>&1; then
echo 'Bucket minio/submarine already exists, skipping creation.';
else
/bin/bash -c 'mc --config-dir /tmp/.mc mb minio/submarine';
fi;"]
volumeMounts:
- name: mc-config-vol
mountPath: /tmp/.mc
env:
- name: MINIO_ACCESS_KEY
valueFrom:
secretKeyRef:
name: submarine-minio-secret
key: MINIO_ACCESS_KEY
- name: MINIO_SECRET_KEY
valueFrom:
secretKeyRef:
name: submarine-minio-secret
key: MINIO_SECRET_KEY
volumes:
- name: mc-config-vol
emptyDir: { }
containers:
- name: "submarine-server"
env:
- name: SUBMARINE_SERVER_PORT
value: "8080"
- name: SUBMARINE_SERVER_PORT_8080_TCP
value: "8080"
- name: K8S_APISERVER_URL
value: "kubernetes.default.svc"
- name: SUBMARINE_S3_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: submarine-minio-secret
key: MINIO_ACCESS_KEY
- name: SUBMARINE_S3_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: submarine-minio-secret
key: MINIO_SECRET_KEY
image: "apache/submarine:server-0.8.0"
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080