Skip to content

Commit

Permalink
feat: add sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
prehor committed May 12, 2024
1 parent b3cdf7e commit 0f9b0af
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 0 deletions.
96 changes: 96 additions & 0 deletions kubernetes/main/apps/sandbox/code-server/app/helmrelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/helm.toolkit.fluxcd.io/helmrelease_v2beta2.json
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: &app sandbox-code-server
spec:
interval: 30m
chart:
spec:
chart: app-template
version: 3.1.0
sourceRef:
kind: HelmRepository
name: bjw-s
namespace: flux-system
install:
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
retries: 3
values:
controllers:
code-server:
type: deployment
pod:
annotations:
k8s.v1.cni.cncf.io/networks: |
[{
"name":"multus-iot",
"namespace": "kube-system",
"ips": ["192.168.101.253/24"]
}]
securityContext:
runAsUser: ${APP_UID:-568}
runAsGroup: ${APP_GID:-568}
fsGroup: ${APP_GID:-568}
containers:
app:
image:
repository: docker.io/codercom/code-server
tag: 4.89.0
args: [
"--auth", "none",
"--user-data-dir", "/sandbox/.vscode",
"--extensions-dir", "/sandbox/.vscode",
"--port", "80",
"/sandbox"
]
lifecycle:
postStart:
exec:
command:
- /bin/sh
- -c
- >-
apt update;
apt install --yes dnsutils;
apt install --yes iproute2;
apt install --yes inetutils-ping;
apt install --yes inetutils-telnet;
apt install --yes inetutils-traceroute;
apt install --yes net-tools;
resources:
requests:
cpu: 10m
limits:
memory: 512Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: FallbackToLogsOnError
service:
app:
controller: code-server
ports:
http:
port: 80
ingress:
app:
className: internal
hosts:
- host: &host "sandbox.${SECRET_DOMAIN}"
paths:
- path: /
service:
identifier: app
port: http
tls:
- hosts:
- *host
persistence:
sandbox:
existingClaim: *app
tmp:
type: emptyDir
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./helmrelease.yaml
- ../../../../templates/volsync
33 changes: 33 additions & 0 deletions kubernetes/main/apps/sandbox/code-server/ks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/main/kustomization-kustomize-v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app sandbox-code-server
namespace: flux-system
spec:
targetNamespace: sandbox
commonMetadata:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: multus
- name: volsync
path: ./kubernetes/main/apps/sandbox/code-server/app
prune: true
sourceRef:
kind: GitRepository
name: home-ops
wait: true
interval: 30m
retryInterval: 1m
timeout: 5m
# Expand the variables in the templates included in app/kustomization.yaml
postBuild:
substitute:
APP: *app
APP_UID: "0"
APP_GID: "0"
VOLSYNC_ACCESSMODES: ReadWriteOnce
VOLSYNC_CAPACITY: 1Gi

6 changes: 6 additions & 0 deletions kubernetes/main/apps/sandbox/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./namespace.yaml
- ./code-server/ks.yaml
9 changes: 9 additions & 0 deletions kubernetes/main/apps/sandbox/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: sandbox
labels:
kustomize.toolkit.fluxcd.io/prune: disabled
annotations:
volsync.backube/privileged-movers: "true"

0 comments on commit 0f9b0af

Please sign in to comment.