init: demo-frontend with CI/CD template
Some checks failed
Build & Deploy Frontend / build (push) Has been cancelled
Build & Deploy Frontend / deploy (push) Has been cancelled

This commit is contained in:
joe
2026-07-19 02:13:20 +08:00
committed by Joe
parent ed58df3cfb
commit fe1c93eacc
6 changed files with 242 additions and 0 deletions

9
deploy/helm/Chart.yaml Normal file
View File

@@ -0,0 +1,9 @@
# Minimal Helm chart for any service
# Place at: <repo>/deploy/helm/
apiVersion: v2
name: demo-frontend
description: Standard Helm chart for k3s services
type: application
version: 0.1.0
appVersion: "1.0.0"

View File

@@ -0,0 +1,85 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
labels:
app: {{ .Chart.Name }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Chart.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.registry }}/{{ .Values.image.name }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
{{- if .Values.probes.liveness.enabled }}
livenessProbe:
httpGet:
path: {{ .Values.probes.liveness.path }}
port: {{ .Values.probes.liveness.port }}
initialDelaySeconds: 30
periodSeconds: 10
{{- end }}
{{- if .Values.probes.readiness.enabled }}
readinessProbe:
httpGet:
path: {{ .Values.probes.readiness.path }}
port: {{ .Values.probes.readiness.port }}
initialDelaySeconds: 5
periodSeconds: 5
{{- end }}
env:
{{- toYaml .Values.env | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}
spec:
type: {{ .Values.service.type }}
selector:
app: {{ .Chart.Name }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{- if .Values.ingress.enabled }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Chart.Name }}
annotations:
{{- if .Values.ingress.className }}
kubernetes.io/ingress.class: {{ .Values.ingress.className }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: {{ .Values.ingress.path | default "/" }}
pathType: Prefix
backend:
service:
name: {{ .Chart.Name }}
port:
number: {{ .Values.service.port }}
{{- end }}

38
deploy/helm/values.yaml Normal file
View File

@@ -0,0 +1,38 @@
# Default values
image:
registry: 127.0.0.1:5000
name: demo-frontend
tag: latest
pullPolicy: Always
replicaCount: 2
service:
type: ClusterIP
port: 8080
ingress:
enabled: false
className: traefik
host: demo-frontend.local
path: /
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
env: []
probes:
liveness:
enabled: true
path: /healthz
port: 8080
readiness:
enabled: true
path: /healthz
port: 8080