This commit is contained in:
parent
b50dd80a3c
commit
5babdb1ef4
5 changed files with 112 additions and 0 deletions
50
.forgejo/workflows/deploy.yaml
Normal file
50
.forgejo/workflows/deploy.yaml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: koda-k8s
|
||||
env:
|
||||
NAMESPACE: siwa-game-prd
|
||||
REGISTRY: siwa-game
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Helm lint charts
|
||||
run: |
|
||||
helm lint charts
|
||||
|
||||
- name: Docker login
|
||||
run: |
|
||||
docker login $REGISTRY_URL -u $REGISTRY_USER --password "$REGISTRY_PASS"
|
||||
|
||||
- name: Build and push hugo
|
||||
run: |
|
||||
docker build --progress=plain -t $REGISTRY_URL/$REGISTRY/clem-hugo:${{ github.sha }} .
|
||||
docker push $REGISTRY_URL/$REGISTRY/clem-hugo:${{ github.sha }}
|
||||
|
||||
- name: Ensure namespace exists
|
||||
run: |
|
||||
kubectl get ns $NAMESPACE || kubectl create namespace $NAMESPACE
|
||||
|
||||
- name: Delete existing imagePullSecret (if exists)
|
||||
run: |
|
||||
kubectl delete secret registry-creds -n $NAMESPACE --ignore-not-found
|
||||
|
||||
- name: Copy imagePullSecret to namespace
|
||||
run: |
|
||||
kubectl get secret registry-creds -n servadmin -o yaml \
|
||||
| sed "s/namespace: servadmin/namespace: $NAMESPACE/" \
|
||||
| kubectl apply -f -
|
||||
|
||||
|
||||
- name: Deploy with Helm
|
||||
run: |
|
||||
helm upgrade --install hugo charts \
|
||||
--namespace $NAMESPACE \
|
||||
--set hugo.repository=$REGISTRY_URL/$REGISTRY/clem-hugo \
|
||||
--set hugo.tag=${{ github.sha }} \
|
||||
--set hugo.domain=preprod.siwa-game.fr
|
||||
6
charts/Chart.yaml
Normal file
6
charts/Chart.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
apiVersion: v2
|
||||
name: hugo
|
||||
description: Helm chart to deploy Hugo static site
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.0"
|
||||
32
charts/templates/deployment-hugo.yaml
Normal file
32
charts/templates/deployment-hugo.yaml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hugo
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: hugo
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: hugo
|
||||
spec:
|
||||
containers:
|
||||
- name: hugo
|
||||
image: {{ .Values.hugo.repository }}:{{ default "latest" .Values.hugo.tag }}
|
||||
ports:
|
||||
- containerPort: 80
|
||||
imagePullSecrets:
|
||||
- name: registry-creds
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hugo
|
||||
spec:
|
||||
selector:
|
||||
app: hugo
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
20
charts/templates/ingress.yaml
Normal file
20
charts/templates/ingress.yaml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: hugo-ingress
|
||||
annotations:
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
traefik.ingress.kubernetes.io/router.tls.certresolver: le
|
||||
spec:
|
||||
rules:
|
||||
- host: "{{ .Values.hugo.domain }}"
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: hugo
|
||||
port:
|
||||
number: 80
|
||||
4
charts/values.yaml
Normal file
4
charts/values.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
hugo:
|
||||
domain: ""
|
||||
repository: ""
|
||||
tag: ""
|
||||
Loading…
Add table
Reference in a new issue