mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-06 03:33:26 +00:00
Stop exposing v1beta3 by default
This commit is contained in:
@@ -71,7 +71,7 @@ function make_namespace() {
|
||||
${KUBECTL} create -f - << __EOF__
|
||||
{
|
||||
"kind": "Namespace",
|
||||
"apiVersion": "v1beta3",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "${TEST_NAMESPACE}"
|
||||
}
|
||||
@@ -90,7 +90,7 @@ function start_service() {
|
||||
${KUBECTL} create -f - << __EOF__
|
||||
{
|
||||
"kind": "ReplicationController",
|
||||
"apiVersion": "v1beta3",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "$1",
|
||||
"labels": {
|
||||
@@ -135,7 +135,7 @@ __EOF__
|
||||
${KUBECTL} create -f - << __EOF__
|
||||
{
|
||||
"kind": "Service",
|
||||
"apiVersion": "v1beta3",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "$1",
|
||||
"labels": {
|
||||
@@ -177,7 +177,7 @@ function query_pods() {
|
||||
for i in $(seq 1 10); do
|
||||
pods_unsorted=($(${KUBECTL} get pods -o template \
|
||||
'--template={{range.items}}{{.metadata.name}} {{end}}' \
|
||||
'--api-version=v1beta3' \
|
||||
'--api-version=v1' \
|
||||
-l name="$1"))
|
||||
found="${#pods_unsorted[*]}"
|
||||
if [[ "${found}" == "$2" ]]; then
|
||||
@@ -211,7 +211,7 @@ function wait_for_pods() {
|
||||
echo "Waiting for ${pods_needed} pods to become 'running'"
|
||||
pods_needed="$2"
|
||||
for id in ${pods_sorted}; do
|
||||
status=$(${KUBECTL} get pods "${id}" -o template --template='{{.status.phase}}' --api-version=v1beta3)
|
||||
status=$(${KUBECTL} get pods "${id}" -o template --template='{{.status.phase}}' --api-version=v1)
|
||||
if [[ "${status}" == "Running" ]]; then
|
||||
pods_needed=$((pods_needed-1))
|
||||
fi
|
||||
@@ -337,9 +337,9 @@ svc1_pods=$(query_pods "${svc1_name}" "${svc1_count}")
|
||||
svc2_pods=$(query_pods "${svc2_name}" "${svc2_count}")
|
||||
|
||||
# Get the VIP IPs.
|
||||
svc1_ip=$(${KUBECTL} get services -o template '--template={{.spec.portalIP}}' "${svc1_name}" --api-version=v1beta3)
|
||||
svc1_ip=$(${KUBECTL} get services -o template '--template={{.spec.portalIP}}' "${svc1_name}" --api-version=v1)
|
||||
test -n "${svc1_ip}" || error "Service1 IP is blank"
|
||||
svc2_ip=$(${KUBECTL} get services -o template '--template={{.spec.portalIP}}' "${svc2_name}" --api-version=v1beta3)
|
||||
svc2_ip=$(${KUBECTL} get services -o template '--template={{.spec.portalIP}}' "${svc2_name}" --api-version=v1)
|
||||
test -n "${svc2_ip}" || error "Service2 IP is blank"
|
||||
if [[ "${svc1_ip}" == "${svc2_ip}" ]]; then
|
||||
error "VIPs conflict: ${svc1_ip}"
|
||||
@@ -409,7 +409,7 @@ wait_for_pods "${svc3_name}" "${svc3_count}"
|
||||
svc3_pods=$(query_pods "${svc3_name}" "${svc3_count}")
|
||||
|
||||
# Get the VIP.
|
||||
svc3_ip=$(${KUBECTL} get services -o template '--template={{.spec.portalIP}}' "${svc3_name}" --api-version=v1beta3)
|
||||
svc3_ip=$(${KUBECTL} get services -o template '--template={{.spec.portalIP}}' "${svc3_name}" --api-version=v1)
|
||||
test -n "${svc3_ip}" || error "Service3 IP is blank"
|
||||
|
||||
echo "Verifying the VIPs from the host"
|
||||
@@ -464,7 +464,7 @@ wait_for_pods "${svc4_name}" "${svc4_count}"
|
||||
svc4_pods=$(query_pods "${svc4_name}" "${svc4_count}")
|
||||
|
||||
# Get the VIP.
|
||||
svc4_ip=$(${KUBECTL} get services -o template '--template={{.spec.portalIP}}' "${svc4_name}" --api-version=v1beta3)
|
||||
svc4_ip=$(${KUBECTL} get services -o template '--template={{.spec.portalIP}}' "${svc4_name}" --api-version=v1)
|
||||
test -n "${svc4_ip}" || error "Service4 IP is blank"
|
||||
if [[ "${svc4_ip}" == "${svc2_ip}" || "${svc4_ip}" == "${svc3_ip}" ]]; then
|
||||
error "VIPs conflict: ${svc4_ip}"
|
||||
|
@@ -213,7 +213,6 @@ function start_apiserver {
|
||||
--admission_control="${ADMISSION_CONTROL}" \
|
||||
--address="${API_HOST}" \
|
||||
--port="${API_PORT}" \
|
||||
--runtime_config=api/v1beta3 \
|
||||
--etcd_servers="http://127.0.0.1:4001" \
|
||||
--service-cluster-ip-range="10.0.0.0/24" \
|
||||
--cors_allowed_origins="${API_CORS_ALLOWED_ORIGINS}" >"${APISERVER_LOG}" 2>&1 &
|
||||
|
@@ -125,7 +125,7 @@ kube::util::wait_for_url "http://127.0.0.1:${KUBELET_HEALTHZ_PORT}/healthz" "kub
|
||||
|
||||
# Start kube-apiserver
|
||||
kube::log::status "Starting kube-apiserver"
|
||||
"${KUBE_OUTPUT_HOSTBIN}/kube-apiserver" \
|
||||
KUBE_API_VERSIONS="v1,v1beta3" "${KUBE_OUTPUT_HOSTBIN}/kube-apiserver" \
|
||||
--address="127.0.0.1" \
|
||||
--public_address_override="127.0.0.1" \
|
||||
--port="${API_PORT}" \
|
||||
@@ -134,6 +134,7 @@ kube::log::status "Starting kube-apiserver"
|
||||
--kubelet_port=${KUBELET_PORT} \
|
||||
--runtime_config=api/v1beta3 \
|
||||
--runtime_config=api/v1 \
|
||||
--runtime_config=api/v1beta3 \
|
||||
--cert_dir="${TMPDIR:-/tmp/}" \
|
||||
--service-cluster-ip-range="10.0.0.0/24" 1>&2 &
|
||||
APISERVER_PID=$!
|
||||
@@ -148,17 +149,14 @@ kube::log::status "Starting controller-manager"
|
||||
CTLRMGR_PID=$!
|
||||
|
||||
kube::util::wait_for_url "http://127.0.0.1:${CTLRMGR_PORT}/healthz" "controller-manager"
|
||||
kube::util::wait_for_url "http://127.0.0.1:${API_PORT}/api/v1beta3/nodes/127.0.0.1" "apiserver(nodes)"
|
||||
kube::util::wait_for_url "http://127.0.0.1:${API_PORT}/api/v1/nodes/127.0.0.1" "apiserver(nodes)"
|
||||
|
||||
# Expose kubectl directly for readability
|
||||
PATH="${KUBE_OUTPUT_HOSTBIN}":$PATH
|
||||
|
||||
kube_api_versions=(
|
||||
""
|
||||
v1beta3
|
||||
v1
|
||||
)
|
||||
for version in "${kube_api_versions[@]}"; do
|
||||
runTests() {
|
||||
version="$1"
|
||||
echo "Testing api version: $1"
|
||||
if [[ -z "${version}" ]]; then
|
||||
kube_flags=(
|
||||
-s "http://127.0.0.1:${API_PORT}"
|
||||
@@ -377,7 +375,7 @@ for version in "${kube_api_versions[@]}"; do
|
||||
kubectl create -f examples/limitrange/valid-pod.json "${kube_flags[@]}"
|
||||
# Post-condition: valid-pod POD is running
|
||||
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" 'valid-pod:'
|
||||
|
||||
|
||||
## Patch pod can change image
|
||||
# Command
|
||||
kubectl patch "${kube_flags[@]}" pod valid-pod -p='{"spec":{"containers":[{"name": "kubernetes-serve-hostname", "image": "nginx"}]}}'
|
||||
@@ -523,7 +521,7 @@ for version in "${kube_api_versions[@]}"; do
|
||||
kubectl create -f - "${kube_flags[@]}" << __EOF__
|
||||
{
|
||||
"kind": "Service",
|
||||
"apiVersion": "v1beta3",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "service-${version}-test"
|
||||
},
|
||||
@@ -784,6 +782,15 @@ __EOF__
|
||||
fi
|
||||
|
||||
kube::test::clear_all
|
||||
}
|
||||
|
||||
kube_api_versions=(
|
||||
""
|
||||
v1beta3
|
||||
v1
|
||||
)
|
||||
for version in "${kube_api_versions[@]}"; do
|
||||
KUBE_API_VERSIONS="v1,v1beta3" runTests "${version}"
|
||||
done
|
||||
|
||||
kube::log::status "TEST PASSED"
|
||||
|
@@ -53,7 +53,7 @@ KUBE_RACE=${KUBE_RACE:-} # use KUBE_RACE="-race" to enable race testing
|
||||
# Set to the goveralls binary path to report coverage results to Coveralls.io.
|
||||
KUBE_GOVERALLS_BIN=${KUBE_GOVERALLS_BIN:-}
|
||||
# Comma separated list of API Versions that should be tested.
|
||||
KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1beta3,v1"}
|
||||
KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,v1beta3"}
|
||||
# Run tests with the standard (registry) and a custom etcd prefix
|
||||
# (kubernetes.io/registry).
|
||||
KUBE_TEST_ETCD_PREFIXES=${KUBE_TEST_ETCD_PREFIXES:-"registry,kubernetes.io/registry"}
|
||||
@@ -218,7 +218,7 @@ for (( i=0, j=0; ; )); do
|
||||
apiVersion=${apiVersions[i]}
|
||||
etcdPrefix=${etcdPrefixes[j]}
|
||||
echo "Running tests for APIVersion: $apiVersion with etcdPrefix: $etcdPrefix"
|
||||
KUBE_API_VERSION="${apiVersion}" ETCD_PREFIX=${etcdPrefix} runTests "$@"
|
||||
KUBE_API_VERSION="${apiVersion}" KUBE_API_VERSIONS="v1,v1beta3" ETCD_PREFIX=${etcdPrefix} runTests "$@"
|
||||
i=${i}+1
|
||||
j=${j}+1
|
||||
if [[ i -eq ${apiVersionsCount} ]] && [[ j -eq ${etcdPrefixesCount} ]]; then
|
||||
|
@@ -25,7 +25,7 @@ set -o pipefail
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
# Comma separated list of API Versions that should be tested.
|
||||
KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1beta3,v1"}
|
||||
KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,v1beta3"}
|
||||
|
||||
KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY:-"-1"}
|
||||
LOG_LEVEL=${LOG_LEVEL:-2}
|
||||
@@ -39,20 +39,22 @@ runTests() {
|
||||
kube::etcd::start
|
||||
|
||||
kube::log::status "Running integration test cases"
|
||||
|
||||
KUBE_GOFLAGS="-tags 'integration no-docker' " \
|
||||
KUBE_RACE="-race" \
|
||||
KUBE_TEST_API_VERSIONS="$1" \
|
||||
KUBE_API_VERSIONS="v1,v1beta3" \
|
||||
"${KUBE_ROOT}/hack/test-go.sh" test/integration
|
||||
|
||||
kube::log::status "Running integration test scenario"
|
||||
|
||||
"${KUBE_OUTPUT_HOSTBIN}/integration" --v=${LOG_LEVEL} --api-version="$1" \
|
||||
KUBE_API_VERSIONS="v1,v1beta3" "${KUBE_OUTPUT_HOSTBIN}/integration" --v=${LOG_LEVEL} --api-version="$1" \
|
||||
--max-concurrency="${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY}"
|
||||
|
||||
cleanup
|
||||
}
|
||||
|
||||
"${KUBE_ROOT}/hack/build-go.sh" "$@" cmd/integration
|
||||
KUBE_API_VERSIONS="v1,v1beta3" "${KUBE_ROOT}/hack/build-go.sh" "$@" cmd/integration
|
||||
|
||||
# Run cleanup to stop etcd on interrupt or other kill signal.
|
||||
trap cleanup EXIT
|
||||
|
@@ -46,14 +46,14 @@ KUBELET_PORT=${KUBELET_PORT:-10250}
|
||||
|
||||
# Start kube-apiserver
|
||||
kube::log::status "Starting kube-apiserver"
|
||||
"${KUBE_OUTPUT_HOSTBIN}/kube-apiserver" \
|
||||
KUBE_API_VERSIONS="v1,v1beta3" "${KUBE_OUTPUT_HOSTBIN}/kube-apiserver" \
|
||||
--address="127.0.0.1" \
|
||||
--public_address_override="127.0.0.1" \
|
||||
--port="${API_PORT}" \
|
||||
--etcd_servers="http://${ETCD_HOST}:${ETCD_PORT}" \
|
||||
--public_address_override="127.0.0.1" \
|
||||
--kubelet_port=${KUBELET_PORT} \
|
||||
--runtime_config=api/legacy=false \
|
||||
--runtime_config=api/v1beta3 \
|
||||
--service-cluster-ip-range="10.0.0.0/24" 1>&2 &
|
||||
APISERVER_PID=$!
|
||||
|
||||
|
Reference in New Issue
Block a user