---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: bamboo
  labels:
    name: bamboo
    app: bamboo
spec:
  serviceName: "bamboo"
  revisionHistoryLimit: 1
  replicas: 1
  selector:
    matchLabels:
      app: bamboo
  template:
    metadata:
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "4567"
      labels:
        name: bamboo
        app: bamboo
    spec:
      containers:
        - image: docker.io/saidsef/ubuntu-bamboo-dockerfile:latest
          imagePullPolicy: Always
          env:
            - name: HOST_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.hostIP
          name: bamboo
          ports:
            - protocol: TCP
              containerPort: 8085
              name: bamboo
          livenessProbe:
            exec:
              command:
                - pgrep
                - java
            initialDelaySeconds: 3
            periodSeconds: 3
            successThreshold: 1
            timeoutSeconds: 2
          readinessProbe:
            tcpSocket:
                port: 8085
            initialDelaySeconds: 5
            periodSeconds: 5
            successThreshold: 1
            timeoutSeconds: 1
          securityContext:
            allowPrivilegeEscalation: false
            privileged: false
            runAsGroup: 65534
            runAsUser: 65534
            runAsNonRoot: true
            readOnlyRootFilesystem: false
            capabilities:
              drop:
                - ALL
              add:
                - NET_RAW
          volumeMounts:
            - name: bamboo-storage
              mountPath: /data
              subPath: data
      volumes:
        - name: bamboo-storage
          emptyDir: {}
