mirror of https://github.com/k3s-io/k3s
commit
b27a8e1d90
|
@ -34,7 +34,7 @@ spec:
|
||||||
name: grafana
|
name: grafana
|
||||||
env:
|
env:
|
||||||
- name: INFLUXDB_EXTERNAL_URL
|
- name: INFLUXDB_EXTERNAL_URL
|
||||||
value: /api/v1beta3/proxy/namespaces/default/services/monitoring-influxdb:api/db/
|
value: /api/v1/proxy/namespaces/default/services/monitoring-influxdb:api/db/
|
||||||
- name: INFLUXDB_HOST
|
- name: INFLUXDB_HOST
|
||||||
value: monitoring-influxdb
|
value: monitoring-influxdb
|
||||||
- name: INFLUXDB_PORT
|
- name: INFLUXDB_PORT
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: elasticsearch-logging
|
name: elasticsearch-logging
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
|
apiVersion: v1
|
||||||
apiVersion: v1beta3
|
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: kibana-logging
|
name: kibana-logging
|
||||||
|
|
|
@ -728,7 +728,7 @@ function kube-up {
|
||||||
-H "Authorization: Bearer ${KUBE_BEARER_TOKEN}" \
|
-H "Authorization: Bearer ${KUBE_BEARER_TOKEN}" \
|
||||||
${secure} \
|
${secure} \
|
||||||
--max-time 5 --fail --output /dev/null --silent \
|
--max-time 5 --fail --output /dev/null --silent \
|
||||||
"https://${KUBE_MASTER_IP}/api/v1beta3/pods"; do
|
"https://${KUBE_MASTER_IP}/api/v1/pods"; do
|
||||||
printf "."
|
printf "."
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"apiVersion": "v1beta3",
|
"apiVersion": "v1",
|
||||||
"kind": "Pod",
|
"kind": "Pod",
|
||||||
"metadata": {"name":"k8s-master"},
|
"metadata": {"name":"k8s-master"},
|
||||||
"spec":{
|
"spec":{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"apiVersion": "v1beta3",
|
"apiVersion": "v1",
|
||||||
"kind": "Pod",
|
"kind": "Pod",
|
||||||
"metadata": {"name":"k8s-master"},
|
"metadata": {"name":"k8s-master"},
|
||||||
"spec":{
|
"spec":{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"apiVersion": "v1beta3",
|
"apiVersion": "v1",
|
||||||
"kind": "Pod",
|
"kind": "Pod",
|
||||||
"metadata": {"name":"etcd-server"},
|
"metadata": {"name":"etcd-server"},
|
||||||
"spec":{
|
"spec":{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
name: fluentd-elasticsearch
|
name: fluentd-elasticsearch
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
name: fluentd-cloud-logging
|
name: fluentd-cloud-logging
|
||||||
|
|
|
@ -192,7 +192,7 @@ function run-until-success() {
|
||||||
# returns a list of <namespace>/<name> pairs (nsnames)
|
# returns a list of <namespace>/<name> pairs (nsnames)
|
||||||
function get-addon-nsnames-from-server() {
|
function get-addon-nsnames-from-server() {
|
||||||
local -r obj_type=$1
|
local -r obj_type=$1
|
||||||
"${KUBECTL}" get "${obj_type}" --all-namespaces -o template -t "{{range.items}}{{.metadata.namespace}}/{{.metadata.name}} {{end}}" --api-version=v1beta3 -l kubernetes.io/cluster-service=true
|
"${KUBECTL}" get "${obj_type}" --all-namespaces -o template -t "{{range.items}}{{.metadata.namespace}}/{{.metadata.name}} {{end}}" --api-version=v1 -l kubernetes.io/cluster-service=true
|
||||||
}
|
}
|
||||||
|
|
||||||
# returns the characters after the last separator (including)
|
# returns the characters after the last separator (including)
|
||||||
|
|
|
@ -74,7 +74,7 @@ EOF
|
||||||
|
|
||||||
local -r kubeconfig_base64=$(echo "${kubeconfig}" | base64 -w0)
|
local -r kubeconfig_base64=$(echo "${kubeconfig}" | base64 -w0)
|
||||||
read -r -d '' secretyaml <<EOF
|
read -r -d '' secretyaml <<EOF
|
||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
data:
|
data:
|
||||||
kubeconfig: ${kubeconfig_base64}
|
kubeconfig: ${kubeconfig_base64}
|
||||||
kind: Secret
|
kind: Secret
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
apiVersion: "v1beta3"
|
apiVersion: "v1"
|
||||||
kind: "LimitRange"
|
kind: "LimitRange"
|
||||||
metadata:
|
metadata:
|
||||||
name: "limits"
|
name: "limits"
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
{% set params = params + " " + cluster_name + " " + cert_file + " " + key_file + " --secure_port=" + secure_port + " " + token_auth_file + " " + bind_address + " " + pillar['log_level'] + " " + advertise_address + " " + proxy_ssh_options -%}
|
{% set params = params + " " + cluster_name + " " + cert_file + " " + key_file + " --secure_port=" + secure_port + " " + token_auth_file + " " + bind_address + " " + pillar['log_level'] + " " + advertise_address + " " + proxy_ssh_options -%}
|
||||||
|
|
||||||
{
|
{
|
||||||
"apiVersion": "v1beta3",
|
"apiVersion": "v1",
|
||||||
"kind": "Pod",
|
"kind": "Pod",
|
||||||
"metadata": {"name":"kube-apiserver"},
|
"metadata": {"name":"kube-apiserver"},
|
||||||
"spec":{
|
"spec":{
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
{% set params = "--master=127.0.0.1:8080" + " " + cluster_name + " " + cluster_cidr + " " + allocate_node_cidrs + " " + cloud_provider + " " + cloud_config + service_account_key + pillar['log_level'] + " " + root_ca_file -%}
|
{% set params = "--master=127.0.0.1:8080" + " " + cluster_name + " " + cluster_cidr + " " + allocate_node_cidrs + " " + cloud_provider + " " + cloud_config + service_account_key + pillar['log_level'] + " " + root_ca_file -%}
|
||||||
|
|
||||||
{
|
{
|
||||||
"apiVersion": "v1beta3",
|
"apiVersion": "v1",
|
||||||
"kind": "Pod",
|
"kind": "Pod",
|
||||||
"metadata": {"name":"kube-controller-manager"},
|
"metadata": {"name":"kube-controller-manager"},
|
||||||
"spec":{
|
"spec":{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"apiVersion": "v1beta3",
|
"apiVersion": "v1",
|
||||||
"kind": "Pod",
|
"kind": "Pod",
|
||||||
"metadata": {"name":"kube-scheduler"},
|
"metadata": {"name":"kube-scheduler"},
|
||||||
"spec":{
|
"spec":{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"apiVersion": "v1beta3",
|
"apiVersion": "v1",
|
||||||
"kind": "Pod",
|
"kind": "Pod",
|
||||||
"metadata": {"name":"nginx"},
|
"metadata": {"name":"nginx"},
|
||||||
"spec":{
|
"spec":{
|
||||||
|
|
|
@ -436,7 +436,7 @@ func TestExecutorStaticPods(t *testing.T) {
|
||||||
w, err := zw.Create(fileName)
|
w, err := zw.Create(fileName)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
spod := `{
|
spod := `{
|
||||||
"apiVersion": "v1beta3",
|
"apiVersion": "v1",
|
||||||
"kind": "Pod",
|
"kind": "Pod",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "%v",
|
"name": "%v",
|
||||||
|
|
|
@ -71,7 +71,7 @@ function make_namespace() {
|
||||||
${KUBECTL} create -f - << __EOF__
|
${KUBECTL} create -f - << __EOF__
|
||||||
{
|
{
|
||||||
"kind": "Namespace",
|
"kind": "Namespace",
|
||||||
"apiVersion": "v1beta3",
|
"apiVersion": "v1",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "${TEST_NAMESPACE}"
|
"name": "${TEST_NAMESPACE}"
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ function start_service() {
|
||||||
${KUBECTL} create -f - << __EOF__
|
${KUBECTL} create -f - << __EOF__
|
||||||
{
|
{
|
||||||
"kind": "ReplicationController",
|
"kind": "ReplicationController",
|
||||||
"apiVersion": "v1beta3",
|
"apiVersion": "v1",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "$1",
|
"name": "$1",
|
||||||
"labels": {
|
"labels": {
|
||||||
|
@ -135,7 +135,7 @@ __EOF__
|
||||||
${KUBECTL} create -f - << __EOF__
|
${KUBECTL} create -f - << __EOF__
|
||||||
{
|
{
|
||||||
"kind": "Service",
|
"kind": "Service",
|
||||||
"apiVersion": "v1beta3",
|
"apiVersion": "v1",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "$1",
|
"name": "$1",
|
||||||
"labels": {
|
"labels": {
|
||||||
|
@ -177,7 +177,7 @@ function query_pods() {
|
||||||
for i in $(seq 1 10); do
|
for i in $(seq 1 10); do
|
||||||
pods_unsorted=($(${KUBECTL} get pods -o template \
|
pods_unsorted=($(${KUBECTL} get pods -o template \
|
||||||
'--template={{range.items}}{{.metadata.name}} {{end}}' \
|
'--template={{range.items}}{{.metadata.name}} {{end}}' \
|
||||||
'--api-version=v1beta3' \
|
'--api-version=v1' \
|
||||||
-l name="$1"))
|
-l name="$1"))
|
||||||
found="${#pods_unsorted[*]}"
|
found="${#pods_unsorted[*]}"
|
||||||
if [[ "${found}" == "$2" ]]; then
|
if [[ "${found}" == "$2" ]]; then
|
||||||
|
@ -211,7 +211,7 @@ function wait_for_pods() {
|
||||||
echo "Waiting for ${pods_needed} pods to become 'running'"
|
echo "Waiting for ${pods_needed} pods to become 'running'"
|
||||||
pods_needed="$2"
|
pods_needed="$2"
|
||||||
for id in ${pods_sorted}; do
|
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
|
if [[ "${status}" == "Running" ]]; then
|
||||||
pods_needed=$((pods_needed-1))
|
pods_needed=$((pods_needed-1))
|
||||||
fi
|
fi
|
||||||
|
@ -337,9 +337,9 @@ svc1_pods=$(query_pods "${svc1_name}" "${svc1_count}")
|
||||||
svc2_pods=$(query_pods "${svc2_name}" "${svc2_count}")
|
svc2_pods=$(query_pods "${svc2_name}" "${svc2_count}")
|
||||||
|
|
||||||
# Get the VIP IPs.
|
# 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"
|
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"
|
test -n "${svc2_ip}" || error "Service2 IP is blank"
|
||||||
if [[ "${svc1_ip}" == "${svc2_ip}" ]]; then
|
if [[ "${svc1_ip}" == "${svc2_ip}" ]]; then
|
||||||
error "VIPs conflict: ${svc1_ip}"
|
error "VIPs conflict: ${svc1_ip}"
|
||||||
|
@ -409,7 +409,7 @@ wait_for_pods "${svc3_name}" "${svc3_count}"
|
||||||
svc3_pods=$(query_pods "${svc3_name}" "${svc3_count}")
|
svc3_pods=$(query_pods "${svc3_name}" "${svc3_count}")
|
||||||
|
|
||||||
# Get the VIP.
|
# 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"
|
test -n "${svc3_ip}" || error "Service3 IP is blank"
|
||||||
|
|
||||||
echo "Verifying the VIPs from the host"
|
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}")
|
svc4_pods=$(query_pods "${svc4_name}" "${svc4_count}")
|
||||||
|
|
||||||
# Get the VIP.
|
# 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"
|
test -n "${svc4_ip}" || error "Service4 IP is blank"
|
||||||
if [[ "${svc4_ip}" == "${svc2_ip}" || "${svc4_ip}" == "${svc3_ip}" ]]; then
|
if [[ "${svc4_ip}" == "${svc2_ip}" || "${svc4_ip}" == "${svc3_ip}" ]]; then
|
||||||
error "VIPs conflict: ${svc4_ip}"
|
error "VIPs conflict: ${svc4_ip}"
|
||||||
|
|
|
@ -213,7 +213,6 @@ function start_apiserver {
|
||||||
--admission_control="${ADMISSION_CONTROL}" \
|
--admission_control="${ADMISSION_CONTROL}" \
|
||||||
--address="${API_HOST}" \
|
--address="${API_HOST}" \
|
||||||
--port="${API_PORT}" \
|
--port="${API_PORT}" \
|
||||||
--runtime_config=api/v1beta3 \
|
|
||||||
--etcd_servers="http://127.0.0.1:4001" \
|
--etcd_servers="http://127.0.0.1:4001" \
|
||||||
--service-cluster-ip-range="10.0.0.0/24" \
|
--service-cluster-ip-range="10.0.0.0/24" \
|
||||||
--cors_allowed_origins="${API_CORS_ALLOWED_ORIGINS}" >"${APISERVER_LOG}" 2>&1 &
|
--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
|
# Start kube-apiserver
|
||||||
kube::log::status "Starting 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" \
|
--address="127.0.0.1" \
|
||||||
--public_address_override="127.0.0.1" \
|
--public_address_override="127.0.0.1" \
|
||||||
--port="${API_PORT}" \
|
--port="${API_PORT}" \
|
||||||
|
@ -134,6 +134,7 @@ kube::log::status "Starting kube-apiserver"
|
||||||
--kubelet_port=${KUBELET_PORT} \
|
--kubelet_port=${KUBELET_PORT} \
|
||||||
--runtime_config=api/v1beta3 \
|
--runtime_config=api/v1beta3 \
|
||||||
--runtime_config=api/v1 \
|
--runtime_config=api/v1 \
|
||||||
|
--runtime_config=api/v1beta3 \
|
||||||
--cert_dir="${TMPDIR:-/tmp/}" \
|
--cert_dir="${TMPDIR:-/tmp/}" \
|
||||||
--service-cluster-ip-range="10.0.0.0/24" 1>&2 &
|
--service-cluster-ip-range="10.0.0.0/24" 1>&2 &
|
||||||
APISERVER_PID=$!
|
APISERVER_PID=$!
|
||||||
|
@ -148,17 +149,14 @@ kube::log::status "Starting controller-manager"
|
||||||
CTLRMGR_PID=$!
|
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:${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
|
# Expose kubectl directly for readability
|
||||||
PATH="${KUBE_OUTPUT_HOSTBIN}":$PATH
|
PATH="${KUBE_OUTPUT_HOSTBIN}":$PATH
|
||||||
|
|
||||||
kube_api_versions=(
|
runTests() {
|
||||||
""
|
version="$1"
|
||||||
v1beta3
|
echo "Testing api version: $1"
|
||||||
v1
|
|
||||||
)
|
|
||||||
for version in "${kube_api_versions[@]}"; do
|
|
||||||
if [[ -z "${version}" ]]; then
|
if [[ -z "${version}" ]]; then
|
||||||
kube_flags=(
|
kube_flags=(
|
||||||
-s "http://127.0.0.1:${API_PORT}"
|
-s "http://127.0.0.1:${API_PORT}"
|
||||||
|
@ -523,7 +521,7 @@ for version in "${kube_api_versions[@]}"; do
|
||||||
kubectl create -f - "${kube_flags[@]}" << __EOF__
|
kubectl create -f - "${kube_flags[@]}" << __EOF__
|
||||||
{
|
{
|
||||||
"kind": "Service",
|
"kind": "Service",
|
||||||
"apiVersion": "v1beta3",
|
"apiVersion": "v1",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "service-${version}-test"
|
"name": "service-${version}-test"
|
||||||
},
|
},
|
||||||
|
@ -784,6 +782,15 @@ __EOF__
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kube::test::clear_all
|
kube::test::clear_all
|
||||||
|
}
|
||||||
|
|
||||||
|
kube_api_versions=(
|
||||||
|
""
|
||||||
|
v1beta3
|
||||||
|
v1
|
||||||
|
)
|
||||||
|
for version in "${kube_api_versions[@]}"; do
|
||||||
|
KUBE_API_VERSIONS="v1,v1beta3" runTests "${version}"
|
||||||
done
|
done
|
||||||
|
|
||||||
kube::log::status "TEST PASSED"
|
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.
|
# Set to the goveralls binary path to report coverage results to Coveralls.io.
|
||||||
KUBE_GOVERALLS_BIN=${KUBE_GOVERALLS_BIN:-}
|
KUBE_GOVERALLS_BIN=${KUBE_GOVERALLS_BIN:-}
|
||||||
# Comma separated list of API Versions that should be tested.
|
# 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
|
# Run tests with the standard (registry) and a custom etcd prefix
|
||||||
# (kubernetes.io/registry).
|
# (kubernetes.io/registry).
|
||||||
KUBE_TEST_ETCD_PREFIXES=${KUBE_TEST_ETCD_PREFIXES:-"registry,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]}
|
apiVersion=${apiVersions[i]}
|
||||||
etcdPrefix=${etcdPrefixes[j]}
|
etcdPrefix=${etcdPrefixes[j]}
|
||||||
echo "Running tests for APIVersion: $apiVersion with etcdPrefix: $etcdPrefix"
|
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
|
i=${i}+1
|
||||||
j=${j}+1
|
j=${j}+1
|
||||||
if [[ i -eq ${apiVersionsCount} ]] && [[ j -eq ${etcdPrefixesCount} ]]; then
|
if [[ i -eq ${apiVersionsCount} ]] && [[ j -eq ${etcdPrefixesCount} ]]; then
|
||||||
|
|
|
@ -25,7 +25,7 @@ set -o pipefail
|
||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
# Comma separated list of API Versions that should be tested.
|
# 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"}
|
KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY:-"-1"}
|
||||||
LOG_LEVEL=${LOG_LEVEL:-2}
|
LOG_LEVEL=${LOG_LEVEL:-2}
|
||||||
|
@ -39,20 +39,22 @@ runTests() {
|
||||||
kube::etcd::start
|
kube::etcd::start
|
||||||
|
|
||||||
kube::log::status "Running integration test cases"
|
kube::log::status "Running integration test cases"
|
||||||
|
|
||||||
KUBE_GOFLAGS="-tags 'integration no-docker' " \
|
KUBE_GOFLAGS="-tags 'integration no-docker' " \
|
||||||
KUBE_RACE="-race" \
|
KUBE_RACE="-race" \
|
||||||
KUBE_TEST_API_VERSIONS="$1" \
|
KUBE_TEST_API_VERSIONS="$1" \
|
||||||
|
KUBE_API_VERSIONS="v1,v1beta3" \
|
||||||
"${KUBE_ROOT}/hack/test-go.sh" test/integration
|
"${KUBE_ROOT}/hack/test-go.sh" test/integration
|
||||||
|
|
||||||
kube::log::status "Running integration test scenario"
|
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}"
|
--max-concurrency="${KUBE_INTEGRATION_TEST_MAX_CONCURRENCY}"
|
||||||
|
|
||||||
cleanup
|
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.
|
# Run cleanup to stop etcd on interrupt or other kill signal.
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
|
@ -46,14 +46,14 @@ KUBELET_PORT=${KUBELET_PORT:-10250}
|
||||||
|
|
||||||
# Start kube-apiserver
|
# Start kube-apiserver
|
||||||
kube::log::status "Starting 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" \
|
--address="127.0.0.1" \
|
||||||
--public_address_override="127.0.0.1" \
|
--public_address_override="127.0.0.1" \
|
||||||
--port="${API_PORT}" \
|
--port="${API_PORT}" \
|
||||||
--etcd_servers="http://${ETCD_HOST}:${ETCD_PORT}" \
|
--etcd_servers="http://${ETCD_HOST}:${ETCD_PORT}" \
|
||||||
--public_address_override="127.0.0.1" \
|
--public_address_override="127.0.0.1" \
|
||||||
--kubelet_port=${KUBELET_PORT} \
|
--kubelet_port=${KUBELET_PORT} \
|
||||||
--runtime_config=api/legacy=false \
|
--runtime_config=api/v1beta3 \
|
||||||
--service-cluster-ip-range="10.0.0.0/24" 1>&2 &
|
--service-cluster-ip-range="10.0.0.0/24" 1>&2 &
|
||||||
APISERVER_PID=$!
|
APISERVER_PID=$!
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ var Version string
|
||||||
|
|
||||||
// OldestVersion is the string that represents the oldest server version supported,
|
// OldestVersion is the string that represents the oldest server version supported,
|
||||||
// for client code that wants to hardcode the lowest common denominator.
|
// for client code that wants to hardcode the lowest common denominator.
|
||||||
const OldestVersion = "v1beta3"
|
var OldestVersion string
|
||||||
|
|
||||||
// Versions is the list of versions that are recognized in code. The order provided
|
// Versions is the list of versions that are recognized in code. The order provided
|
||||||
// may be assumed to be least feature rich to most feature rich, and clients may
|
// may be assumed to be least feature rich to most feature rich, and clients may
|
||||||
|
@ -67,6 +67,7 @@ var userResources = []string{"rc", "svc", "pods", "pvc"}
|
||||||
func init() {
|
func init() {
|
||||||
// Use the first API version in the list of registered versions as the latest.
|
// Use the first API version in the list of registered versions as the latest.
|
||||||
Version = registered.RegisteredVersions[0]
|
Version = registered.RegisteredVersions[0]
|
||||||
|
OldestVersion = registered.RegisteredVersions[len(registered.RegisteredVersions)-1]
|
||||||
Codec = runtime.CodecFor(api.Scheme, Version)
|
Codec = runtime.CodecFor(api.Scheme, Version)
|
||||||
// Put the registered versions in Versions in reverse order.
|
// Put the registered versions in Versions in reverse order.
|
||||||
versions := registered.RegisteredVersions
|
versions := registered.RegisteredVersions
|
||||||
|
|
|
@ -26,9 +26,8 @@ import (
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/meta"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/meta"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
|
||||||
apitesting "github.com/GoogleCloudPlatform/kubernetes/pkg/api/testing"
|
apitesting "github.com/GoogleCloudPlatform/kubernetes/pkg/api/testing"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1"
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta3"
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
|
@ -88,13 +87,10 @@ func roundTripSame(t *testing.T, item runtime.Object, except ...string) {
|
||||||
set := util.NewStringSet(except...)
|
set := util.NewStringSet(except...)
|
||||||
seed := rand.Int63()
|
seed := rand.Int63()
|
||||||
fuzzInternalObject(t, "", item, seed)
|
fuzzInternalObject(t, "", item, seed)
|
||||||
if !set.Has("v1beta3") {
|
version := testapi.Version()
|
||||||
fuzzInternalObject(t, "v1beta3", item, seed)
|
if !set.Has(version) {
|
||||||
roundTrip(t, v1beta3.Codec, item)
|
fuzzInternalObject(t, version, item, seed)
|
||||||
}
|
roundTrip(t, testapi.Codec(), item)
|
||||||
if !set.Has("v1") {
|
|
||||||
fuzzInternalObject(t, "v1", item, seed)
|
|
||||||
roundTrip(t, v1.Codec, item)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import (
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/capabilities"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/capabilities"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||||
utilerrors "github.com/GoogleCloudPlatform/kubernetes/pkg/util/errors"
|
utilerrors "github.com/GoogleCloudPlatform/kubernetes/pkg/util/errors"
|
||||||
|
@ -556,7 +557,7 @@ func TestValidateEnv(t *testing.T) {
|
||||||
Name: "abc",
|
Name: "abc",
|
||||||
ValueFrom: &api.EnvVarSource{
|
ValueFrom: &api.EnvVarSource{
|
||||||
FieldRef: &api.ObjectFieldSelector{
|
FieldRef: &api.ObjectFieldSelector{
|
||||||
APIVersion: "v1beta3",
|
APIVersion: testapi.Version(),
|
||||||
FieldPath: "metadata.name",
|
FieldPath: "metadata.name",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -588,7 +589,7 @@ func TestValidateEnv(t *testing.T) {
|
||||||
Value: "foo",
|
Value: "foo",
|
||||||
ValueFrom: &api.EnvVarSource{
|
ValueFrom: &api.EnvVarSource{
|
||||||
FieldRef: &api.ObjectFieldSelector{
|
FieldRef: &api.ObjectFieldSelector{
|
||||||
APIVersion: "v1beta3",
|
APIVersion: testapi.Version(),
|
||||||
FieldPath: "metadata.name",
|
FieldPath: "metadata.name",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -601,7 +602,7 @@ func TestValidateEnv(t *testing.T) {
|
||||||
Name: "abc",
|
Name: "abc",
|
||||||
ValueFrom: &api.EnvVarSource{
|
ValueFrom: &api.EnvVarSource{
|
||||||
FieldRef: &api.ObjectFieldSelector{
|
FieldRef: &api.ObjectFieldSelector{
|
||||||
APIVersion: "v1beta3",
|
APIVersion: testapi.Version(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}},
|
}},
|
||||||
|
@ -626,7 +627,7 @@ func TestValidateEnv(t *testing.T) {
|
||||||
ValueFrom: &api.EnvVarSource{
|
ValueFrom: &api.EnvVarSource{
|
||||||
FieldRef: &api.ObjectFieldSelector{
|
FieldRef: &api.ObjectFieldSelector{
|
||||||
FieldPath: "metadata.whoops",
|
FieldPath: "metadata.whoops",
|
||||||
APIVersion: "v1beta3",
|
APIVersion: testapi.Version(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}},
|
}},
|
||||||
|
@ -639,7 +640,7 @@ func TestValidateEnv(t *testing.T) {
|
||||||
ValueFrom: &api.EnvVarSource{
|
ValueFrom: &api.EnvVarSource{
|
||||||
FieldRef: &api.ObjectFieldSelector{
|
FieldRef: &api.ObjectFieldSelector{
|
||||||
FieldPath: "status.phase",
|
FieldPath: "status.phase",
|
||||||
APIVersion: "v1beta3",
|
APIVersion: testapi.Version(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}},
|
}},
|
||||||
|
|
|
@ -31,7 +31,6 @@ import (
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/registered"
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
|
||||||
|
@ -174,7 +173,7 @@ func MatchesServerVersion(client *Client, c *Config) error {
|
||||||
// stderr and try client's registered versions in order of preference.
|
// stderr and try client's registered versions in order of preference.
|
||||||
// - If version is config default, and the server does not support it,
|
// - If version is config default, and the server does not support it,
|
||||||
// return an error.
|
// return an error.
|
||||||
func NegotiateVersion(client *Client, c *Config, version string) (string, error) {
|
func NegotiateVersion(client *Client, c *Config, version string, clientRegisteredVersions []string) (string, error) {
|
||||||
var err error
|
var err error
|
||||||
if client == nil {
|
if client == nil {
|
||||||
client, err = New(c)
|
client, err = New(c)
|
||||||
|
@ -183,7 +182,7 @@ func NegotiateVersion(client *Client, c *Config, version string) (string, error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clientVersions := util.StringSet{}
|
clientVersions := util.StringSet{}
|
||||||
for _, v := range registered.RegisteredVersions {
|
for _, v := range clientRegisteredVersions {
|
||||||
clientVersions.Insert(v)
|
clientVersions.Insert(v)
|
||||||
}
|
}
|
||||||
apiVersions, err := client.ServerAPIVersions()
|
apiVersions, err := client.ServerAPIVersions()
|
||||||
|
@ -214,7 +213,7 @@ func NegotiateVersion(client *Client, c *Config, version string) (string, error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, clientVersion := range registered.RegisteredVersions {
|
for _, clientVersion := range clientRegisteredVersions {
|
||||||
if serverVersions.Has(clientVersion) {
|
if serverVersions.Has(clientVersion) {
|
||||||
// Version was not explicitly requested in command config (--api-version).
|
// Version was not explicitly requested in command config (--api-version).
|
||||||
// Ok to fall back to a supported version with a warning.
|
// Ok to fall back to a supported version with a warning.
|
||||||
|
@ -225,7 +224,7 @@ func NegotiateVersion(client *Client, c *Config, version string) (string, error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "", fmt.Errorf("Failed to negotiate an api version. Server supports: %v. Client supports: %v.",
|
return "", fmt.Errorf("Failed to negotiate an api version. Server supports: %v. Client supports: %v.",
|
||||||
serverVersions, registered.RegisteredVersions)
|
serverVersions, clientRegisteredVersions)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewOrDie creates a Kubernetes client and panics if the provided API version is not recognized.
|
// NewOrDie creates a Kubernetes client and panics if the provided API version is not recognized.
|
||||||
|
|
|
@ -333,39 +333,44 @@ func TestNegotiateVersion(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name, version, expectedVersion string
|
name, version, expectedVersion string
|
||||||
serverVersions []string
|
serverVersions []string
|
||||||
|
clientVersions []string
|
||||||
config *Config
|
config *Config
|
||||||
expectErr bool
|
expectErr bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "server supports client default",
|
name: "server supports client default",
|
||||||
version: "v1",
|
version: "version1",
|
||||||
expectedVersion: "v1",
|
|
||||||
config: &Config{},
|
config: &Config{},
|
||||||
serverVersions: []string{"v1beta3", "v1"},
|
serverVersions: []string{"version1", testapi.Version()},
|
||||||
|
clientVersions: []string{"version1", testapi.Version()},
|
||||||
|
expectedVersion: "version1",
|
||||||
expectErr: false,
|
expectErr: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "server falls back to client supported",
|
name: "server falls back to client supported",
|
||||||
version: "v1",
|
version: testapi.Version(),
|
||||||
expectedVersion: "v1beta3",
|
|
||||||
config: &Config{},
|
config: &Config{},
|
||||||
serverVersions: []string{"v1beta3"},
|
serverVersions: []string{"version1"},
|
||||||
|
clientVersions: []string{"version1", testapi.Version()},
|
||||||
|
expectedVersion: "version1",
|
||||||
expectErr: false,
|
expectErr: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "explicit version supported",
|
name: "explicit version supported",
|
||||||
version: "",
|
version: "",
|
||||||
expectedVersion: "v1",
|
config: &Config{Version: testapi.Version()},
|
||||||
config: &Config{Version: "v1"},
|
serverVersions: []string{"version1", testapi.Version()},
|
||||||
serverVersions: []string{"v1beta3", "v1"},
|
clientVersions: []string{"version1", testapi.Version()},
|
||||||
|
expectedVersion: testapi.Version(),
|
||||||
expectErr: false,
|
expectErr: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "explicit version not supported",
|
name: "explicit version not supported",
|
||||||
version: "",
|
version: "",
|
||||||
|
config: &Config{Version: testapi.Version()},
|
||||||
|
serverVersions: []string{"version1"},
|
||||||
|
clientVersions: []string{"version1", testapi.Version()},
|
||||||
expectedVersion: "",
|
expectedVersion: "",
|
||||||
config: &Config{Version: "v1"},
|
|
||||||
serverVersions: []string{"v1beta3"},
|
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -384,7 +389,7 @@ func TestNegotiateVersion(t *testing.T) {
|
||||||
}
|
}
|
||||||
c := NewOrDie(test.config)
|
c := NewOrDie(test.config)
|
||||||
c.Client = fakeClient.Client
|
c.Client = fakeClient.Client
|
||||||
response, err := NegotiateVersion(c, test.config, test.version)
|
response, err := NegotiateVersion(c, test.config, test.version, test.clientVersions)
|
||||||
if err == nil && test.expectErr {
|
if err == nil && test.expectErr {
|
||||||
t.Errorf("expected error, got nil for [%s].", test.name)
|
t.Errorf("expected error, got nil for [%s].", test.name)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||||
package util
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/registered"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/clientcmd"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/clientcmd"
|
||||||
)
|
)
|
||||||
|
@ -59,7 +60,7 @@ func (c *clientCache) ClientConfigForVersion(version string) (*client.Config, er
|
||||||
}
|
}
|
||||||
// TODO: have a better config copy method
|
// TODO: have a better config copy method
|
||||||
config := *c.defaultConfig
|
config := *c.defaultConfig
|
||||||
negotiatedVersion, err := client.NegotiateVersion(c.defaultClient, &config, version)
|
negotiatedVersion, err := client.NegotiateVersion(c.defaultClient, &config, version, registered.RegisteredVersions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||||
package util
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
@ -26,6 +27,7 @@ import (
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/fielderrors"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/fielderrors"
|
||||||
)
|
)
|
||||||
|
@ -45,7 +47,7 @@ func TestMerge(t *testing.T) {
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fragment: `{ "apiVersion": "v1beta3" }`,
|
fragment: fmt.Sprintf(`{ "apiVersion": "%s" }`, testapi.Version()),
|
||||||
expected: &api.Pod{
|
expected: &api.Pod{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
|
@ -77,7 +79,7 @@ func TestMerge(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fragment: `{ "apiVersion": "v1beta3", "spec": { "containers": [ { "name": "c1", "image": "green-image" } ] } }`,
|
fragment: fmt.Sprintf(`{ "apiVersion": "%s", "spec": { "containers": [ { "name": "c1", "image": "green-image" } ] } }`, testapi.Version()),
|
||||||
expected: &api.Pod{
|
expected: &api.Pod{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
|
@ -103,7 +105,7 @@ func TestMerge(t *testing.T) {
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fragment: `{ "apiVersion": "v1beta3", "spec": { "volumes": [ {"name": "v1"}, {"name": "v2"} ] } }`,
|
fragment: fmt.Sprintf(`{ "apiVersion": "%s", "spec": { "volumes": [ {"name": "v1"}, {"name": "v2"} ] } }`, testapi.Version()),
|
||||||
expected: &api.Pod{
|
expected: &api.Pod{
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
|
@ -142,7 +144,7 @@ func TestMerge(t *testing.T) {
|
||||||
obj: &api.Service{
|
obj: &api.Service{
|
||||||
Spec: api.ServiceSpec{},
|
Spec: api.ServiceSpec{},
|
||||||
},
|
},
|
||||||
fragment: `{ "apiVersion": "v1beta3", "spec": { "ports": [ { "port": 0 } ] } }`,
|
fragment: fmt.Sprintf(`{ "apiVersion": "%s", "spec": { "ports": [ { "port": 0 } ] } }`, testapi.Version()),
|
||||||
expected: &api.Service{
|
expected: &api.Service{
|
||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
SessionAffinity: "None",
|
SessionAffinity: "None",
|
||||||
|
@ -165,145 +167,7 @@ func TestMerge(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fragment: `{ "apiVersion": "v1beta3", "spec": { "selector": { "version": "v2" } } }`,
|
fragment: fmt.Sprintf(`{ "apiVersion": "%s", "spec": { "selector": { "version": "v2" } } }`, testapi.Version()),
|
||||||
expected: &api.Service{
|
|
||||||
Spec: api.ServiceSpec{
|
|
||||||
SessionAffinity: "None",
|
|
||||||
Type: api.ServiceTypeClusterIP,
|
|
||||||
Selector: map[string]string{
|
|
||||||
"version": "v2",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
kind: "Pod",
|
|
||||||
obj: &api.Pod{
|
|
||||||
ObjectMeta: api.ObjectMeta{
|
|
||||||
Name: "foo",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
fragment: `{ "apiVersion": "v1" }`,
|
|
||||||
expected: &api.Pod{
|
|
||||||
ObjectMeta: api.ObjectMeta{
|
|
||||||
Name: "foo",
|
|
||||||
},
|
|
||||||
Spec: api.PodSpec{
|
|
||||||
RestartPolicy: api.RestartPolicyAlways,
|
|
||||||
DNSPolicy: api.DNSClusterFirst,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
/* TODO: uncomment this test once Merge is updated to use
|
|
||||||
strategic-merge-patch. See #8449.
|
|
||||||
{
|
|
||||||
kind: "Pod",
|
|
||||||
obj: &api.Pod{
|
|
||||||
ObjectMeta: api.ObjectMeta{
|
|
||||||
Name: "foo",
|
|
||||||
},
|
|
||||||
Spec: api.PodSpec{
|
|
||||||
Containers: []api.Container{
|
|
||||||
api.Container{
|
|
||||||
Name: "c1",
|
|
||||||
Image: "red-image",
|
|
||||||
},
|
|
||||||
api.Container{
|
|
||||||
Name: "c2",
|
|
||||||
Image: "blue-image",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
fragment: `{ "apiVersion": "v1", "spec": { "containers": [ { "name": "c1", "image": "green-image" } ] } }`,
|
|
||||||
expected: &api.Pod{
|
|
||||||
ObjectMeta: api.ObjectMeta{
|
|
||||||
Name: "foo",
|
|
||||||
},
|
|
||||||
Spec: api.PodSpec{
|
|
||||||
Containers: []api.Container{
|
|
||||||
api.Container{
|
|
||||||
Name: "c1",
|
|
||||||
Image: "green-image",
|
|
||||||
},
|
|
||||||
api.Container{
|
|
||||||
Name: "c2",
|
|
||||||
Image: "blue-image",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}, */
|
|
||||||
{
|
|
||||||
kind: "Pod",
|
|
||||||
obj: &api.Pod{
|
|
||||||
ObjectMeta: api.ObjectMeta{
|
|
||||||
Name: "foo",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
fragment: `{ "apiVersion": "v1", "spec": { "volumes": [ {"name": "v1"}, {"name": "v2"} ] } }`,
|
|
||||||
expected: &api.Pod{
|
|
||||||
ObjectMeta: api.ObjectMeta{
|
|
||||||
Name: "foo",
|
|
||||||
},
|
|
||||||
Spec: api.PodSpec{
|
|
||||||
Volumes: []api.Volume{
|
|
||||||
{
|
|
||||||
Name: "v1",
|
|
||||||
VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Name: "v2",
|
|
||||||
VolumeSource: api.VolumeSource{EmptyDir: &api.EmptyDirVolumeSource{}},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
RestartPolicy: api.RestartPolicyAlways,
|
|
||||||
DNSPolicy: api.DNSClusterFirst,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
kind: "Pod",
|
|
||||||
obj: &api.Pod{},
|
|
||||||
fragment: "invalid json",
|
|
||||||
expected: &api.Pod{},
|
|
||||||
expectErr: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
kind: "Service",
|
|
||||||
obj: &api.Service{},
|
|
||||||
fragment: `{ "apiVersion": "badVersion" }`,
|
|
||||||
expectErr: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
kind: "Service",
|
|
||||||
obj: &api.Service{
|
|
||||||
Spec: api.ServiceSpec{},
|
|
||||||
},
|
|
||||||
fragment: `{ "apiVersion": "v1", "spec": { "ports": [ { "port": 0 } ] } }`,
|
|
||||||
expected: &api.Service{
|
|
||||||
Spec: api.ServiceSpec{
|
|
||||||
SessionAffinity: "None",
|
|
||||||
Type: api.ServiceTypeClusterIP,
|
|
||||||
Ports: []api.ServicePort{
|
|
||||||
{
|
|
||||||
Protocol: api.ProtocolTCP,
|
|
||||||
Port: 0,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
kind: "Service",
|
|
||||||
obj: &api.Service{
|
|
||||||
Spec: api.ServiceSpec{
|
|
||||||
Selector: map[string]string{
|
|
||||||
"version": "v1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
fragment: `{ "apiVersion": "v1", "spec": { "selector": { "version": "v2" } } }`,
|
|
||||||
expected: &api.Service{
|
expected: &api.Service{
|
||||||
Spec: api.ServiceSpec{
|
Spec: api.ServiceSpec{
|
||||||
SessionAffinity: "None",
|
SessionAffinity: "None",
|
||||||
|
|
|
@ -34,6 +34,7 @@ import (
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
apierrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
|
apierrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/capabilities"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/capabilities"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/testclient"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/testclient"
|
||||||
|
@ -1172,7 +1173,7 @@ func TestMakeEnvironmentVariables(t *testing.T) {
|
||||||
Name: "POD_NAME",
|
Name: "POD_NAME",
|
||||||
ValueFrom: &api.EnvVarSource{
|
ValueFrom: &api.EnvVarSource{
|
||||||
FieldRef: &api.ObjectFieldSelector{
|
FieldRef: &api.ObjectFieldSelector{
|
||||||
APIVersion: "v1beta3",
|
APIVersion: testapi.Version(),
|
||||||
FieldPath: "metadata.name",
|
FieldPath: "metadata.name",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1181,7 +1182,7 @@ func TestMakeEnvironmentVariables(t *testing.T) {
|
||||||
Name: "POD_NAMESPACE",
|
Name: "POD_NAMESPACE",
|
||||||
ValueFrom: &api.EnvVarSource{
|
ValueFrom: &api.EnvVarSource{
|
||||||
FieldRef: &api.ObjectFieldSelector{
|
FieldRef: &api.ObjectFieldSelector{
|
||||||
APIVersion: "v1beta3",
|
APIVersion: testapi.Version(),
|
||||||
FieldPath: "metadata.namespace",
|
FieldPath: "metadata.namespace",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1208,7 +1209,7 @@ func TestMakeEnvironmentVariables(t *testing.T) {
|
||||||
Name: "POD_NAME",
|
Name: "POD_NAME",
|
||||||
ValueFrom: &api.EnvVarSource{
|
ValueFrom: &api.EnvVarSource{
|
||||||
FieldRef: &api.ObjectFieldSelector{
|
FieldRef: &api.ObjectFieldSelector{
|
||||||
APIVersion: "v1beta3",
|
APIVersion: testapi.Version(),
|
||||||
FieldPath: "metadata.name",
|
FieldPath: "metadata.name",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -26,6 +26,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
|
||||||
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1"
|
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1"
|
||||||
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta3"
|
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta3"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||||
|
@ -131,9 +132,7 @@ func compareBuffers(t *testing.T, generatedFile string, existing, generated byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNoManualChangesToGenerateConversions(t *testing.T) {
|
func TestNoManualChangesToGenerateConversions(t *testing.T) {
|
||||||
versions := []string{"v1beta3", "v1"}
|
version := testapi.Version()
|
||||||
|
|
||||||
for _, version := range versions {
|
|
||||||
fileName := fmt.Sprintf("../../pkg/api/%s/conversion_generated.go", version)
|
fileName := fmt.Sprintf("../../pkg/api/%s/conversion_generated.go", version)
|
||||||
|
|
||||||
existingFunctions := bufferExistingGeneratedCode(t, fileName)
|
existingFunctions := bufferExistingGeneratedCode(t, fileName)
|
||||||
|
@ -146,4 +145,3 @@ func TestNoManualChangesToGenerateConversions(t *testing.T) {
|
||||||
os.Remove(functionsTxt)
|
os.Remove(functionsTxt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
|
||||||
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1"
|
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1"
|
||||||
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta3"
|
_ "github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta3"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||||
|
@ -64,7 +65,7 @@ func generateDeepCopies(t *testing.T, version string) bytes.Buffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNoManualChangesToGenerateDeepCopies(t *testing.T) {
|
func TestNoManualChangesToGenerateDeepCopies(t *testing.T) {
|
||||||
versions := []string{"api", "v1beta3", "v1"}
|
versions := []string{"api", testapi.Version()}
|
||||||
|
|
||||||
for _, version := range versions {
|
for _, version := range versions {
|
||||||
fileName := ""
|
fileName := ""
|
||||||
|
|
|
@ -21,6 +21,7 @@ import (
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
@ -162,7 +163,7 @@ func makeCheckPod(ns string, nfsserver string) *api.Pod {
|
||||||
return &api.Pod{
|
return &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: api.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
APIVersion: "v1beta3",
|
APIVersion: testapi.Version(),
|
||||||
},
|
},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
GenerateName: "checker-",
|
GenerateName: "checker-",
|
||||||
|
|
|
@ -24,6 +24,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||||
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
|
||||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
|
||||||
|
@ -34,9 +35,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Proxy", func() {
|
var _ = Describe("Proxy", func() {
|
||||||
for _, version := range []string{"v1beta3", "v1"} {
|
version := testapi.Version()
|
||||||
Context("version "+version, func() { proxyContext(version) })
|
Context("version "+version, func() { proxyContext(version) })
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -56,7 +56,7 @@ http-server -a localhost -p 8001
|
||||||
Note that you'll need to tell the application where to find the api server by setting the value of the `k8sApiServer` configuration parameter in `www/master/shared/config/development.json` and then rebuilding the application. For example, for a cluster running locally at `localhost:8080`, as described [here](../docs/getting-started-guides/locally.md), you'll want to set it as follows:
|
Note that you'll need to tell the application where to find the api server by setting the value of the `k8sApiServer` configuration parameter in `www/master/shared/config/development.json` and then rebuilding the application. For example, for a cluster running locally at `localhost:8080`, as described [here](../docs/getting-started-guides/locally.md), you'll want to set it as follows:
|
||||||
|
|
||||||
```
|
```
|
||||||
"k8sApiServer": "http://localhost:8080/api/v1beta3"
|
"k8sApiServer": "http://localhost:8080/api/v1"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Building the app for production
|
### Building the app for production
|
||||||
|
|
Loading…
Reference in New Issue