Initial commit: demo-java-api with CI/CD
Some checks failed
Build & Deploy Java API / build (push) Has been cancelled

This commit is contained in:
gitea-ci
2026-07-22 01:06:34 +08:00
commit 74a57f251e
9 changed files with 355 additions and 0 deletions

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

@@ -0,0 +1,6 @@
apiVersion: v2
name: demo-java-api
description: A Helm chart for demo-java-api
type: application
version: 1.0.0
appVersion: "1.0.0"

View File

@@ -0,0 +1,88 @@
{{- define "fullname" -}}
{{- .Chart.Name }}
{{- end }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
labels:
app: {{ .Chart.Name }}
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:
- containerPort: {{ .Values.service.port }}
name: http
livenessProbe:
{{- if .Values.probes.liveness.enabled }}
httpGet:
path: {{ .Values.probes.liveness.path }}
port: {{ .Values.probes.liveness.port }}
initialDelaySeconds: 30
periodSeconds: 10
{{- else }}
exec:
command: ["true"]
{{- end }}
readinessProbe:
{{- if .Values.probes.readiness.enabled }}
httpGet:
path: {{ .Values.probes.readiness.path }}
port: {{ .Values.probes.readiness.port }}
initialDelaySeconds: 5
periodSeconds: 5
{{- else }}
exec:
command: ["true"]
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
{{- toYaml .Values.env | nindent 12 }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app: {{ .Chart.Name }}
{{- if .Values.ingress.enabled }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Chart.Name }}
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
spec:
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: {{ .Values.ingress.path }}
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: harbor.cjjhc.top/library
name: demo-java-api
tag: "latest"
pullPolicy: Always
replicaCount: 2
service:
type: ClusterIP
port: 8080
ingress:
enabled: true
className: traefik
host: demo-java-api.local
path: /
resources:
requests:
cpu: 500m
memory: 512Mi
limits:
cpu: 1000m
memory: 1Gi
env: []
probes:
liveness:
enabled: true
path: /healthz
port: 8080
readiness:
enabled: true
path: /healthz
port: 8080