azkv-pushsecret-certificate-pem.yaml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. {% raw %}
  2. apiVersion: v1
  3. kind: Secret
  4. metadata:
  5. name: source-certificate
  6. data:
  7. tls.crt: <BASE64_ENCODED_PEM_CERTIFICATE>
  8. tls.key: <BASE64_ENCODED_PEM_KEY>
  9. ---
  10. apiVersion: external-secrets.io/v1alpha1
  11. kind: PushSecret
  12. metadata:
  13. name: pushsecret-example
  14. namespace: default
  15. spec:
  16. refreshInterval: 1h0m0s # Refresh interval for which push secret will reconcile
  17. deletionPolicy: Delete
  18. secretStoreRefs: # A list of secret stores to push secrets to
  19. - name: azure-store
  20. kind: SecretStore
  21. selector:
  22. secret:
  23. name: source-certificate # Source Kubernetes secret to be pushed
  24. template:
  25. engineVersion: v2
  26. data:
  27. # Use the `fullPemToPkcs12` function to convert the PEM-encoded certificate chain (certificate + intermediate certificates) + private key into a P12 file.
  28. # You can also use the `pemToPkcs12` function if you only want to include the certificate + private key without the intermediate certificates.
  29. cert.p12: '{{ fullPemToPkcs12 (index . "tls.crt" | toString) (index . "tls.key" | toString) | b64dec }}'
  30. data:
  31. - match:
  32. secretKey: cert.p12 # Reference to the generated P12 file in the template data
  33. remoteRef:
  34. remoteKey: cert/my-azkv-cert-name
  35. {% endraw %}