diff --git a/legacy/build-deploy-docker-compose.sh b/legacy/build-deploy-docker-compose.sh index 151887da..1421995e 100755 --- a/legacy/build-deploy-docker-compose.sh +++ b/legacy/build-deploy-docker-compose.sh @@ -1212,6 +1212,15 @@ fi # Get list of autogenerated routes AUTOGENERATED_ROUTES=$(kubectl -n ${NAMESPACE} get ingress --sort-by='{.metadata.name}' -l "lagoon.sh/autogenerated=true" -o=go-template --template='{{range $indexItems, $ingress := .items}}{{if $indexItems}},{{end}}{{$tls := .spec.tls}}{{range $indexRule, $rule := .spec.rules}}{{if $indexRule}},{{end}}{{if $tls}}https://{{else}}http://{{end}}{{.host}}{{end}}{{end}}') +# remove any certificates for tls-acme false ingress to prevent reissuing attempts +TLS_FALSE_INGRESSES=$(kubectl -n ${NAMESPACE} get ingress -o json | jq -r '.items[] | select(.metadata.annotations["kubernetes.io/tls-acme"] == "false") | .metadata.name') +for TLS_FALSE_INGRESS in $TLS_FALSE_INGRESSES; do + if kubectl -n ${NAMESPACE} get certificate ${TLS_FALSE_INGRESS}-tls &> /dev/null; then + echo ">> Cleaning up certificate for ${TLS_FALSE_INGRESS} as tls-acme is set to false" + kubectl -n ${NAMESPACE} delete certificate ${TLS_FALSE_INGRESS}-tls + fi +done + yq3 write -i -- /kubectl-build-deploy/values.yaml 'route' "$ROUTE" yq3 write -i -- /kubectl-build-deploy/values.yaml 'routes' "$ROUTES" yq3 write -i -- /kubectl-build-deploy/values.yaml 'autogeneratedRoutes' "$AUTOGENERATED_ROUTES"