Change kubectl proxy --api-prefix default to allow /apis/

pull/6/head
Janet Kuo 2015-10-09 12:02:16 -07:00
parent b9c7cf43b2
commit f47c2be539
4 changed files with 12 additions and 13 deletions

View File

@ -51,7 +51,7 @@ The above lets you 'curl localhost:8001/custom/api/v1/pods'
The IP address on which to serve on.
.PP
\fB\-\-api\-prefix\fP="/api/"
\fB\-\-api\-prefix\fP="/"
Prefix to serve the proxied API under.
.PP

View File

@ -80,7 +80,7 @@ $ kubectl proxy --api-prefix=/k8s-api
--accept-hosts="^localhost$,^127\\.0\\.0\\.1$,^\\[::1\\]$": Regular expression for hosts that the proxy should accept.
--accept-paths="^/.*": Regular expression for paths that the proxy should accept.
--address="127.0.0.1": The IP address on which to serve on.
--api-prefix="/api/": Prefix to serve the proxied API under.
--api-prefix="/": Prefix to serve the proxied API under.
--disable-filter[=false]: If true, disable request filtering in the proxy. This is dangerous, and can leave you vulnerable to XSRF attacks, when used with an accessible port.
-p, --port=8001: The port on which to run the proxy. Set to 0 to pick a random port.
--reject-methods="POST,PUT,PATCH": Regular expression for HTTP methods that the proxy should reject.

View File

@ -163,6 +163,7 @@ KUBE_API_VERSIONS="v1,extensions/v1beta1" "${KUBE_OUTPUT_HOSTBIN}/kube-apiserver
--kubelet-port=${KUBELET_PORT} \
--runtime-config=api/v1 \
--cert-dir="${TMPDIR:-/tmp/}" \
--runtime_config="extensions/v1beta1=true" \
--service-cluster-ip-range="10.0.0.0/24" 1>&2 &
APISERVER_PID=$!
@ -217,22 +218,20 @@ runTests() {
#######################
# Make sure the UI can be proxied
start-proxy --api-prefix=/
start-proxy
check-curl-proxy-code /ui 301
check-curl-proxy-code /metrics 200
if [[ -n "${version}" ]]; then
check-curl-proxy-code /api/${version}/namespaces 200
fi
stop-proxy
# Default proxy locks you into the /api path (legacy behavior)
start-proxy
check-curl-proxy-code /ui 404
check-curl-proxy-code /metrics 404
check-curl-proxy-code /api/ui 404
if [[ -n "${version}" ]]; then
check-curl-proxy-code /api/${version}/namespaces 200
fi
check-curl-proxy-code /healthz/ 200
stop-proxy
# Make sure the in-development api is accessible by default
start-proxy
check-curl-proxy-code /apis 200
check-curl-proxy-code /apis/extensions/ 200
stop-proxy
# Custom paths let you see everything.

View File

@ -71,7 +71,7 @@ The above lets you 'curl localhost:8001/custom/api/v1/pods'
}
cmd.Flags().StringP("www", "w", "", "Also serve static files from the given directory under the specified prefix.")
cmd.Flags().StringP("www-prefix", "P", "/static/", "Prefix to serve static files under, if static file directory is specified.")
cmd.Flags().StringP("api-prefix", "", "/api/", "Prefix to serve the proxied API under.")
cmd.Flags().StringP("api-prefix", "", "/", "Prefix to serve the proxied API under.")
cmd.Flags().String("accept-paths", kubectl.DefaultPathAcceptRE, "Regular expression for paths that the proxy should accept.")
cmd.Flags().String("reject-paths", kubectl.DefaultPathRejectRE, "Regular expression for paths that the proxy should reject.")
cmd.Flags().String("accept-hosts", kubectl.DefaultHostAcceptRE, "Regular expression for hosts that the proxy should accept.")