mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-30 17:58:14 +00:00 
			
		
		
		
	Add the ability to customize federation system namespace in e2e turn up scripts.
This commit is contained in:
		| @@ -20,8 +20,9 @@ set -o pipefail | ||||
|  | ||||
| KUBE_ROOT=$(readlink -m $(dirname "${BASH_SOURCE}")/../../) | ||||
|  | ||||
| # For $FEDERATION_NAME, $FEDERATION_KUBE_CONTEXT, $HOST_CLUSTER_CONTEXT, | ||||
| # $KUBEDNS_CONFIGMAP_NAME and $KUBEDNS_CONFIGMAP_NAMESPACE. | ||||
| # For $FEDERATION_NAME, $FEDERATION_NAMESPACE, $FEDERATION_KUBE_CONTEXT, | ||||
| # $HOST_CLUSTER_CONTEXT, $KUBEDNS_CONFIGMAP_NAME and | ||||
| # $KUBEDNS_CONFIGMAP_NAMESPACE. | ||||
| source "${KUBE_ROOT}/federation/cluster/common.sh" | ||||
|  | ||||
| # federation_clusters returns a list of all the clusters in | ||||
| @@ -49,6 +50,7 @@ function unjoin_clusters() { | ||||
|  | ||||
|     "${KUBE_ROOT}/federation/develop/kubefed.sh" unjoin \ | ||||
|         "${context}" \ | ||||
|         --federation-system-namespace=${FEDERATION_NAMESPACE} \ | ||||
|         --context="${FEDERATION_KUBE_CONTEXT}" \ | ||||
|         --host-cluster-context="${HOST_CLUSTER_CONTEXT}" | ||||
|   done | ||||
|   | ||||
| @@ -29,9 +29,9 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. | ||||
| # For `kube::log::status` function since it already sources | ||||
| # "${KUBE_ROOT}/cluster/lib/logging.sh" and DEFAULT_KUBECONFIG | ||||
| source "${KUBE_ROOT}/cluster/common.sh" | ||||
| # For $FEDERATION_NAME, $FEDERATION_KUBE_CONTEXT, $HOST_CLUSTER_CONTEXT, | ||||
| # $KUBEDNS_CONFIGMAP_NAME, $KUBEDNS_CONFIGMAP_NAMESPACE and | ||||
| # $KUBEDNS_FEDERATION_FLAG. | ||||
| # For $FEDERATION_NAME, $FEDERATION_NAMESPACE, $FEDERATION_KUBE_CONTEXT, | ||||
| # $HOST_CLUSTER_CONTEXT, $KUBEDNS_CONFIGMAP_NAME, | ||||
| # $KUBEDNS_CONFIGMAP_NAMESPACE and $KUBEDNS_FEDERATION_FLAG. | ||||
| source "${KUBE_ROOT}/federation/cluster/common.sh" | ||||
|  | ||||
| DNS_ZONE_NAME="${FEDERATION_DNS_ZONE_NAME:-}" | ||||
| @@ -86,6 +86,7 @@ function init() { | ||||
|   timeout --signal=INT --kill-after=1m 20m \ | ||||
|       "${KUBE_ROOT}/federation/develop/kubefed.sh" init \ | ||||
|       "${FEDERATION_NAME}" \ | ||||
|       --federation-system-namespace=${FEDERATION_NAMESPACE} \ | ||||
|       --host-cluster-context="${HOST_CLUSTER_CONTEXT}" \ | ||||
|       --dns-zone-name="${DNS_ZONE_NAME}" \ | ||||
|       --dns-provider="${DNS_PROVIDER}" \ | ||||
| @@ -105,6 +106,7 @@ function join_clusters() { | ||||
|  | ||||
|     "${KUBE_ROOT}/federation/develop/kubefed.sh" join \ | ||||
|         "${context}" \ | ||||
|         --federation-system-namespace=${FEDERATION_NAMESPACE} \ | ||||
|         --host-cluster-context="${HOST_CLUSTER_CONTEXT}" \ | ||||
|         --context="${FEDERATION_NAME}" \ | ||||
|         --secret-name="${context//_/-}"    # Replace "_" by "-" | ||||
|   | ||||
| @@ -102,7 +102,6 @@ go_library( | ||||
|     ], | ||||
|     tags = ["automanaged"], | ||||
|     deps = [ | ||||
|         "//federation/apis/federation/v1beta1:go_default_library", | ||||
|         "//pkg/api:go_default_library", | ||||
|         "//pkg/api/annotations:go_default_library", | ||||
|         "//pkg/api/v1:go_default_library", | ||||
|   | ||||
| @@ -34,7 +34,6 @@ import ( | ||||
| 	"k8s.io/apimachinery/pkg/runtime" | ||||
| 	runtimeutils "k8s.io/apimachinery/pkg/util/runtime" | ||||
| 	utilyaml "k8s.io/apimachinery/pkg/util/yaml" | ||||
| 	federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1" | ||||
| 	"k8s.io/kubernetes/pkg/api" | ||||
| 	"k8s.io/kubernetes/pkg/api/v1" | ||||
| 	"k8s.io/kubernetes/pkg/client/clientset_generated/clientset" | ||||
| @@ -116,7 +115,7 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte { | ||||
| 				metav1.NamespaceSystem, | ||||
| 				metav1.NamespaceDefault, | ||||
| 				metav1.NamespacePublic, | ||||
| 				federationapi.FederationNamespaceSystem, | ||||
| 				framework.FederationSystemNamespace(), | ||||
| 			}) | ||||
| 		if err != nil { | ||||
| 			framework.Failf("Error deleting orphaned namespaces: %v", err) | ||||
|   | ||||
| @@ -13,6 +13,7 @@ go_library( | ||||
|         "authorizer_util.go", | ||||
|         "cleanup.go", | ||||
|         "exec_util.go", | ||||
|         "federation_util.go", | ||||
|         "firewall_util.go", | ||||
|         "framework.go", | ||||
|         "get-kubemark-resource-usage.go", | ||||
| @@ -36,6 +37,7 @@ go_library( | ||||
|     ], | ||||
|     tags = ["automanaged"], | ||||
|     deps = [ | ||||
|         "//federation/apis/federation/v1beta1:go_default_library", | ||||
|         "//pkg/api:go_default_library", | ||||
|         "//pkg/api/v1:go_default_library", | ||||
|         "//pkg/api/v1/service:go_default_library", | ||||
|   | ||||
							
								
								
									
										33
									
								
								test/e2e/framework/federation_util.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								test/e2e/framework/federation_util.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| /* | ||||
| Copyright 2016 The Kubernetes Authors. | ||||
|  | ||||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| you may not use this file except in compliance with the License. | ||||
| You may obtain a copy of the License at | ||||
|  | ||||
|     http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
| Unless required by applicable law or agreed to in writing, software | ||||
| distributed under the License is distributed on an "AS IS" BASIS, | ||||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| See the License for the specific language governing permissions and | ||||
| limitations under the License. | ||||
| */ | ||||
|  | ||||
| package framework | ||||
|  | ||||
| import ( | ||||
| 	"os" | ||||
|  | ||||
| 	federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1" | ||||
| ) | ||||
|  | ||||
| // FederationSystemNamespace returns the namespace in which | ||||
| // the federation system components are hosted. | ||||
| func FederationSystemNamespace() string { | ||||
| 	federationNS := os.Getenv("FEDERATION_NAMESPACE") | ||||
| 	if federationNS != "" { | ||||
| 		return federationNS | ||||
| 	} | ||||
| 	return federationapi.FederationNamespaceSystem | ||||
| } | ||||
| @@ -30,7 +30,6 @@ import ( | ||||
| 	"k8s.io/apimachinery/pkg/util/wait" | ||||
| 	restclient "k8s.io/client-go/rest" | ||||
| 	"k8s.io/client-go/tools/clientcmd" | ||||
| 	federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1" | ||||
| 	"k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" | ||||
| 	"k8s.io/kubernetes/pkg/api" | ||||
| 	"k8s.io/kubernetes/pkg/api/validation" | ||||
| @@ -40,10 +39,7 @@ import ( | ||||
|  | ||||
| // Detects whether the federation namespace exists in the underlying cluster | ||||
| func SkipUnlessFederated(c clientset.Interface) { | ||||
| 	federationNS := os.Getenv("FEDERATION_NAMESPACE") | ||||
| 	if federationNS == "" { | ||||
| 		federationNS = federationapi.FederationNamespaceSystem | ||||
| 	} | ||||
| 	federationNS := framework.FederationSystemNamespace() | ||||
|  | ||||
| 	_, err := c.Core().Namespaces().Get(federationNS, metav1.GetOptions{}) | ||||
| 	if err != nil { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Madhusudan.C.S
					Madhusudan.C.S