apiVersion: apps/v1
kind: Deployment

metadata:
  name: jira-software

spec:
  replicas: 1
  selector:
    matchLabels:
      app: jira-software
  template:
    metadata:
      labels:
        app: jira-software
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/role
                operator: In
                values:
                - common
      initContainers:
      - name: data-perm
        image: alpine:3.8
        command: ["chown", "-R", "daemon:daemon", "/var/atlassian/jira"]
        volumeMounts:
        - name: data
          mountPath: /var/atlassian/jira
      containers:
      - name: jira
        image: cptactionhank/atlassian-jira-software:8.0.1
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        resources:
          requests:
            cpu: 300m
            memory: 1Gi
          limits:
            cpu: 300m
            memory: 1Gi
        livenessProbe:
          httpGet:
            port: 8080
            path: /
          initialDelaySeconds: 60
          timeoutSeconds: 3
          periodSeconds: 10
        readinessProbe:
          httpGet:
            port: 8080
            path: /
          initialDelaySeconds: 60
          timeoutSeconds: 3
          periodSeconds: 10
        volumeMounts:
        - name: data
          mountPath: /var/atlassian/jira
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: data-jira-software