apiVersion: apps/v1
kind: Deployment
metadata:
  name: code-server
  labels:
    app: code-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: code-server
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: code-server
    spec:
      containers:
      - image: htdp1/code-server:latest
        name: code-server
        imagePullPolicy: Always
        ports:
        - containerPort: 8443
        resources:
          limits:
            cpu: 2000m
            memory: 2048Mi
          requests:
            cpu: 500m
            memory: 512Mi
        env:
        - name: TZ
          value: Asia/Seoul
        - name: PUID
          value: "1000"
        - name: PGID
          value: "1000"
        - name: HASHED_PASSWORD
          value: bba82ecffbd1b927c87f5b26df56b51f2e34520d4e22ab7c9aa2c6e0eb406b2f
          # printf "password" | sha256sum | cut -d' ' -f1
        - name: SUDO_PASSWORD_HASH
          value: bba82ecffbd1b927c87f5b26df56b51f2e34520d4e22ab7c9aa2c6e0eb406b2f
          # printf "password" | sha256sum | cut -d' ' -f1
        volumeMounts:
        - name: persistent-storage
          mountPath: /config
      volumes:
      - name: persistent-storage
        persistentVolumeClaim:
          claimName: code-server