mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-17 07:03:31 +00:00
Merge pull request #27260 from nikhiljindal/dnsProvider
Automatic merge from submit-queue
Updating federation up scripts to work in non e2e setup
Ref: https://github.com/kubernetes/kubernetes.github.io/pull/656
Updating the federation up scripts so that they work as per steps in https://github.com/kubernetes/kubernetes.github.io/pull/656.
Changes are:
* Updating the default namespace to be "federation" instead of "federation-e2e"
* Updated the kubeconfig context to be named "federation-cluster" instead of "federated-context"
* Fixing federation-up so that FEDERATION_IMAGE_TAG is set even when federation-up is run without running `e2e.go --up`. e2e-up.sh sets it here: 6a388d4a0d/hack/e2e-internal/e2e-up.sh (L44)
.
* Adding a "missingkey=zero" option to template parser. Without this, the parser adds `"<no value>"` at the place of an env var that is not set. With this change, it instead replaces it with the corresponding zero value (for ex "" for strings). This is required for the FEDERATION_DNS_PROVIDER_CONFIG env var.
cc @kubernetes/sig-cluster-federation @colhom @mml
This commit is contained in:
@@ -46,7 +46,7 @@ if [[ -z "${FEDERATION_PUSH_REPO_BASE}" ]]; then
|
||||
fi
|
||||
|
||||
FEDERATION_IMAGE_REPO_BASE=${FEDERATION_IMAGE_REPO_BASE:-'gcr.io/google_containers'}
|
||||
FEDERATION_NAMESPACE=${FEDERATION_NAMESPACE:-federation-e2e}
|
||||
FEDERATION_NAMESPACE=${FEDERATION_NAMESPACE:-federation}
|
||||
|
||||
KUBE_PLATFORM=${KUBE_PLATFORM:-linux}
|
||||
KUBE_ARCH=${KUBE_ARCH:-amd64}
|
||||
@@ -99,7 +99,7 @@ function create-federation-api-objects {
|
||||
|
||||
FEDERATION_KUBECONFIG_PATH="${KUBE_ROOT}/federation/cluster/kubeconfig"
|
||||
|
||||
federation_kubectl="${KUBE_ROOT}/cluster/kubectl.sh --context=federated-cluster --namespace=default"
|
||||
federation_kubectl="${KUBE_ROOT}/cluster/kubectl.sh --context=federation-cluster --namespace=default"
|
||||
|
||||
manifests_root="${KUBE_ROOT}/federation/manifests/"
|
||||
|
||||
@@ -152,7 +152,7 @@ function create-federation-api-objects {
|
||||
# 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.
|
||||
KUBECONFIG_DIR=$(dirname ${KUBECONFIG:-$DEFAULT_KUBECONFIG})
|
||||
CONTEXT=federated-cluster \
|
||||
CONTEXT=federation-cluster \
|
||||
KUBE_BEARER_TOKEN="$FEDERATION_API_TOKEN" \
|
||||
KUBECONFIG="${KUBECONFIG_DIR}/federation/federation-apiserver/kubeconfig" \
|
||||
create-kubeconfig
|
||||
@@ -169,7 +169,7 @@ function create-federation-api-objects {
|
||||
done
|
||||
|
||||
# Update the users kubeconfig to include federation-apiserver credentials.
|
||||
CONTEXT=federated-cluster \
|
||||
CONTEXT=federation-cluster \
|
||||
KUBE_BEARER_TOKEN="$FEDERATION_API_TOKEN" \
|
||||
SECONDARY_KUBECONFIG=true \
|
||||
create-kubeconfig
|
||||
|
@@ -22,4 +22,11 @@ KUBE_ROOT=$(readlink -m $(dirname "${BASH_SOURCE}")/../../)
|
||||
|
||||
. ${KUBE_ROOT}/federation/cluster/common.sh
|
||||
|
||||
tagfile="${KUBE_ROOT}/federation/manifests/federated-image.tag"
|
||||
if [[ ! -f "$tagfile" ]]; then
|
||||
echo "FATAL: tagfile ${tagfile} does not exist. Make sure that you have run build/push-federation-images.sh"
|
||||
exit 1
|
||||
fi
|
||||
export FEDERATION_IMAGE_TAG="$(cat "${KUBE_ROOT}/federation/manifests/federated-image.tag")"
|
||||
|
||||
create-federation-api-objects
|
||||
|
@@ -64,7 +64,7 @@ func main() {
|
||||
}
|
||||
|
||||
func templateYamlFile(params map[string]string, inpath string, out io.Writer) error {
|
||||
if tmpl, err := template.New(path.Base(inpath)).ParseFiles(inpath); err != nil {
|
||||
if tmpl, err := template.New(path.Base(inpath)).Option("missingkey=zero").ParseFiles(inpath); err != nil {
|
||||
return err
|
||||
} else {
|
||||
if err := tmpl.Execute(out, params); err != nil {
|
||||
|
Reference in New Issue
Block a user