forked from xhgit/webup-cloud
Initial import of WebUp Cloud
This commit is contained in:
commit
db82325ed7
216 files changed
+33718
No files matched your search
@@ -0,0 +1,53 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: platform-reviews
|
||||
labels:
|
||||
pod-security.kubernetes.io/enforce: restricted
|
||||
pod-security.kubernetes.io/audit: restricted
|
||||
pod-security.kubernetes.io/warn: restricted
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: code-review-gateway
|
||||
namespace: platform-reviews
|
||||
rules:
|
||||
- apiGroups: ['']
|
||||
resources: ['pods', 'persistentvolumeclaims']
|
||||
verbs: ['get', 'list', 'create', 'delete']
|
||||
- apiGroups: ['']
|
||||
resources: ['pods/exec']
|
||||
verbs: ['get', 'create']
|
||||
- apiGroups: ['networking.k8s.io']
|
||||
resources: ['networkpolicies']
|
||||
verbs: ['get', 'create', 'delete']
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: code-review-gateway
|
||||
namespace: platform-reviews
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: sandbox-gateway
|
||||
namespace: platform-sandboxes
|
||||
roleRef:
|
||||
kind: Role
|
||||
name: code-review-gateway
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ResourceQuota
|
||||
metadata:
|
||||
name: review-quota
|
||||
namespace: platform-reviews
|
||||
spec:
|
||||
hard:
|
||||
pods: '4'
|
||||
requests.cpu: '4'
|
||||
requests.memory: 4Gi
|
||||
limits.cpu: '4'
|
||||
limits.memory: 4Gi
|
||||
requests.storage: 20Gi
|
||||
persistentvolumeclaims: '4'
|
||||
@@ -0,0 +1,72 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: platform-runtimes
|
||||
labels:
|
||||
pod-security.kubernetes.io/enforce: restricted
|
||||
pod-security.kubernetes.io/audit: restricted
|
||||
pod-security.kubernetes.io/warn: restricted
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: webup-runtime-controller
|
||||
namespace: platform-runtimes
|
||||
rules:
|
||||
- apiGroups: ['']
|
||||
resources: ['pods', 'pods/log', 'services', 'secrets', 'configmaps']
|
||||
verbs: ['get', 'list', 'create', 'patch']
|
||||
- apiGroups: ['apps']
|
||||
resources: ['deployments']
|
||||
verbs: ['get', 'list', 'create', 'patch']
|
||||
- apiGroups: ['networking.k8s.io']
|
||||
resources: ['networkpolicies']
|
||||
verbs: ['get', 'create']
|
||||
- apiGroups: ['networking.k8s.io']
|
||||
resources: ['ingresses']
|
||||
verbs: ['get', 'create', 'patch', 'delete']
|
||||
- apiGroups: ['cert-manager.io']
|
||||
resources: ['certificates']
|
||||
verbs: ['get', 'create', 'patch', 'delete']
|
||||
- apiGroups: ['']
|
||||
resources: ['secrets']
|
||||
verbs: ['delete']
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: webup-runtime-controller
|
||||
namespace: platform-runtimes
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: sandbox-gateway
|
||||
namespace: platform-sandboxes
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: webup-runtime-controller
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: webup-node-observer
|
||||
rules:
|
||||
- apiGroups: ['']
|
||||
resources: ['nodes']
|
||||
verbs: ['get', 'list']
|
||||
- apiGroups: ['metrics.k8s.io']
|
||||
resources: ['nodes']
|
||||
verbs: ['get', 'list']
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: webup-node-observer
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: sandbox-gateway
|
||||
namespace: platform-sandboxes
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: webup-node-observer
|
||||
@@ -0,0 +1,70 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: sandbox-gateway
|
||||
namespace: platform-sandboxes
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels: {platform/component: sandbox-gateway}
|
||||
template:
|
||||
metadata:
|
||||
labels: {platform/component: sandbox-gateway}
|
||||
spec:
|
||||
serviceAccountName: sandbox-gateway
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 10001
|
||||
runAsGroup: 10001
|
||||
seccompProfile: {type: RuntimeDefault}
|
||||
containers:
|
||||
- name: gateway
|
||||
# Build node-agent/Dockerfile, push to your registry and replace this image.
|
||||
image: registry.example.invalid/platform/sandbox-gateway:0.2.0
|
||||
ports: [{containerPort: 8090}]
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities: {drop: [ALL]}
|
||||
env:
|
||||
- name: PYTHONDONTWRITEBYTECODE
|
||||
value: '1'
|
||||
- name: SANDBOX_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef: {name: sandbox-gateway, key: SANDBOX_TOKEN}
|
||||
- name: SANDBOX_NAMESPACE
|
||||
value: platform-sandboxes
|
||||
- name: RUNTIME_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef: {name: sandbox-gateway, key: RUNTIME_TOKEN, optional: true}
|
||||
- name: RUNTIME_NAMESPACE
|
||||
value: platform-runtimes
|
||||
- name: RUNTIME_TLS_ISSUER
|
||||
valueFrom:
|
||||
configMapKeyRef: {name: webup-runtime, key: TLS_ISSUER, optional: true}
|
||||
- name: RUNTIME_INGRESS_CLASS
|
||||
valueFrom:
|
||||
configMapKeyRef: {name: webup-runtime, key: INGRESS_CLASS, optional: true}
|
||||
- name: SANDBOX_IMAGE
|
||||
value: registry.example.invalid/platform/development-sandbox:0.2.0
|
||||
- name: SANDBOX_RUNTIME_CLASS
|
||||
value: gvisor
|
||||
resources:
|
||||
requests: {cpu: 100m, memory: 128Mi}
|
||||
limits: {cpu: '1', memory: 512Mi}
|
||||
readinessProbe:
|
||||
tcpSocket: {port: 8090}
|
||||
initialDelaySeconds: 5
|
||||
livenessProbe:
|
||||
tcpSocket: {port: 8090}
|
||||
initialDelaySeconds: 15
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: sandbox-gateway
|
||||
namespace: platform-sandboxes
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector: {platform/component: sandbox-gateway}
|
||||
ports: [{port: 8090, targetPort: 8090}]
|
||||
@@ -0,0 +1,62 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: platform-sandboxes
|
||||
labels:
|
||||
pod-security.kubernetes.io/enforce: restricted
|
||||
pod-security.kubernetes.io/audit: restricted
|
||||
pod-security.kubernetes.io/warn: restricted
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: sandbox-gateway
|
||||
namespace: platform-sandboxes
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: sandbox-gateway
|
||||
namespace: platform-sandboxes
|
||||
rules:
|
||||
- apiGroups: ['']
|
||||
resources: ['pods']
|
||||
verbs: ['get', 'list', 'create']
|
||||
- apiGroups: ['']
|
||||
resources: ['persistentvolumeclaims']
|
||||
verbs: ['get', 'create']
|
||||
- apiGroups: ['']
|
||||
resources: ['pods/exec']
|
||||
verbs: ['get', 'create']
|
||||
- apiGroups: ['networking.k8s.io']
|
||||
resources: ['networkpolicies']
|
||||
verbs: ['get', 'create']
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: sandbox-gateway
|
||||
namespace: platform-sandboxes
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: sandbox-gateway
|
||||
namespace: platform-sandboxes
|
||||
roleRef:
|
||||
kind: Role
|
||||
name: sandbox-gateway
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ResourceQuota
|
||||
metadata:
|
||||
name: workspace-quota
|
||||
namespace: platform-sandboxes
|
||||
spec:
|
||||
hard:
|
||||
pods: '50'
|
||||
requests.cpu: '10'
|
||||
requests.memory: 16Gi
|
||||
limits.cpu: '50'
|
||||
limits.memory: 50Gi
|
||||
requests.storage: 250Gi
|
||||
persistentvolumeclaims: '50'
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"k3sVersion": "v1.36.5+k3s1",
|
||||
"gvisorRelease": "release-20261026.0",
|
||||
"architecture": "x86_64",
|
||||
"files": {
|
||||
"k3s": {
|
||||
"url": "https://github.com/k3s-io/k3s/releases/download/v1.36.5%2Bk3s1/k3s",
|
||||
"sha256": "d73847bcd3c5fccef0115b372e2f9a91f3032dc84bbf71518a4617565294d313"
|
||||
},
|
||||
"k3s-airgap-images-amd64.tar.zst": {
|
||||
"url": "https://github.com/k3s-io/k3s/releases/download/v1.36.5%2Bk3s1/k3s-airgap-images-amd64.tar.zst",
|
||||
"sha256": "7d939471907df2d4e537a9c308bf94173e453fff4a2e9e77e9ae92a64be3007f"
|
||||
},
|
||||
"install-k3s.sh": {
|
||||
"url": "https://raw.githubusercontent.com/k3s-io/k3s/v1.36.5%2Bk3s1/install.sh",
|
||||
"sha256": "46177d4c99440b4c0311b67233823a8e8a2fc09693f6c89af1a7161e152fbfad"
|
||||
},
|
||||
"gvisor-x86_64.tar.bz2": {
|
||||
"url": "https://github.com/google/gvisor/releases/download/release-20261026.0/gvisor-x86_64.tar.bz2",
|
||||
"sha256": "096589d2d6078ba4caa26aa0200932f571aa5da9d08a5156b98ab1d93fa54468"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
ARG BASE_IMAGE=node:24-bookworm-slim
|
||||
FROM ${BASE_IMAGE}
|
||||
ARG DEBIAN_MIRROR=deb.debian.org
|
||||
RUN case "$DEBIAN_MIRROR" in deb.debian.org|mirrors.ustc.edu.cn) ;; *) exit 1 ;; esac && sed -i "s/deb.debian.org/$DEBIAN_MIRROR/g" /etc/apt/sources.list.d/debian.sources
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends python3 python3-pip python3-venv git ca-certificates curl && rm -rf /var/lib/apt/lists/*
|
||||
RUN groupadd -g 10001 workspace && useradd -u 10001 -g workspace -m workspace && mkdir /workspace && chown 10001:10001 /workspace
|
||||
USER 10001:10001
|
||||
WORKDIR /workspace
|
||||
ENV HOME=/workspace
|
||||
CMD ["python3","-c","import time; time.sleep(2147483647)"]
|
||||
Reference in new issue
Block a user