mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #41599 from madhusudancs/fed-e2e-common-vars-cleanup
Automatic merge from submit-queue Refactor federation-up.sh script. Move common variables to common.sh script in preparation for the upcoming changes to federation-down.sh that also depends on these common variables. ```release-note NONE ``` cc @kubernetes/sig-federation-pr-reviews @shashidharatd
This commit is contained in:
commit
960efff770
@ -54,6 +54,15 @@ KUBE_BUILD_STAGE=${KUBE_BUILD_STAGE:-release-stage}
|
|||||||
|
|
||||||
source "${KUBE_ROOT}/cluster/common.sh"
|
source "${KUBE_ROOT}/cluster/common.sh"
|
||||||
|
|
||||||
|
# kubefed configuration
|
||||||
|
FEDERATION_KUBE_CONTEXT="${FEDERATION_KUBE_CONTEXT:-e2e-federation}"
|
||||||
|
HOST_CLUSTER_CONTEXT="${FEDERATION_HOST_CLUSTER_CONTEXT:-${1}}"
|
||||||
|
|
||||||
|
# kube-dns configuration.
|
||||||
|
KUBEDNS_CONFIGMAP_NAME="kube-dns"
|
||||||
|
KUBEDNS_CONFIGMAP_NAMESPACE="kube-system"
|
||||||
|
KUBEDNS_FEDERATION_FLAG="federations"
|
||||||
|
|
||||||
host_kubectl="${KUBE_ROOT}/cluster/kubectl.sh --namespace=${FEDERATION_NAMESPACE}"
|
host_kubectl="${KUBE_ROOT}/cluster/kubectl.sh --namespace=${FEDERATION_NAMESPACE}"
|
||||||
|
|
||||||
# required:
|
# required:
|
||||||
|
@ -29,13 +29,15 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
|||||||
# For `kube::log::status` function since it already sources
|
# For `kube::log::status` function since it already sources
|
||||||
# "${KUBE_ROOT}/cluster/lib/logging.sh" and DEFAULT_KUBECONFIG
|
# "${KUBE_ROOT}/cluster/lib/logging.sh" and DEFAULT_KUBECONFIG
|
||||||
source "${KUBE_ROOT}/cluster/common.sh"
|
source "${KUBE_ROOT}/cluster/common.sh"
|
||||||
# For $FEDERATION_PUSH_REPO_BASE and $FEDERATION_NAMESPACE.
|
# For $FEDERATION_KUBE_CONTEXT, $HOST_CLUSTER_CONTEXT,
|
||||||
|
# $KUBEDNS_CONFIGMAP_NAME, $KUBEDNS_CONFIGMAP_NAMESPACE and
|
||||||
|
# $KUBEDNS_FEDERATION_FLAG.
|
||||||
source "${KUBE_ROOT}/federation/cluster/common.sh"
|
source "${KUBE_ROOT}/federation/cluster/common.sh"
|
||||||
|
|
||||||
FEDERATION_NAME="${FEDERATION_NAME:-e2e-federation}"
|
FEDERATION_NAME="${FEDERATION_NAME:-e2e-federation}"
|
||||||
FEDERATION_KUBE_CONTEXT="${FEDERATION_KUBE_CONTEXT:-e2e-federation}"
|
|
||||||
DNS_ZONE_NAME="${FEDERATION_DNS_ZONE_NAME:-}"
|
DNS_ZONE_NAME="${FEDERATION_DNS_ZONE_NAME:-}"
|
||||||
HOST_CLUSTER_CONTEXT="${FEDERATION_HOST_CLUSTER_CONTEXT:-${1}}"
|
FEDERATIONS_DOMAIN_MAP="${FEDERATIONS_DOMAIN_MAP:-}"
|
||||||
|
|
||||||
# get_version returns the version in KUBERNETES_RELEASE or defaults to the
|
# get_version returns the version in KUBERNETES_RELEASE or defaults to the
|
||||||
# value in the federation `versions` file.
|
# value in the federation `versions` file.
|
||||||
@ -85,9 +87,9 @@ function init() {
|
|||||||
--image="${kube_registry}/hyperkube-amd64:${kube_version}"
|
--image="${kube_registry}/hyperkube-amd64:${kube_version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# join_cluster_to_federation joins the clusters in the local kubeconfig to federation. The clusters
|
# join_clusters joins the clusters in the local kubeconfig to federation. The clusters
|
||||||
# and their kubeconfig entries in the local kubeconfig are created while deploying clusters, i.e. when kube-up is run.
|
# and their kubeconfig entries in the local kubeconfig are created while deploying clusters, i.e. when kube-up is run.
|
||||||
function join_cluster_to_federation() {
|
function join_clusters() {
|
||||||
for cluster in $("${KUBE_ROOT}/cluster/kubectl.sh" config get-clusters |sed -n '1!p'); do
|
for cluster in $("${KUBE_ROOT}/cluster/kubectl.sh" config get-clusters |sed -n '1!p'); do
|
||||||
# Skip federation context
|
# Skip federation context
|
||||||
if [[ "${cluster}" == "${FEDERATION_NAME}" ]]; then
|
if [[ "${cluster}" == "${FEDERATION_NAME}" ]]; then
|
||||||
@ -112,8 +114,7 @@ USE_KUBEFED="${USE_KUBEFED:-}"
|
|||||||
|
|
||||||
if [[ "${USE_KUBEFED}" == "true" ]]; then
|
if [[ "${USE_KUBEFED}" == "true" ]]; then
|
||||||
init
|
init
|
||||||
|
join_clusters
|
||||||
join_cluster_to_federation
|
|
||||||
else
|
else
|
||||||
export FEDERATION_IMAGE_TAG="$(get_version)"
|
export FEDERATION_IMAGE_TAG="$(get_version)"
|
||||||
create-federation-api-objects
|
create-federation-api-objects
|
||||||
|
Loading…
Reference in New Issue
Block a user