feat: CI/CD workflow, Dockerfile, and K8s deployment
- Multi-stage Dockerfile (Maven + Node build, JRE runtime) - Gitea Actions CI: build → docker → deploy - K8s manifests: Deployment, Service (NodePort 30082), Ingress - ServiceAccount + RBAC for kubectl access from pod - Docker socket mount for image builds - Ingress at deploy.cameleer.siegeln.net - SPA config for serving frontend from Spring Boot - cameleer-demo namespace for deployed apps Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
143
deploy/deploy-demo.yaml
Normal file
143
deploy/deploy-demo.yaml
Normal file
@@ -0,0 +1,143 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: cameleer-demo
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: cameleer-deploy-demo
|
||||
namespace: cameleer
|
||||
labels:
|
||||
app: cameleer-deploy-demo
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cameleer-deploy-demo
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cameleer-deploy-demo
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: gitea-registry
|
||||
serviceAccountName: cameleer-deployer
|
||||
containers:
|
||||
- name: deploy-demo
|
||||
image: gitea.siegeln.net/cameleer/cameleer-deploy-demo:latest
|
||||
ports:
|
||||
- containerPort: 8082
|
||||
env:
|
||||
- name: CAMELEER_SERVER_URL
|
||||
value: "http://cameleer3-server.cameleer.svc:8081"
|
||||
- name: CAMELEER_BOOTSTRAP_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: cameleer-auth
|
||||
key: CAMELEER_AUTH_TOKEN
|
||||
- name: CAMELEER_REGISTRY
|
||||
value: "gitea.siegeln.net/cameleer/demo-apps"
|
||||
- name: CAMELEER_AGENT_MAVEN_URL
|
||||
value: "https://gitea.siegeln.net/api/packages/cameleer/maven/com/cameleer3/cameleer3-agent/1.0-SNAPSHOT/cameleer3-agent-1.0-SNAPSHOT.jar"
|
||||
- name: CAMELEER_DEMO_NAMESPACE
|
||||
value: "cameleer-demo"
|
||||
- name: CAMELEER_SERVER_UI
|
||||
value: "http://192.168.50.86:30090"
|
||||
- name: DOCKER_HOST
|
||||
value: "unix:///var/run/docker.sock"
|
||||
volumeMounts:
|
||||
- name: docker-sock
|
||||
mountPath: /var/run/docker.sock
|
||||
- name: kubectl-config
|
||||
mountPath: /root/.kube
|
||||
readOnly: true
|
||||
resources:
|
||||
requests:
|
||||
memory: "256Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "512Mi"
|
||||
cpu: "500m"
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /api/apps
|
||||
port: 8082
|
||||
initialDelaySeconds: 20
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /api/apps
|
||||
port: 8082
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 5
|
||||
volumes:
|
||||
- name: docker-sock
|
||||
hostPath:
|
||||
path: /var/run/docker.sock
|
||||
- name: kubectl-config
|
||||
secret:
|
||||
secretName: deployer-kubeconfig
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: cameleer-deploy-demo
|
||||
namespace: cameleer
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: cameleer-deploy-demo
|
||||
ports:
|
||||
- port: 8082
|
||||
targetPort: 8082
|
||||
nodePort: 30082
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: cameleer-deployer
|
||||
namespace: cameleer
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: cameleer-deployer
|
||||
rules:
|
||||
- apiGroups: ["apps"]
|
||||
resources: ["deployments"]
|
||||
verbs: ["get", "list", "create", "update", "patch", "delete"]
|
||||
- apiGroups: [""]
|
||||
resources: ["pods", "services", "namespaces"]
|
||||
verbs: ["get", "list", "create", "delete"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: cameleer-deployer
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: cameleer-deployer
|
||||
namespace: cameleer
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: cameleer-deployer
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: cameleer-deploy-demo
|
||||
namespace: cameleer
|
||||
spec:
|
||||
rules:
|
||||
- host: deploy.cameleer.siegeln.net
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: cameleer-deploy-demo
|
||||
port:
|
||||
number: 8082
|
||||
Reference in New Issue
Block a user