This commit is contained in:
@@ -43,6 +43,42 @@ jobs:
|
||||
|
||||
- name: 🚀 Push Docker image
|
||||
run: docker push $IMAGE_REGISTRY/$IMAGE_NAME:$IMAGE_TAG
|
||||
|
||||
- name: Install kubectl
|
||||
env:
|
||||
KUBECTL_VERSION: v1.36.2
|
||||
run: |
|
||||
set -euo pipefail
|
||||
curl -fsSLO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
|
||||
curl -fsSLO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256"
|
||||
printf '%s %s\n' "$(cat kubectl.sha256)" kubectl | sha256sum --check
|
||||
sudo install -m 0755 kubectl /usr/local/bin/kubectl
|
||||
|
||||
- name: Configure Kubernetes access
|
||||
env:
|
||||
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p ~/.kube
|
||||
printf '%s' "$KUBE_CONFIG" | base64 --decode > ~/.kube/config
|
||||
chmod 600 ~/.kube/config
|
||||
kubectl auth can-i update deployments --namespace nicholas
|
||||
|
||||
- name: Deploy web log and files service
|
||||
run: |
|
||||
set -euo pipefail
|
||||
sed -E -i "s#newTag: [0-9a-f]+#newTag: ${IMAGE_TAG}#" k8s/kustomization.yaml
|
||||
grep -q "newTag: ${IMAGE_TAG}$" k8s/kustomization.yaml
|
||||
kubectl apply --kustomize k8s
|
||||
if ! kubectl rollout status deployment/web-log \
|
||||
--namespace nicholas --timeout=180s; then
|
||||
kubectl rollout undo deployment/web-log --namespace nicholas
|
||||
kubectl rollout status deployment/web-log \
|
||||
--namespace nicholas --timeout=180s
|
||||
exit 1
|
||||
fi
|
||||
kubectl rollout status deployment/web-log-files \
|
||||
--namespace nicholas --timeout=180s
|
||||
|
||||
- name: 🧹 Prune images
|
||||
if: always()
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: nicholas
|
||||
resources:
|
||||
- web-log-deployment.yaml
|
||||
- web-log-service.yaml
|
||||
- web-log-ingress.yaml
|
||||
- web-log-files-deployment.yaml
|
||||
- web-log-files-service.yaml
|
||||
- web-log-files-ingress.yaml
|
||||
images:
|
||||
- name: git.uuard.com/nicholas/web-log
|
||||
newTag: 45b11ce88ad5a0e6854f9ba40710f56d66e6b955
|
||||
@@ -0,0 +1,60 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: web-log
|
||||
labels:
|
||||
app.kubernetes.io/name: web-log
|
||||
spec:
|
||||
replicas: 2
|
||||
revisionHistoryLimit: 5
|
||||
progressDeadlineSeconds: 180
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: 0
|
||||
maxSurge: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: web-log
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: web-log
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: gitea-registry
|
||||
containers:
|
||||
- name: web-log
|
||||
image: git.uuard.com/nicholas/web-log
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 2
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 2
|
||||
failureThreshold: 6
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 2
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 32Mi
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
@@ -0,0 +1,65 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: web-log-files
|
||||
labels:
|
||||
app.kubernetes.io/name: web-log-files
|
||||
spec:
|
||||
replicas: 2
|
||||
revisionHistoryLimit: 5
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: 0
|
||||
maxSurge: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: web-log-files
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: web-log-files
|
||||
spec:
|
||||
containers:
|
||||
- name: web-log-files
|
||||
image: nginx:1.30.3-alpine
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: http
|
||||
initialDelaySeconds: 2
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 2
|
||||
failureThreshold: 6
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 2
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 32Mi
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
volumeMounts:
|
||||
- name: web-log-files
|
||||
mountPath: /usr/share/nginx/html
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: web-log-files
|
||||
nfs:
|
||||
server: nas.hosts.uuard.com
|
||||
path: /mnt/data-pool/web-log-files
|
||||
readOnly: true
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: web-log-files
|
||||
labels:
|
||||
app.kubernetes.io/name: web-log-files
|
||||
spec:
|
||||
ingressClassName: traefik
|
||||
rules:
|
||||
- host: files.web-log.uuard.com
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: web-log-files
|
||||
port:
|
||||
name: http
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: web-log-files
|
||||
labels:
|
||||
app.kubernetes.io/name: web-log-files
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app.kubernetes.io/name: web-log-files
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: web-log
|
||||
labels:
|
||||
app.kubernetes.io/name: web-log
|
||||
spec:
|
||||
ingressClassName: traefik
|
||||
rules:
|
||||
- host: web-log.uuard.com
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: web-log
|
||||
port:
|
||||
name: http
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: web-log
|
||||
labels:
|
||||
app.kubernetes.io/name: web-log
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app.kubernetes.io/name: web-log
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
Reference in New Issue
Block a user