2021-12-25 17:36:55 +00:00
|
|
|
#!/usr/bin/bash
|
|
|
|
|
2021-12-29 13:27:14 +00:00
|
|
|
source ./env
|
|
|
|
source ./logger.sh
|
2021-12-25 17:36:55 +00:00
|
|
|
|
|
|
|
function install_cert_manager {
|
|
|
|
${KUBECTL_BIN} create namespace cert-manager
|
|
|
|
${HELM_BIN} repo add jetstack https://charts.jetstack.io
|
|
|
|
${HELM_BIN} repo update
|
|
|
|
${HELM_BIN} install cert-manager jetstack/cert-manager \
|
|
|
|
--namespace cert-manager \
|
2021-12-29 13:27:14 +00:00
|
|
|
--version "v${CERT_MANAGER_VERSION}" \
|
2021-12-25 17:36:55 +00:00
|
|
|
--set installCRDs=true
|
2021-12-29 13:27:14 +00:00
|
|
|
${KUBECTL_BIN} apply \
|
|
|
|
-f "https://github.com/jetstack/cert-manager/releases/download/v${CERT_MANAGER_VERSION}/cert-manager.crds.yaml"
|
2021-12-25 17:36:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function create_cluster_issuer {
|
2021-12-29 13:27:14 +00:00
|
|
|
sed "s/EMAIL_ADDRESS/${EMAIL_ADDRESS}/g" ./cert-manager/cluster_issuer.yaml | ${KUBECTL_BIN} apply -f -
|
|
|
|
}
|
|
|
|
|
|
|
|
function create_certificates {
|
|
|
|
sed "s/DOMAIN/${DOMAIN}/g" ./cert-manager/argocd_cert.yaml | ${KUBECTL_BIN} apply -f -
|
|
|
|
}
|
|
|
|
|
|
|
|
function create_argocd_ingress {
|
|
|
|
sed "s/DOMAIN/${DOMAIN}/g" ./cert-manager/argocd_ingress.yaml | ${KUBECTL_BIN} apply -f -
|
2021-12-25 17:36:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
log_info "Installing cert manager..."
|
|
|
|
install_cert_manager
|
|
|
|
create_cluster_issuer
|
2021-12-29 13:27:14 +00:00
|
|
|
create_certificates
|
|
|
|
create_argocd_ingress
|
2021-12-25 17:36:55 +00:00
|
|
|
|
2021-12-29 13:27:14 +00:00
|
|
|
log_info "Cert-manager installation completed successfuly!"
|