cert.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. ca:
  16. cert: $(cat ${PKI_PREFIX:-}ca.pem | base64 -w0)
  17. key: $(cat ${PKI_PREFIX:-}ca-key.pem | base64 -w0)
  18. admin:
  19. cert: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-admin-cert.pem | base64 -w0)
  20. key: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-admin-cert-key.pem | base64 -w0)
  21. client:
  22. cert: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-client-cert.pem | base64 -w0)
  23. key: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-client-cert-key.pem | base64 -w0)
  24. remote:
  25. cert: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-remote-cert.pem | base64 -w0)
  26. key: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-remote-cert-key.pem | base64 -w0)
  27. server:
  28. cert: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-server-cert.pem | base64 -w0)
  29. key: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-server-cert-key.pem | base64 -w0)
  30. config:
  31. enabled: true # Generate cilium-clustermesh secret
  32. clusters:
  33. - name: ${REMOTE_CLUSTER_NAME:-cluster1}
  34. address: ${REMOTE_CLUSTER_ADDRESS:-192.168.25.2}
  35. port: ${REMOTE_CLUSTER_PORT:-32379}
  36. tls:
  37. cert: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-remote-cert.pem | base64 -w0)
  38. key: $(cat ${PKI_PREFIX:-}clustermesh-apiserver-remote-cert-key.pem | base64 -w0)
  39. EOF
  40. cat > secret-cilium-secret-values.yaml <<EOF
  41. apiVersion: v1
  42. kind: Secret
  43. metadata:
  44. name: cilium-secret-values
  45. namespace: kube-system
  46. data:
  47. values.yaml: $(cat cilium-secret-values.yaml | base64 -w0)
  48. EOF