apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: jira
  namespace: ci
  labels:
    app: jira
spec:
  selector:
    matchLabels:
      app: jira
  serviceName: jira
  replicas: 1
  #minReadySeconds: 60     #滚动升级时60s后认为该pod就绪
  template:
    metadata:
      labels:
        app: jira
    spec:
      terminationGracePeriodSeconds: 60 ##k8s将会给应用发送SIGTERM信号，可以用来正确、优雅地关闭应用,默认为30秒
      #从私有仓库下载镜像
      #imagePullSecrets:
      #- name: registrykey-ali-ext
      containers:
      - name: jira
        image: slpcat/jira:8.20.9
        imagePullPolicy: Always
        securityContext:
          privileged: false
          readOnlyRootFilesystem: false
          #runAsUser: 1000
          #fsGroup: 1000
        livenessProbe: #kubernetes认为该pod是存活的,不存活则需要重启
          httpGet:
            path: /
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 60 # equals to the maximum startup time of the application + couple of seconds
          timeoutSeconds: 5
          successThreshold: 1
          failureThreshold: 5
        readinessProbe: #kubernetes认为该pod是启动成功的
          httpGet:
            path: /
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 30 # equals to minimum startup time of the application
          timeoutSeconds: 5
          successThreshold: 1
          failureThreshold: 5
        resources:
          # keep request = limit to keep this container in guaranteed class
          requests:
            cpu: 500m
            memory: 1Gi
          limits:
            cpu: 8000m
            memory: 8Gi
        ports:
          - name: web
            containerPort: 8080
        volumeMounts:
          - name: jira-data
            mountPath: "/var/atlassian/jira"
  volumeClaimTemplates:
  - metadata:
      name: jira-data
    spec:
      accessModes:
      - ReadWriteOnce
      #ceph rbd storageclass
      #storageClassName: rbd
      resources:
        requests:
          storage: 160Gi
