Added resource creation

This commit is contained in:
Mingchen Dai
2024-09-11 04:10:47 +00:00
parent 1a42cda60a
commit dd2ff56190
4 changed files with 133 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{.ObjectMeta.Name}}
namespace: {{.ObjectMeta.Namespace}}
spec:
ingressClassName: nginx
rules:
- host: {{.ObjectMeta.Name}}.devcontainer.devstar.cn
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{.ObjectMeta.Name}}
port:
number: 22

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{.ObjectMeta.Name}}
namespace: {{.ObjectMeta.Namespace}}
spec:
selector:
app: {{.ObjectMeta.Name}}
ports:
- name: ssh
protocol: TCP
port: 22
targetPort: 22

View File

@@ -0,0 +1,46 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{.ObjectMeta.Name}}
namespace: {{.ObjectMeta.Namespace}}
labels:
app: {{.ObjectMeta.Name}}
spec:
podManagementPolicy: OrderedReady
replicas: 1
selector:
matchLabels:
app: {{.ObjectMeta.Name}}
template:
metadata:
labels:
app: {{.ObjectMeta.Name}}
spec:
containers:
- name: {{.ObjectMeta.Name}}
image: {{.Spec.Image}}
imagePullPolicy: IfNotPresent
ports:
- name: tcp-ssh
protocol: tcp
containerPort: 22
livenessProbe:
exec:
command:
- /bin/sh
- -c
- exec ping localhost
failureThreshold: 6
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
resources:
limits:
cpu: 150m
ephemeral-storage: 2Gi
memory: 192Mi
requests:
cpu: 100m
ephemeral-storage: 50Mi
memory: 128Mi