# Copyright (c) 2022, Nadun De Silva. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#   http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: vscode
  labels:
    app: k8s-replicator
    sample: vscode
spec:
  replicas: 1
  selector:
    matchLabels:
      app: k8s-replicator
      sample: vscode
  template:
    metadata:
      labels:
        app: k8s-replicator
        sample: vscode
    spec:
      containers:
      - name: vscode
        image: linuxserver/code-server:4.3.0
        env:
        - name: PUID
          value: "10500"
        - name: PGID
          value: "10500"
        ports:
        - name: editor-port
          containerPort: 8443
        resources:
          requests:
            memory: "512Mi"
            cpu: "200m"
          limits:
            memory: "1Gi"
            cpu: "1"
        livenessProbe:
          tcpSocket:
            port: editor-port
        readinessProbe:
          httpGet:
            path: /healthz
            port: editor-port
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - all
            add:
            - CHOWN
            - SETUID
            - SETGID
            - DAC_OVERRIDE
      securityContext:
        seccompProfile:
          type: RuntimeDefault
