apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/instance: Tmaster-worker
    app.kubernetes.io/name: Tmaster-worker
    app: Tmaster-worker
  name: Tmaster-worker
spec:
  replicas: 2
  selector:
    matchLabels:
      app: Tmaster-worker
      app.kubernetes.io/instance: Tmaster-worker
      app.kubernetes.io/name: Tmaster-worker
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: Tmaster-worker
        app.kubernetes.io/instance: Tmaster-worker
        app.kubernetes.io/name: Tmaster-worker
        auth-filter-injection: enabled
        accesslog-filter-injection: enabled
    spec:
      containers:
        - image: ghcr.io/j75689/tmaster/tmaster:latest
          imagePullPolicy: Always
          name: Tmaster-worker
          args:
            - "worker"
            - "--config"
            - "config/worker.conf.yaml"
          ports:
            - containerPort: 8080
              name: http
              protocol: TCP
          resources: {}
          securityContext:
            capabilities: {}
          volumeMounts:
            - mountPath: /Tmaster/config
              name: config
            - mountPath: /Tmaster/pubsub_credentials.json
              name: pubsub-credentials
              subPath: pubsub_credentials.json
      initContainers:
        - image: ghcr.io/j75689/tmaster/tmaster:latest
          imagePullPolicy: Always
          name: Tmaster-migration
          args:
            - "migrate"
            - "--config"
            - "config/worker.conf.yaml"
          volumeMounts:
            - mountPath: /Tmaster/config
              name: config
        - image: ghcr.io/j75689/tmaster/tmaster:latest
          imagePullPolicy: Always
          name: Tmaster-initmq
          args:
            - "initmq"
            - "worker"
            - "--config"
            - "config/worker.conf.yaml"
          volumeMounts:
            - mountPath: /Tmaster/config
              name: config
            - mountPath: /Tmaster/pubsub_credentials.json
              name: pubsub-credentials
              subPath: pubsub_credentials.json
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      securityContext: {}
      imagePullSecrets:
        - name: github
      terminationGracePeriodSeconds: 30
      volumes:
        - name: config
          secret:
            defaultMode: 420
            secretName: Tmaster-worker-config
        - name: pubsub-credentials
          secret:
            defaultMode: 420
            secretName: Tmaster-pubsub-credentials
