This commit is contained in:
2026-01-22 22:22:19 +01:00
parent 51d3ea0600
commit 8e0e49589d
3 changed files with 36 additions and 22 deletions

View File

@@ -104,8 +104,10 @@ vault kv get secret/cert-manager-webhook-ovh
```
**Important** :
- Le format du chemin dans `remoteRef` pour External Secrets est `cert-manager-webhook-ovh#application-key` (sans le préfixe `secret/data/`), car le mount path `secret` est déjà défini dans le ClusterSecretStore.
- Le nom du secret dans Vault (`cert-manager-webhook-ovh`) doit correspondre exactement au nom utilisé dans `remoteRef`.
- Pour Vault KV v2 avec External Secrets, utilisez le format avec `key` et `property` séparés :
- `key`: Le chemin du secret dans Vault (ex: `cert-manager-webhook-ovh`)
- `property`: La clé dans le JSON du secret (ex: `application-key`)
- Le mount path `secret` est déjà défini dans le ClusterSecretStore, donc ne l'incluez pas dans `key`.
#### Configuration dans values.yaml
@@ -116,10 +118,11 @@ externalSecret:
enabled: true
refreshInterval: "1h"
secretName: "cert-manager-webhook-ovh"
secretPath: "cert-manager-webhook-ovh" # Chemin du secret dans Vault
remoteRef:
applicationKey: "cert-manager-webhook-ovh#application-key"
applicationSecret: "cert-manager-webhook-ovh#application-secret"
consumerKey: "cert-manager-webhook-ovh#consumer-key"
applicationKey: "application-key" # Clé dans le JSON
applicationSecret: "application-secret" # Clé dans le JSON
consumerKey: "consumer-key" # Clé dans le JSON
vault:
secretStoreName: "vault-backend"
server: "https://vault.example.com:8200"
@@ -230,16 +233,21 @@ kubectl logs -n external-secrets-system \
#### 6. Vérifier le format des chemins
Le format correct pour Vault KV v2 est `cert-manager-webhook-ovh#application-key` (sans le préfixe `secret/data/`).
Le format correct pour Vault KV v2 avec External Secrets utilise `key` et `property` séparés :
Vérifiez dans `values.yaml` :
```yaml
secretPath: "cert-manager-webhook-ovh" # ✅ Correct - chemin du secret
remoteRef:
applicationKey: "cert-manager-webhook-ovh#application-key" # ✅ Correct
applicationKey: "application-key" # ✅ Correct - clé dans le JSON
# ❌ Incorrect: "cert-manager-webhook-ovh#application-key"
# ❌ Incorrect: "secret/data/cert-manager-webhook-ovh#application-key"
```
**Important** : Le nom du secret dans Vault doit correspondre exactement au nom utilisé dans `remoteRef` (ici `cert-manager-webhook-ovh`).
**Important** :
- `secretPath` : Le chemin du secret dans Vault (sans le préfixe `secret/data/`)
- `remoteRef.*` : Les clés dans le JSON du secret
- Le mount path `secret` est géré par le ClusterSecretStore
#### 7. Forcer une nouvelle synchronisation

View File

@@ -1,5 +1,5 @@
{{- if .Values.externalSecret.enabled }}
{{- if and .Values.externalSecret.vault.server .Values.externalSecret.remoteRef.applicationKey .Values.externalSecret.remoteRef.applicationSecret .Values.externalSecret.remoteRef.consumerKey }}
{{- if and .Values.externalSecret.vault.server .Values.externalSecret.secretPath .Values.externalSecret.remoteRef.applicationKey .Values.externalSecret.remoteRef.applicationSecret .Values.externalSecret.remoteRef.consumerKey }}
---
# ExternalSecret pour cert-manager-webhook-ovh-ops
apiVersion: external-secrets.io/v1
@@ -22,13 +22,16 @@ spec:
data:
- secretKey: application-key
remoteRef:
key: {{ .Values.externalSecret.remoteRef.applicationKey }}
key: {{ .Values.externalSecret.secretPath | default "cert-manager-webhook-ovh" }}
property: {{ .Values.externalSecret.remoteRef.applicationKey }}
- secretKey: application-secret
remoteRef:
key: {{ .Values.externalSecret.remoteRef.applicationSecret }}
key: {{ .Values.externalSecret.secretPath | default "cert-manager-webhook-ovh" }}
property: {{ .Values.externalSecret.remoteRef.applicationSecret }}
- secretKey: consumer-key
remoteRef:
key: {{ .Values.externalSecret.remoteRef.consumerKey }}
key: {{ .Values.externalSecret.secretPath | default "cert-manager-webhook-ovh" }}
property: {{ .Values.externalSecret.remoteRef.consumerKey }}
---
# ExternalSecret pour cert-manager-ops (partage du même secret)
apiVersion: external-secrets.io/v1
@@ -51,14 +54,17 @@ spec:
data:
- secretKey: application-key
remoteRef:
key: {{ .Values.externalSecret.remoteRef.applicationKey }}
key: {{ .Values.externalSecret.secretPath | default "cert-manager-webhook-ovh" }}
property: {{ .Values.externalSecret.remoteRef.applicationKey }}
- secretKey: application-secret
remoteRef:
key: {{ .Values.externalSecret.remoteRef.applicationSecret }}
key: {{ .Values.externalSecret.secretPath | default "cert-manager-webhook-ovh" }}
property: {{ .Values.externalSecret.remoteRef.applicationSecret }}
- secretKey: consumer-key
remoteRef:
key: {{ .Values.externalSecret.remoteRef.consumerKey }}
key: {{ .Values.externalSecret.secretPath | default "cert-manager-webhook-ovh" }}
property: {{ .Values.externalSecret.remoteRef.consumerKey }}
{{- else }}
{{- fail "External Secrets est activé mais la configuration est incomplète. Veuillez définir externalSecret.vault.server et tous les remoteRef (applicationKey, applicationSecret, consumerKey)" }}
{{- fail "External Secrets est activé mais la configuration est incomplète. Veuillez définir externalSecret.vault.server, externalSecret.secretPath et tous les remoteRef (applicationKey, applicationSecret, consumerKey)" }}
{{- end }}
{{- end }}

View File

@@ -91,14 +91,14 @@ externalSecret:
# Références aux clés dans Vault
# Format pour Vault KV v2 avec External Secrets:
# - Si le mount path est "secret" et le secret est dans "cert-manager-webhook-ovh": "cert-manager-webhook-ovh#application-key"
# - Le préfixe "secret/data/" n'est PAS nécessaire car il est géré par le ClusterSecretStore
# - Le format est: "chemin-du-secret#clef-dans-le-json"
# - Le chemin du secret dans Vault (sans le préfixe "secret/data/")
# - Les propriétés sont les clés dans le JSON du secret
# ⚠️ IMPORTANT: Le nom du secret dans Vault doit correspondre exactement ici
secretPath: "cert-manager-webhook-ovh" # ⚠️ Chemin du secret dans Vault (ex: secret/cert-manager-webhook-ovh)
remoteRef:
applicationKey: "cert-manager-webhook-ovh#application-key" # ⚠️ Chemin: secret/cert-manager-webhook-ovh avec clé application-key
applicationSecret: "cert-manager-webhook-ovh#application-secret" # ⚠️ Chemin: secret/cert-manager-webhook-ovh avec clé application-secret
consumerKey: "cert-manager-webhook-ovh#consumer-key" # ⚠️ Chemin: secret/cert-manager-webhook-ovh avec clé consumer-key
applicationKey: "application-key" # ⚠️ Clé dans le JSON du secret
applicationSecret: "application-secret" # ⚠️ Clé dans le JSON du secret
consumerKey: "consumer-key" # ⚠️ Clé dans le JSON du secret
# Configuration HashiCorp Vault
vault: