mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
Configurably skip creation of namespace on e2e setup
This commit is contained in:
parent
5ef8148b5e
commit
6170378764
@ -64,7 +64,8 @@ type Framework struct {
|
|||||||
StagingClient *staging.Clientset
|
StagingClient *staging.Clientset
|
||||||
ClientPool dynamic.ClientPool
|
ClientPool dynamic.ClientPool
|
||||||
|
|
||||||
Namespace *v1.Namespace // Every test has at least one namespace
|
SkipNamespaceCreation bool // Whether to skip creating a namespace
|
||||||
|
Namespace *v1.Namespace // Every test has at least one namespace unless creation is skipped
|
||||||
namespacesToDelete []*v1.Namespace // Some tests have more than one.
|
namespacesToDelete []*v1.Namespace // Some tests have more than one.
|
||||||
NamespaceDeletionTimeout time.Duration
|
NamespaceDeletionTimeout time.Duration
|
||||||
|
|
||||||
@ -181,6 +182,7 @@ func (f *Framework) BeforeEach() {
|
|||||||
f.ClientPool = dynamic.NewClientPool(config, api.Registry.RESTMapper(), dynamic.LegacyAPIPathResolverFunc)
|
f.ClientPool = dynamic.NewClientPool(config, api.Registry.RESTMapper(), dynamic.LegacyAPIPathResolverFunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !f.SkipNamespaceCreation {
|
||||||
By("Building a namespace api object")
|
By("Building a namespace api object")
|
||||||
namespace, err := f.CreateNamespace(f.BaseName, map[string]string{
|
namespace, err := f.CreateNamespace(f.BaseName, map[string]string{
|
||||||
"e2e-framework": f.BaseName,
|
"e2e-framework": f.BaseName,
|
||||||
@ -196,8 +198,10 @@ func (f *Framework) BeforeEach() {
|
|||||||
} else {
|
} else {
|
||||||
Logf("Skipping waiting for service account")
|
Logf("Skipping waiting for service account")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if TestContext.GatherKubeSystemResourceUsageData != "false" && TestContext.GatherKubeSystemResourceUsageData != "none" {
|
if TestContext.GatherKubeSystemResourceUsageData != "false" && TestContext.GatherKubeSystemResourceUsageData != "none" {
|
||||||
|
var err error
|
||||||
f.gatherer, err = NewResourceUsageGatherer(f.ClientSet, ResourceGathererOptions{
|
f.gatherer, err = NewResourceUsageGatherer(f.ClientSet, ResourceGathererOptions{
|
||||||
inKubemark: ProviderIs("kubemark"),
|
inKubemark: ProviderIs("kubemark"),
|
||||||
masterOnly: TestContext.GatherKubeSystemResourceUsageData == "master",
|
masterOnly: TestContext.GatherKubeSystemResourceUsageData == "master",
|
||||||
@ -274,7 +278,9 @@ func (f *Framework) AfterEach() {
|
|||||||
// Print events if the test failed.
|
// Print events if the test failed.
|
||||||
if CurrentGinkgoTestDescription().Failed && TestContext.DumpLogsOnFailure {
|
if CurrentGinkgoTestDescription().Failed && TestContext.DumpLogsOnFailure {
|
||||||
// Pass both unversioned client and and versioned clientset, till we have removed all uses of the unversioned client.
|
// Pass both unversioned client and and versioned clientset, till we have removed all uses of the unversioned client.
|
||||||
|
if !f.SkipNamespaceCreation {
|
||||||
DumpAllNamespaceInfo(f.ClientSet, f.Namespace.Name)
|
DumpAllNamespaceInfo(f.ClientSet, f.Namespace.Name)
|
||||||
|
}
|
||||||
By(fmt.Sprintf("Dumping a list of prepulled images on each node"))
|
By(fmt.Sprintf("Dumping a list of prepulled images on each node"))
|
||||||
LogContainersInPodsWithLabels(f.ClientSet, metav1.NamespaceSystem, ImagePullerLabels, "image-puller", Logf)
|
LogContainersInPodsWithLabels(f.ClientSet, metav1.NamespaceSystem, ImagePullerLabels, "image-puller", Logf)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user