cert.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env bash
  2. set -o nounset -o errexit -o pipefail
  3. cat > cilium-secret-values.yaml <<EOF
  4. tls:
  5. ca:
  6. cert: $(cat ${PKI_PREFIX:-}ca.pem | base64 -w0)
  7. key: $(cat ${PKI_PREFIX:-}ca-key.pem | base64 -w0)
  8. clustermesh:
  9. name: "${CLUSTER_NAME:-cluster2}"
  10. useAPIServer: true # Generate cilium-clustermesh secret
  11. apiserver:
  12. tls:
  13. auto:
  14. enabled: false # Use pregenerated secrets
  15. admin:
  16. cert: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-admin-cert.pem | base64 -w0)
  17. key: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-admin-cert-key.pem | base64 -w0)
  18. client:
  19. cert: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-client-cert.pem | base64 -w0)
  20. key: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-client-cert-key.pem | base64 -w0)
  21. remote:
  22. cert: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-remote-cert.pem | base64 -w0)
  23. key: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-remote-cert-key.pem | base64 -w0)
  24. server:
  25. cert: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-server-cert.pem | base64 -w0)
  26. key: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-server-cert-key.pem | base64 -w0)
  27. config:
  28. enabled: true # Generate cilium-clustermesh secret
  29. clusters:
  30. - name: ${REMOTE_CLUSTER_NAME:-cluster1}
  31. address: ${REMOTE_CLUSTER_ADDRESS:-192.168.25.2}
  32. port: ${REMOTE_CLUSTER_PORT:-32379}
  33. tls:
  34. cert: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-remote-cert.pem | base64 -w0)
  35. key: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-remote-cert-key.pem | base64 -w0)
  36. EOF
  37. cat > secret-cilium-secret-values.yaml <<EOF
  38. apiVersion: v1
  39. kind: Secret
  40. metadata:
  41. name: cilium-secret-values
  42. namespace: kube-system
  43. data:
  44. values.yaml: $(cat cilium-secret-values.yaml | base64 -w0)
  45. EOF