apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    io.kompose.service: starships
  name: starships
spec:
  replicas: 1
  strategy: {}
  template:
    metadata:
      labels:
        io.kompose.service: starships
    spec:
      containers:
        - image: starships:latest
          name: starships
          env:
            - name: SPRING_PROFILES_ACTIVE
              value: k8s
            - name: APP_POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: MYSQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mysql-credentials
                  key: password
            - name: MYSQL_USERNAME
              valueFrom:
                secretKeyRef:
                  name: mysql-credentials
                  key: username
          imagePullPolicy: Never
          ports:
            - containerPort: 8443
          volumeMounts:
            - mountPath: /app/spacekey.p12
              name: spacekey
              subPath: spacekey.p12
              readOnly: true
            - mountPath: /app/application-k8s.properties
              name: app-config
              subPath: application-k8s-cm.properties
      volumes:
        - name: spacekey
          secret:
            secretName: spacekey
        - name: app-config
          configMap:
            name: starship-config
      restartPolicy: Always
  selector:
    matchLabels:
      io.kompose.service: starships