mirror of https://github.com/k3s-io/k3s
Merge pull request #39132 from madhusudancs/fed-newtest-refactor-develop-sh
Automatic merge from submit-queue [Federation] Recompute registry name and version tag in the federation up script.sh and a bunch of other fixes.pull/6/head
commit
5fc2b3522c
|
@ -160,7 +160,7 @@ function create-federation-api-objects {
|
||||||
gen-kube-basicauth
|
gen-kube-basicauth
|
||||||
export FEDERATION_API_BASIC_AUTH="${KUBE_PASSWORD},${KUBE_USER},admin"
|
export FEDERATION_API_BASIC_AUTH="${KUBE_PASSWORD},${KUBE_USER},admin"
|
||||||
|
|
||||||
# Create a kubeconfig with credentails for federation-apiserver. We will
|
# Create a kubeconfig with credentials for federation-apiserver. We will
|
||||||
# then use this kubeconfig to create a secret which the federation
|
# then use this kubeconfig to create a secret which the federation
|
||||||
# controller manager can use to talk to the federation-apiserver.
|
# controller manager can use to talk to the federation-apiserver.
|
||||||
# Note that the file name should be "kubeconfig" so that the secret key gets the same name.
|
# Note that the file name should be "kubeconfig" so that the secret key gets the same name.
|
||||||
|
@ -203,12 +203,14 @@ function create-federation-api-objects {
|
||||||
export FEDERATION_ADMISSION_CONTROL="${FEDERATION_ADMISSION_CONTROL:-NamespaceLifecycle}"
|
export FEDERATION_ADMISSION_CONTROL="${FEDERATION_ADMISSION_CONTROL:-NamespaceLifecycle}"
|
||||||
|
|
||||||
for file in federation-etcd-pvc.yaml federation-apiserver-{deployment,secrets}.yaml federation-controller-manager-deployment.yaml; do
|
for file in federation-etcd-pvc.yaml federation-apiserver-{deployment,secrets}.yaml federation-controller-manager-deployment.yaml; do
|
||||||
|
echo "Creating manifest: ${file}"
|
||||||
|
$template "${manifests_root}/${file}"
|
||||||
$template "${manifests_root}/${file}" | $host_kubectl create -f -
|
$template "${manifests_root}/${file}" | $host_kubectl create -f -
|
||||||
done
|
done
|
||||||
|
|
||||||
# Update the users kubeconfig to include federation-apiserver credentials.
|
# Update the users kubeconfig to include federation-apiserver credentials.
|
||||||
CONTEXT=${FEDERATION_KUBE_CONTEXT} \
|
CONTEXT=${FEDERATION_KUBE_CONTEXT} \
|
||||||
KUBE_BEARER_TOKEN="$FEDERATION_API_TOKEN" \
|
KUBE_BEARER_TOKEN="${FEDERATION_API_TOKEN}" \
|
||||||
KUBE_USER="${KUBE_USER}" \
|
KUBE_USER="${KUBE_USER}" \
|
||||||
KUBE_PASSWORD="${KUBE_PASSWORD}" \
|
KUBE_PASSWORD="${KUBE_PASSWORD}" \
|
||||||
SECONDARY_KUBECONFIG=true \
|
SECONDARY_KUBECONFIG=true \
|
||||||
|
|
|
@ -32,10 +32,6 @@ source "${KUBE_ROOT}/cluster/common.sh"
|
||||||
# For $KUBE_PLATFORM, $KUBE_ARCH, $KUBE_BUILD_STAGE,
|
# For $KUBE_PLATFORM, $KUBE_ARCH, $KUBE_BUILD_STAGE,
|
||||||
# $FEDERATION_PUSH_REPO_BASE and $FEDERATION_NAMESPACE.
|
# $FEDERATION_PUSH_REPO_BASE and $FEDERATION_NAMESPACE.
|
||||||
source "${KUBE_ROOT}/federation/cluster/common.sh"
|
source "${KUBE_ROOT}/federation/cluster/common.sh"
|
||||||
# For `get_version` function and $KUBE_REGISTRY.
|
|
||||||
# TODO(madhusudancs): Remove this when the code here is moved
|
|
||||||
# to federation/develop.sh
|
|
||||||
source "${KUBE_ROOT}/federation/develop/develop.sh"
|
|
||||||
|
|
||||||
FEDERATION_NAME="${FEDERATION_NAME:-e2e-federation}"
|
FEDERATION_NAME="${FEDERATION_NAME:-e2e-federation}"
|
||||||
FEDERATION_KUBE_CONTEXT="${FEDERATION_KUBE_CONTEXT:-e2e-federation}"
|
FEDERATION_KUBE_CONTEXT="${FEDERATION_KUBE_CONTEXT:-e2e-federation}"
|
||||||
|
@ -50,13 +46,15 @@ kubectl="${CLIENT_BIN_DIR}/kubectl"
|
||||||
function init() {
|
function init() {
|
||||||
kube::log::status "Deploying federation control plane for ${FEDERATION_NAME} in cluster ${HOST_CLUSTER_CONTEXT}"
|
kube::log::status "Deploying federation control plane for ${FEDERATION_NAME} in cluster ${HOST_CLUSTER_CONTEXT}"
|
||||||
|
|
||||||
local -r kube_version="$(get_version)"
|
local -r project="${KUBE_PROJECT:-${PROJECT:-}}"
|
||||||
|
local -r kube_registry="${KUBE_REGISTRY:-gcr.io/${project}}"
|
||||||
|
local -r kube_version="${KUBERNETES_RELEASE:-}"
|
||||||
|
|
||||||
${kubefed} init \
|
${kubefed} init \
|
||||||
"${FEDERATION_NAME}" \
|
"${FEDERATION_NAME}" \
|
||||||
--host-cluster-context="${HOST_CLUSTER_CONTEXT}" \
|
--host-cluster-context="${HOST_CLUSTER_CONTEXT}" \
|
||||||
--dns-zone-name="${DNS_ZONE_NAME}" \
|
--dns-zone-name="${DNS_ZONE_NAME}" \
|
||||||
--image="${KUBE_REGISTRY}/hyperkube-amd64:${kube_version}"
|
--image="${kube_registry}/hyperkube-amd64:${kube_version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# create_cluster_secrets creates the secrets containing the kubeconfigs
|
# create_cluster_secrets creates the secrets containing the kubeconfigs
|
||||||
|
@ -84,6 +82,6 @@ if [[ "${USE_KUBEFED}" == "true" ]]; then
|
||||||
init
|
init
|
||||||
create_cluster_secrets
|
create_cluster_secrets
|
||||||
else
|
else
|
||||||
export FEDERATION_IMAGE_TAG="$(get_version)"
|
export FEDERATION_IMAGE_TAG="$(echo ${KUBERNETES_RELEASE:-} | tr + _)"
|
||||||
create-federation-api-objects
|
create-federation-api-objects
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -21,7 +21,6 @@ spec:
|
||||||
- federation-apiserver
|
- federation-apiserver
|
||||||
- --bind-address=0.0.0.0
|
- --bind-address=0.0.0.0
|
||||||
- --etcd-servers=http://localhost:2379
|
- --etcd-servers=http://localhost:2379
|
||||||
- --service-cluster-ip-range={{.FEDERATION_SERVICE_CIDR}}
|
|
||||||
- --secure-port=443
|
- --secure-port=443
|
||||||
{{if eq .IS_DNS_NAME "false"}}
|
{{if eq .IS_DNS_NAME "false"}}
|
||||||
- --advertise-address={{.FEDERATION_API_HOST}}
|
- --advertise-address={{.FEDERATION_API_HOST}}
|
||||||
|
|
|
@ -751,7 +751,6 @@ func (f *Framework) GetUnderlyingFederatedContexts() []E2EContext {
|
||||||
e2eContexts := []E2EContext{}
|
e2eContexts := []E2EContext{}
|
||||||
for _, context := range kubeconfig.Contexts {
|
for _, context := range kubeconfig.Contexts {
|
||||||
if strings.HasPrefix(context.Name, "federation") && context.Name != federatedKubeContext {
|
if strings.HasPrefix(context.Name, "federation") && context.Name != federatedKubeContext {
|
||||||
|
|
||||||
user := kubeconfig.findUser(context.Context.User)
|
user := kubeconfig.findUser(context.Context.User)
|
||||||
if user == nil {
|
if user == nil {
|
||||||
Failf("Could not find user for context %+v", context)
|
Failf("Could not find user for context %+v", context)
|
||||||
|
|
Loading…
Reference in New Issue