Skip to content

Commit

Permalink
fix: ignore acme challenge ingress in cleanup (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon authored Dec 21, 2023
1 parent bd3ba28 commit dfd5406
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions legacy/build-deploy-docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ beginBuildStep "Route/Ingress Cleanup" "cleanupRoutes"

set +x
# collect the current routes, its possible to exclude ingress by adding a label 'route.lagoon.sh/remove=false' and it won't get deleted
CURRENT_ROUTES=$(kubectl -n ${NAMESPACE} get ingress -l "route.lagoon.sh/remove!=false" -l "lagoon.sh/autogenerated!=true" --no-headers | cut -d " " -f 1 | xargs)
CURRENT_ROUTES=$(kubectl -n ${NAMESPACE} get ingress -l "route.lagoon.sh/remove!=false" -l "lagoon.sh/autogenerated!=true" -l "acme.cert-manager.io/http01-solver!=true" --no-headers | cut -d " " -f 1 | xargs)
# collect the routes that Lagoon thinks it should have based on the .lagoon.yml and any routes that have come from the api
# using the build-deploy-tool generator
YAML_ROUTES_TO_JSON=$(build-deploy-tool identify created-ingress | jq -r '.secondary[]')
Expand Down Expand Up @@ -1340,7 +1340,7 @@ if [[ "$CUSTOM_ROUTES_DISABLED" == true ]] && [[ "$AUTOGEN_ROUTES_DISABLED" == t
fi

# Load all routes with correct schema and comma separated
ROUTES=$(kubectl -n ${NAMESPACE} get ingress --sort-by='{.metadata.name}' -l "acme.openshift.io/exposer!=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}}')
ROUTES=$(kubectl -n ${NAMESPACE} get ingress --sort-by='{.metadata.name}' -l "acme.cert-manager.io/http01-solver!=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}}')

# swap dioscuri for activestanby label
for ingress in $(kubectl -n ${NAMESPACE} get ingress -l "dioscuri.amazee.io/migrate" -o json | jq -r '.items[] | @base64'); do
Expand Down

0 comments on commit dfd5406

Please sign in to comment.