mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-06 03:33:26 +00:00
Test storage upgrade to protobufs
This commit is contained in:
@@ -32,6 +32,9 @@ KUBE_NEW_API_VERSION=${KUBE_NEW_API_VERSION:-"v1"}
|
||||
KUBE_OLD_STORAGE_VERSIONS=${KUBE_OLD_STORAGE_VERSIONs:-""}
|
||||
KUBE_NEW_STORAGE_VERSIONS=${KUBE_NEW_STORAGE_VERSIONs:-""}
|
||||
|
||||
KUBE_STORAGE_MEDIA_TYPE_JSON="application/json"
|
||||
KUBE_STORAGE_MEDIA_TYPE_PROTOBUF="application/vnd.kubernetes.protobuf"
|
||||
|
||||
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
|
||||
ETCD_PORT=${ETCD_PORT:-4001}
|
||||
API_PORT=${API_PORT:-8080}
|
||||
@@ -44,7 +47,9 @@ UPDATE_ETCD_OBJECTS_SCRIPT="${KUBE_ROOT}/cluster/update-storage-objects.sh"
|
||||
|
||||
function startApiServer() {
|
||||
local storage_versions=${1:-""}
|
||||
local storage_media_type=${2:-""}
|
||||
kube::log::status "Starting kube-apiserver with KUBE_API_VERSIONS: ${KUBE_API_VERSIONS}"
|
||||
kube::log::status " and storage-media-type: ${storage_media_type}"
|
||||
kube::log::status " and runtime-config: ${RUNTIME_CONFIG}"
|
||||
kube::log::status " and storage-version overrides: ${storage_versions}"
|
||||
|
||||
@@ -57,7 +62,8 @@ function startApiServer() {
|
||||
--runtime-config="${RUNTIME_CONFIG}" \
|
||||
--cert-dir="${TMPDIR:-/tmp/}" \
|
||||
--service-cluster-ip-range="10.0.0.0/24" \
|
||||
--storage-versions="${storage_versions}" 1>&2 &
|
||||
--storage-versions="${storage_versions}" \
|
||||
--storage-media-type=${storage_media_type} 1>&2 &
|
||||
APISERVER_PID=$!
|
||||
|
||||
# url, prefix, wait, times
|
||||
@@ -109,10 +115,11 @@ KUBE_NEW_STORAGE_VERSIONS="batch/v1,autoscaling/v1"
|
||||
#######################################################
|
||||
# Step 1: Start a server which supports both the old and new api versions,
|
||||
# but KUBE_OLD_API_VERSION is the latest (storage) version.
|
||||
# Additionally use KUBE_STORAGE_MEDIA_TYPE_JSON for storage encoding.
|
||||
#######################################################
|
||||
KUBE_API_VERSIONS="${KUBE_OLD_API_VERSION},${KUBE_NEW_API_VERSION}"
|
||||
RUNTIME_CONFIG="api/all=false,api/${KUBE_OLD_API_VERSION}=true,api/${KUBE_NEW_API_VERSION}=true"
|
||||
startApiServer ${KUBE_OLD_STORAGE_VERSIONS}
|
||||
startApiServer ${KUBE_OLD_STORAGE_VERSIONS} ${KUBE_STORAGE_MEDIA_TYPE_JSON}
|
||||
|
||||
|
||||
# Create object(s)
|
||||
@@ -139,11 +146,12 @@ killApiServer
|
||||
#######################################################
|
||||
# Step 2: Start a server which supports both the old and new api versions,
|
||||
# but KUBE_NEW_API_VERSION is the latest (storage) version.
|
||||
# Still use KUBE_STORAGE_MEDIA_TYPE_JSON for storage encoding.
|
||||
#######################################################
|
||||
|
||||
KUBE_API_VERSIONS="${KUBE_NEW_API_VERSION},${KUBE_OLD_API_VERSION}"
|
||||
RUNTIME_CONFIG="api/all=false,api/${KUBE_OLD_API_VERSION}=true,api/${KUBE_NEW_API_VERSION}=true"
|
||||
startApiServer ${KUBE_NEW_STORAGE_VERSIONS}
|
||||
startApiServer ${KUBE_NEW_STORAGE_VERSIONS} ${KUBE_STORAGE_MEDIA_TYPE_JSON}
|
||||
|
||||
# Update etcd objects, so that will now be stored in the new api version.
|
||||
kube::log::status "Updating storage versions in etcd"
|
||||
@@ -166,6 +174,7 @@ killApiServer
|
||||
|
||||
#######################################################
|
||||
# Step 3 : Start a server which supports only the new api version.
|
||||
# However, change storage encoding to KUBE_STORAGE_MEDIA_TYPE_PROTOBUF.
|
||||
#######################################################
|
||||
|
||||
KUBE_API_VERSIONS="${KUBE_NEW_API_VERSION}"
|
||||
@@ -173,7 +182,7 @@ RUNTIME_CONFIG="api/all=false,api/${KUBE_NEW_API_VERSION}=true"
|
||||
|
||||
# This seems to reduce flakiness.
|
||||
sleep 1
|
||||
startApiServer ${KUBE_NEW_STORAGE_VERSIONS}
|
||||
startApiServer ${KUBE_NEW_STORAGE_VERSIONS} ${KUBE_STORAGE_MEDIA_TYPE_PROTOBUF}
|
||||
|
||||
for test in ${tests[@]}; do
|
||||
IFS=',' read -ra test_data <<<"$test"
|
||||
|
Reference in New Issue
Block a user