Merge pull request #38750 from shashidharatd/federation-ci

Automatic merge from submit-queue (batch tested with PRs 38830, 38750)

[Federation] Stop cleaning federation namespace in e2e tests

when --clean-start=true flag is provided to e2e tests it would cleanup all the leftover namespaces except `default` and `kube-system` and because of this when we run e2e tests in federation soak test job, the federation control plane is destroyed before it runs the tests and all tests start to fail.

So adding federation-system to the list of namespace to be left intact and also changed the default federation namespace name from `federation` to `federation-system` to be consistent with the newer method of deploying federation using kubefed.

@madhusudancs  @nikhiljindal
This commit is contained in:
Kubernetes Submit Queue 2016-12-16 02:16:17 -08:00 committed by GitHub
commit cf2dc3968b
6 changed files with 12 additions and 3 deletions

View File

@ -120,3 +120,8 @@ type ClusterList struct {
// List of Cluster objects.
Items []Cluster `json:"items" protobuf:"bytes,2,rep,name=items"`
}
const (
// FederationNamespaceSystem is the system namespace where we place federation control plane components.
FederationNamespaceSystem string = "federation-system"
)

View File

@ -351,6 +351,7 @@ function push-federation-images {
}
function cleanup-federation-api-objects {
echo "Cleaning Federation control plane objects"
# Delete all resources with the federated-cluster label.
$host_kubectl delete pods,svc,rc,deployment,secret -lapp=federated-cluster
# Delete all resources in FEDERATION_NAMESPACE.

View File

@ -30,7 +30,7 @@ source "${KUBE_ROOT}/cluster/kube-util.sh"
prepare-e2e
if [[ "${FEDERATION:-}" == "true" ]];then
FEDERATION_NAMESPACE=${FEDERATION_NAMESPACE:-federation}
FEDERATION_NAMESPACE=${FEDERATION_NAMESPACE:-federation-system}
#TODO(colhom): the last cluster that was created in the loop above is the current context.
# Hence, it will be the cluster that hosts the federated components.
# In the future, we will want to loop through the all the federated contexts,

View File

@ -30,6 +30,7 @@ import (
"github.com/onsi/ginkgo/reporters"
"github.com/onsi/gomega"
federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/v1"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
@ -108,7 +109,7 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
// Delete any namespaces except default and kube-system. This ensures no
// lingering resources are left over from a previous test run.
if framework.TestContext.CleanStart {
deleted, err := framework.DeleteNamespaces(c, nil /* deleteFilter */, []string{api.NamespaceSystem, v1.NamespaceDefault})
deleted, err := framework.DeleteNamespaces(c, nil /* deleteFilter */, []string{api.NamespaceSystem, v1.NamespaceDefault, federationapi.FederationNamespaceSystem})
if err != nil {
framework.Failf("Error deleting orphaned namespaces: %v", err)
}

View File

@ -29,6 +29,7 @@ go_library(
],
tags = ["automanaged"],
deps = [
"//federation/apis/federation/v1beta1:go_default_library",
"//federation/client/clientset_generated/federation_clientset:go_default_library",
"//pkg/api:go_default_library",
"//pkg/api/errors:go_default_library",

View File

@ -49,6 +49,7 @@ import (
. "github.com/onsi/gomega"
gomegatypes "github.com/onsi/gomega/types"
federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1"
"k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset"
"k8s.io/kubernetes/pkg/api"
apierrs "k8s.io/kubernetes/pkg/api/errors"
@ -363,7 +364,7 @@ func SkipUnlessServerVersionGTE(v *utilversion.Version, c discovery.ServerVersio
func SkipUnlessFederated(c clientset.Interface) {
federationNS := os.Getenv("FEDERATION_NAMESPACE")
if federationNS == "" {
federationNS = "federation-system"
federationNS = federationapi.FederationNamespaceSystem
}
_, err := c.Core().Namespaces().Get(federationNS, metav1.GetOptions{})