apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: hive-metastore
spec:
  selector:
    matchLabels: {}
  serviceName: hive-metastore
  replicas: 1
  template:
    spec:
      initContainers:
      - name: cleanup
        image: zookage-util
        command:
        - rm
        args:
        - -rf
        - /mnt/hive/metastore
        securityContext:
          runAsUser: 1020
          runAsGroup: 1020
        volumeMounts:
        - name: mnt
          mountPath: /mnt
      - name: init-schema
        image: zookage-util
        command:
        - /opt/hive/bin/schematool
        args:
        - -initSchema
        - -dbType
        - derby
        envFrom:
        - configMapRef:
            name: hadoop-env
        - configMapRef:
            name: hive-env
        securityContext:
          runAsUser: 1020
          runAsGroup: 1020
        volumeMounts:
        - name: hadoop-conf
          mountPath: /etc/hadoop/conf
        - name: hive-conf
          mountPath: /etc/hive/conf
        - name: mnt
          mountPath: /mnt
        - name: package-hadoop
          mountPath: /opt/hadoop
        - name: package-hive
          mountPath: /opt/hive
      - name: wait-for-namenode
        image: zookage-util
        args:
        - wait-for-job
        - hdfs-setup
      containers:
      - name: metastore
        image: zookage-util
        command:
        - /opt/hive/bin/hive
        args:
        - --service
        - metastore
        envFrom:
        - configMapRef:
            name: hadoop-env
        - configMapRef:
            name: hive-env
        readinessProbe:
          tcpSocket:
            port: 9083
        securityContext:
          runAsUser: 1020
          runAsGroup: 1020
        volumeMounts:
        - name: hadoop-conf
          mountPath: /etc/hadoop/conf
        - name: hive-conf
          mountPath: /etc/hive/conf
        - name: mnt
          mountPath: /mnt
        - name: package-hadoop
          mountPath: /opt/hadoop
        - name: package-hive
          mountPath: /opt/hive
      terminationGracePeriodSeconds: 5
      volumes:
      - name: hadoop-conf
        configMap:
          name: hadoop-conf
      - name: hive-conf
        configMap:
          name: hive-conf
      - name: mnt
        emptyDir: {}
      - name: package-hadoop
        persistentVolumeClaim:
          claimName: package-hadoop
      - name: package-hive
        persistentVolumeClaim:
          claimName: package-hive
  volumeClaimTemplates: []
