refactor: Use Kustomize for Kubernetes deployment management

- Update kustomization.yaml with newName field for proper image replacement
- Replace individual kubectl apply commands with kustomize build
- Use kustomize edit to dynamically set image tag from CI/CD pipeline
- Simplify deployment to single 'kubectl apply -k' command
- Consolidate verification steps

Benefits:
- Single source of truth for manifest configuration
- Declarative image tag management
- Easier to manage overlays for different environments
- Reduced template duplication

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Alexis Bruneteau 2025-10-22 12:42:33 +02:00
parent b98075df82
commit 00331c5d95
2 changed files with 10 additions and 8 deletions

View File

@ -75,15 +75,15 @@ jobs:
-n sqdc-dashboard \ -n sqdc-dashboard \
--dry-run=client -o yaml | kubectl apply -f - --dry-run=client -o yaml | kubectl apply -f -
- name: Deploy to Kubernetes - uses: imranismail/setup-kustomize@v2
run: |
kubectl apply -f k8s/namespace.yaml
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
kubectl apply -f k8s/ingress.yaml
- name: Update deployment and verify - name: Deploy with Kustomize
run: |
cd k8s
kustomize edit set image gitea.vidoks.fr/sortifal/pfee="$REGISTRY_URL/sortifal/pfee:$IMAGE_TAG"
kubectl apply -k .
- name: Verify deployment
run: | run: |
kubectl set image deployment/sqdc-dashboard dashboard="$REGISTRY_URL/sortifal/pfee:$IMAGE_TAG" -n sqdc-dashboard
kubectl rollout status deployment/sqdc-dashboard -n sqdc-dashboard --timeout=5m kubectl rollout status deployment/sqdc-dashboard -n sqdc-dashboard --timeout=5m
kubectl get pods,svc,ingress -n sqdc-dashboard kubectl get pods,svc,ingress -n sqdc-dashboard

View File

@ -14,6 +14,8 @@ commonLabels:
app: sqdc-dashboard app: sqdc-dashboard
managed-by: kustomize managed-by: kustomize
# Image tag will be set via kustomize edit or --kustomize-replace during deployment
images: images:
- name: gitea.vidoks.fr/sortifal/pfee - name: gitea.vidoks.fr/sortifal/pfee
newTag: latest newTag: latest
newName: gitea.vidoks.fr/sortifal/pfee