refactor(apiserver): ignore the insecure flags

Leave the insecure flags intact but stop serving on insecure port.
This commit is contained in:
knight42
2020-10-29 13:08:40 +08:00
parent 5935fcd704
commit cfc2b330a7
15 changed files with 118 additions and 71 deletions

View File

@@ -59,7 +59,6 @@ source "${KUBE_ROOT}/test/cmd/wait.sh"
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
ETCD_PORT=${ETCD_PORT:-2379}
API_PORT=${API_PORT:-8080}
SECURE_API_PORT=${SECURE_API_PORT:-6443}
API_HOST=${API_HOST:-127.0.0.1}
KUBELET_HEALTHZ_PORT=${KUBELET_HEALTHZ_PORT:-10248}
@@ -307,10 +306,12 @@ setup() {
# TODO: we need to note down the current default namespace and set back to this
# namespace after the tests are done.
kubectl config view
CONTEXT="test"
kubectl config set-context "${CONTEXT}"
kubectl config set-credentials test-admin --token admin-token
kubectl config set-cluster local --insecure-skip-tls-verify --server "https://127.0.0.1:${SECURE_API_PORT}"
kubectl config set-context "${CONTEXT}" --user test-admin --cluster local
kubectl config use-context "${CONTEXT}"
kubectl config view
kube::log::status "Setup complete"
}
@@ -339,13 +340,9 @@ runTests() {
kubectl config set-context "${CONTEXT}" --namespace="${ns_name}"
}
kube_flags=(
'-s' "http://127.0.0.1:${API_PORT}"
)
kube_flags=( '-s' "https://127.0.0.1:${SECURE_API_PORT}" '--insecure-skip-tls-verify' )
kube_flags_without_token=(
'-s' "https://127.0.0.1:${SECURE_API_PORT}" '--insecure-skip-tls-verify=true'
)
kube_flags_without_token=( "${kube_flags[@]}" )
# token defined in hack/testdata/auth-tokens.csv
kube_flags_with_token=( "${kube_flags_without_token[@]}" '--token=admin-token' )