refactor: drop proxy-supports-routes capability trigger
The trigger was added to refuse proxy:route:set under openresty and haproxy, but the hard refusal created an ordering dependency for declarative tools and blocked users from staging routes ahead of a backend switch. Routes are now stored regardless of the active backend and silently ignored by backends that do not render them; the docs call out the inert behavior under openresty and haproxy.
This commit is contained in:
11 files changed
+8
-167
No files matched your search
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
trigger-caddy-vhosts-proxy-supports-routes() {
|
||||
declare desc="advertises path-based routing support for caddy"
|
||||
declare trigger="proxy-supports-routes"
|
||||
declare APP="$1"
|
||||
|
||||
if [[ "$(plugn trigger proxy-type "$APP")" != "caddy" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
echo "true"
|
||||
}
|
||||
|
||||
trigger-caddy-vhosts-proxy-supports-routes "$@"
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
trigger-haproxy-vhosts-proxy-supports-routes() {
|
||||
declare desc="advertises path-based routing support for haproxy (currently false)"
|
||||
declare trigger="proxy-supports-routes"
|
||||
declare APP="$1"
|
||||
|
||||
if [[ "$(plugn trigger proxy-type "$APP")" != "haproxy" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# The byjg/easy-haproxy sidecar image only supports host-based routing.
|
||||
# Path-prefix routing requires either an upstream change to that sidecar
|
||||
# or a different config-generation strategy.
|
||||
echo "false"
|
||||
}
|
||||
|
||||
trigger-haproxy-vhosts-proxy-supports-routes "$@"
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
trigger-nginx-vhosts-proxy-supports-routes() {
|
||||
declare desc="advertises path-based routing support for nginx"
|
||||
declare trigger="proxy-supports-routes"
|
||||
declare APP="$1"
|
||||
|
||||
if [[ "$(plugn trigger proxy-type "$APP")" != "nginx" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
echo "true"
|
||||
}
|
||||
|
||||
trigger-nginx-vhosts-proxy-supports-routes "$@"
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
trigger-openresty-vhosts-proxy-supports-routes() {
|
||||
declare desc="advertises path-based routing support for openresty (currently false)"
|
||||
declare trigger="proxy-supports-routes"
|
||||
declare APP="$1"
|
||||
|
||||
if [[ "$(plugn trigger proxy-type "$APP")" != "openresty" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# The openresty sidecar image does not yet accept path-prefix routing labels.
|
||||
# Tracked upstream at dokku/openresty-docker-proxy#137.
|
||||
echo "false"
|
||||
}
|
||||
|
||||
trigger-openresty-vhosts-proxy-supports-routes "$@"
|
||||
@@ -23,15 +23,6 @@ func CommandRouteSet(appName string, processName string, path string, port int,
|
||||
return errors.New("Usage: dokku proxy:route:set <app> <process> <path> [--port <port>] [--strip-prefix]")
|
||||
}
|
||||
|
||||
supported, err := SupportsRoutes(appName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !supported {
|
||||
proxyType := getComputedProxyType(appName)
|
||||
return fmt.Errorf("path-based routing is not yet supported with the %s proxy backend", proxyType)
|
||||
}
|
||||
|
||||
if port == 0 {
|
||||
port = DefaultRoutePort
|
||||
}
|
||||
|
||||
@@ -171,21 +171,6 @@ func RoutedProcessTypes(appName string) ([]string, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// SupportsRoutes returns true if the proxy backend selected for the app
|
||||
// supports path-based routing, as declared by the proxy-supports-routes
|
||||
// trigger. Backends that do not implement the trigger are treated as not
|
||||
// supporting routes (conservative default).
|
||||
func SupportsRoutes(appName string) (bool, error) {
|
||||
result, err := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "proxy-supports-routes",
|
||||
Args: []string{appName},
|
||||
})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return result.StdoutContents() == "true", nil
|
||||
}
|
||||
|
||||
// AddRoute upserts a route. Returns whether the stored state changed.
|
||||
func AddRoute(appName string, route Route) (bool, error) {
|
||||
if err := ValidatePath(route.Path); err != nil {
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
trigger-scheduler-k3s-proxy-supports-routes() {
|
||||
declare desc="advertises path-based routing support for k3s"
|
||||
declare trigger="proxy-supports-routes"
|
||||
declare APP="$1"
|
||||
|
||||
if [[ "$(plugn trigger proxy-type "$APP")" != "k3s" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
echo "true"
|
||||
}
|
||||
|
||||
trigger-scheduler-k3s-proxy-supports-routes "$@"
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
[[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
trigger-traefik-vhosts-proxy-supports-routes() {
|
||||
declare desc="advertises path-based routing support for traefik"
|
||||
declare trigger="proxy-supports-routes"
|
||||
declare APP="$1"
|
||||
|
||||
if [[ "$(plugn trigger proxy-type "$APP")" != "traefik" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
echo "true"
|
||||
}
|
||||
|
||||
trigger-traefik-vhosts-proxy-supports-routes "$@"
|
||||
Reference in new issue
Block a user