---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cloud9
  labels:
    name: cloud9
    app: cloud9
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
  selector:
    matchLabels:
      app: cloud9
  template:
    metadata:
      labels:
        name: cloud9
        app: cloud9
    spec:
      restartPolicy: Always
      containers:
        - image: saidsef/cloud9-containerised:latest
          imagePullPolicy: Always
          name: cloud9
          env:
            - name: LC_ALL
              value: "C.UTF-8"
            - name: LANG
              value: "C.UTF-8"
            - name: EDITOR
              value: "vim"
            - name: VISUAL
              value: "vim"
            - name: GO111MODULE
              value: "on"
          ports:
            - protocol: TCP
              containerPort: 9099
              name: cloud980
          volumeMounts:
            - name: cloud9-storage
              mountPath: /app/workspace
              subPath: data
              readOnly: false
          resources:
            requests:
              memory: "1Gi"
              cpu: "500m"
            limits:
              memory: "2Gi"
              cpu: "1000m"
          livenessProbe:
            exec:
              command:
                - pgrep
                - node
            failureThreshold: 2
            successThreshold: 1
            initialDelaySeconds: 2
            periodSeconds: 5
            timeoutSeconds: 2
          readinessProbe:
            tcpSocket:
                port: 9099
            failureThreshold: 2
            successThreshold: 1
            initialDelaySeconds: 5
            periodSeconds: 5
            timeoutSeconds: 2
          securityContext:
            readOnlyRootFilesystem: false
            privileged: false
            allowPrivilegeEscalation: false
            runAsNonRoot: true
            runAsGroup: 10000
            runAsUser: 10000
            capabilities:
              drop:
                - ALL
              add:
                - NET_ADMIN
                - SYS_TIME
      volumes:
        - name: cloud9-storage
          emptyDir: {}
