diff --git a/apps/applicationset-certificates.yaml b/apps/applicationset-certificates.yaml new file mode 100644 index 0000000..0ac9863 --- /dev/null +++ b/apps/applicationset-certificates.yaml @@ -0,0 +1,44 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: certificates-apps + namespace: argocd-ops +spec: + generators: + # Les certificats sont créés UNIQUEMENT dans le cluster OPS + # qui a cert-manager installé et accès à Internet pour Let's Encrypt + - merge: + generators: + # Premier générateur : scanne les répertoires Helm pour les certificats + - git: + repoURL: https://git.gkdomaine.fr/kubernetes/argocd.git + revision: main + directories: + - path: "helm/certificates/*" + # Deuxième générateur : lit la config OPS uniquement + - git: + repoURL: https://git.gkdomaine.fr/kubernetes/argocd.git + revision: main + files: + - path: "configs/ops/config.json" + mergeKeys: + - path.basename + template: + metadata: + name: 'certificates-{{path.basename}}' + spec: + project: default + source: + repoURL: '{{repository}}' + targetRevision: '{{targetRevision}}' + path: '{{helmPath}}/certificates/{{path.basename}}' + destination: + # Déploie uniquement sur le cluster OPS + name: '{{name}}' + namespace: default + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true diff --git a/configs/ops/config.json b/configs/ops/config.json new file mode 100644 index 0000000..0810e02 --- /dev/null +++ b/configs/ops/config.json @@ -0,0 +1,7 @@ +{ + "environment": "ops", + "name": "cluster-ops", + "repository": "https://git.gkdomaine.fr/kubernetes/argocd.git", + "targetRevision": "main", + "helmPath": "helm" +} diff --git a/helm/cert-manager/dev/Chart.lock b/helm/cert-manager/dev/Chart.lock deleted file mode 100644 index 7c68244..0000000 --- a/helm/cert-manager/dev/Chart.lock +++ /dev/null @@ -1,6 +0,0 @@ -dependencies: -- name: cert-manager - repository: https://charts.jetstack.io - version: v1.19.2 -digest: sha256:b02bda9b9f2fc886af11d017a27a5761513defee603f9e3aa1d7add2749b925c -generated: "2026-01-19T16:07:10.9508021+01:00" diff --git a/helm/cert-manager/dev/Chart.yaml b/helm/cert-manager/dev/Chart.yaml deleted file mode 100644 index 1e655d7..0000000 --- a/helm/cert-manager/dev/Chart.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v2 -name: cert-manager-wrapper -description: Wrapper pour cert-manager avec ClusterIssuer Let's Encrypt -type: application -version: 1.0.0 - -dependencies: - - name: cert-manager - version: v1.19.2 - repository: https://charts.jetstack.io - diff --git a/helm/cert-manager/dev/charts/cert-manager-v1.19.2.tgz b/helm/cert-manager/dev/charts/cert-manager-v1.19.2.tgz deleted file mode 100644 index 872d1ca..0000000 Binary files a/helm/cert-manager/dev/charts/cert-manager-v1.19.2.tgz and /dev/null differ diff --git a/helm/cert-manager/dev/templates/cluster-issuer-letsencrypt-prod.yaml b/helm/cert-manager/dev/templates/cluster-issuer-letsencrypt-prod.yaml deleted file mode 100644 index e98cbc5..0000000 --- a/helm/cert-manager/dev/templates/cluster-issuer-letsencrypt-prod.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: cert-manager.io/v1 -kind: ClusterIssuer -metadata: - name: letsencrypt-prod -spec: - acme: - # URL du serveur Let's Encrypt Production - server: https://acme-v02.api.letsencrypt.org/directory - # Email utilisé pour l'enregistrement et les notifications de renouvellement - email: gkpoubelle78@gmail.com # ⚠️ À MODIFIER avec votre email - # Secret pour stocker la clé privée du compte ACME - privateKeySecretRef: - name: letsencrypt-prod - # Méthode de validation HTTP-01 (via Traefik) - solvers: - - http01: - ingress: - class: traefik - diff --git a/helm/cert-manager/dev/templates/cluster-issuer-letsencrypt-staging.yaml b/helm/cert-manager/dev/templates/cluster-issuer-letsencrypt-staging.yaml deleted file mode 100644 index 3803c7d..0000000 --- a/helm/cert-manager/dev/templates/cluster-issuer-letsencrypt-staging.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: cert-manager.io/v1 -kind: ClusterIssuer -metadata: - name: letsencrypt-staging -spec: - acme: - # URL du serveur Let's Encrypt Staging (pour les tests) - server: https://acme-staging-v02.api.letsencrypt.org/directory - # Email utilisé pour l'enregistrement et les notifications de renouvellement - email: gkpoubelle78@gmail.com # ⚠️ À MODIFIER avec votre email - # Secret pour stocker la clé privée du compte ACME - privateKeySecretRef: - name: letsencrypt-staging - # Méthode de validation HTTP-01 (via Traefik) - solvers: - - http01: - ingress: - class: traefik - diff --git a/helm/cert-manager/dev/values.yaml b/helm/cert-manager/dev/values.yaml deleted file mode 100644 index ffd3d44..0000000 --- a/helm/cert-manager/dev/values.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Configuration pour cert-manager -cert-manager: - # Installation de cert-manager - installCRDs: true - - # Configuration des images depuis Harbor - image: - registry: harbor.gkdomaine.local - repository: images/cert-manager-controller - tag: v1.19.2 - - webhook: - image: - registry: harbor.gkdomaine.local - repository: images/cert-manager-webhook - tag: v1.19.2 - - cainjector: - image: - registry: harbor.gkdomaine.local - repository: images/cert-manager-cainjector - tag: v1.19.2 - - # Configuration de sécurité - securityContext: - enabled: true - - # Prometheus metrics - # Désactivé car Prometheus Operator (ServiceMonitor CRD) n'est pas installé - prometheus: - enabled: false - servicemonitor: - enabled: false - diff --git a/helm/certificates/ops/Chart.yaml b/helm/certificates/ops/Chart.yaml new file mode 100644 index 0000000..85c6606 --- /dev/null +++ b/helm/certificates/ops/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: certificates +description: Certificats Let's Encrypt générés dans OPS via cert-manager +type: application +version: 1.0.0 diff --git a/helm/certificates/ops/README.md b/helm/certificates/ops/README.md new file mode 100644 index 0000000..ef2e508 --- /dev/null +++ b/helm/certificates/ops/README.md @@ -0,0 +1,63 @@ +# Certificats Let's Encrypt pour le cluster OPS + +Ce chart gère les certificats Let's Encrypt générés par cert-manager dans le cluster OPS. + +## Structure + +- `Chart.yaml` : Définition du chart Helm +- `templates/` : Dossiers organisés par application + - `homarr/` : Certificats pour l'application Homarr + - `[autre-app]/` : Certificats pour d'autres applications + +Chaque dossier d'application contient les certificats pour tous les environnements de cette application. + +## Ajout d'un nouveau certificat + +### Pour une application existante + +Ajoutez un fichier dans le dossier de l'application (ex: `templates/homarr/`) : + +```yaml +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: --tls + namespace: - # Le namespace où sera utilisé le secret TLS +spec: + secretName: --tls + issuerRef: + name: letsencrypt-prod # ou letsencrypt-staging pour les tests + kind: ClusterIssuer + dnsNames: + - +``` + +### Pour une nouvelle application + +1. Créez un nouveau dossier dans `templates/` : `templates//` +2. Créez le fichier Certificate dans ce dossier +3. Optionnellement, créez un `README.md` dans le dossier pour documenter les certificats de cette application + +## Déploiement + +Les certificats sont déployés automatiquement via l'ApplicationSet `certificates-apps` dans ArgoCD. + +## Vérification + +```bash +# Vérifier les certificats +kubectl get certificates -A + +# Vérifier un certificat spécifique +kubectl describe certificate homarr-dev-tls -n homarr-dev + +# Vérifier le secret TLS créé +kubectl get secret homarr-dev-tls -n homarr-dev +``` + +## Notes importantes + +- Les certificats sont créés dans le cluster OPS où cert-manager est installé +- Le namespace du Certificate doit correspondre au namespace où le secret TLS sera utilisé +- Pour utiliser le certificat dans d'autres clusters (DEV, RCT, PRD), le secret TLS doit être synchronisé depuis OPS + diff --git a/helm/certificates/ops/templates/homarr/README.md b/helm/certificates/ops/templates/homarr/README.md new file mode 100644 index 0000000..487ef1b --- /dev/null +++ b/helm/certificates/ops/templates/homarr/README.md @@ -0,0 +1,27 @@ +# Certificats pour Homarr + +Ce dossier contient les certificats Let's Encrypt pour l'application Homarr. + +## Certificats disponibles + +- `certificate-homarr-dev.yaml` : Certificat pour Homarr DEV (homarr.dev.gkdomaine.fr) + +## Ajout d'un nouveau certificat Homarr + +Pour ajouter un certificat pour un nouvel environnement (ex: RCT, PRD), créez un nouveau fichier : + +```yaml +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: homarr--tls + namespace: homarr- +spec: + secretName: homarr--tls + issuerRef: + name: letsencrypt-prod + kind: ClusterIssuer + dnsNames: + - homarr..gkdomaine.fr +``` + diff --git a/helm/certificates/ops/templates/homarr/certificate-homarr-dev.yaml b/helm/certificates/ops/templates/homarr/certificate-homarr-dev.yaml new file mode 100644 index 0000000..9392f8b --- /dev/null +++ b/helm/certificates/ops/templates/homarr/certificate-homarr-dev.yaml @@ -0,0 +1,12 @@ +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: homarr-dev-tls + namespace: homarr-dev +spec: + secretName: homarr-dev-tls + issuerRef: + name: letsencrypt-prod + kind: ClusterIssuer + dnsNames: + - homarr.dev.gkdomaine.fr