mirror of https://github.com/k3s-io/k3s
Merge pull request #42975 from smarterclayton/time_namespace
Automatic merge from submit-queue (batch tested with PRs 40234, 45885, 42975) Log how much time it takes e2e tests to clean up the namespacepull/6/head
commit
7df0178076
|
@ -155,7 +155,9 @@ func (nm *NamespaceController) worker() {
|
|||
// syncNamespaceFromKey looks for a namespace with the specified key in its store and synchronizes it
|
||||
func (nm *NamespaceController) syncNamespaceFromKey(key string) (err error) {
|
||||
startTime := time.Now()
|
||||
defer glog.V(4).Infof("Finished syncing namespace %q (%v)", key, time.Now().Sub(startTime))
|
||||
defer func() {
|
||||
glog.V(4).Infof("Finished syncing namespace %q (%v)", key, time.Now().Sub(startTime))
|
||||
}()
|
||||
|
||||
namespace, err := nm.lister.Get(key)
|
||||
if errors.IsNotFound(err) {
|
||||
|
@ -174,16 +176,14 @@ func (nm *NamespaceController) Run(workers int, stopCh <-chan struct{}) {
|
|||
defer utilruntime.HandleCrash()
|
||||
defer nm.queue.ShutDown()
|
||||
|
||||
glog.Info("Starting namespace controller")
|
||||
defer glog.Infof("Shutting down namespace controller")
|
||||
|
||||
if !controller.WaitForCacheSync("namespace", stopCh, nm.listerSynced) {
|
||||
return
|
||||
}
|
||||
|
||||
glog.V(5).Info("Starting workers")
|
||||
for i := 0; i < workers; i++ {
|
||||
go wait.Until(nm.worker, time.Second, stopCh)
|
||||
}
|
||||
|
||||
<-stopCh
|
||||
glog.V(1).Infof("Shutting down")
|
||||
}
|
||||
|
|
|
@ -539,6 +539,7 @@ func doConfigMapE2EWithoutMappings(f *framework.Framework, uid, fsGroup int64, d
|
|||
framework.Failf("unable to create test configMap %s: %v", configMap.Name, err)
|
||||
}
|
||||
|
||||
one := int64(1)
|
||||
pod := &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "pod-configmaps-" + string(uuid.NewUUID()),
|
||||
|
@ -572,7 +573,8 @@ func doConfigMapE2EWithoutMappings(f *framework.Framework, uid, fsGroup int64, d
|
|||
},
|
||||
},
|
||||
},
|
||||
RestartPolicy: v1.RestartPolicyNever,
|
||||
RestartPolicy: v1.RestartPolicyNever,
|
||||
TerminationGracePeriodSeconds: &one,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -617,6 +619,7 @@ func doConfigMapE2EWithMappings(f *framework.Framework, uid, fsGroup int64, item
|
|||
framework.Failf("unable to create test configMap %s: %v", configMap.Name, err)
|
||||
}
|
||||
|
||||
one := int64(1)
|
||||
pod := &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "pod-configmaps-" + string(uuid.NewUUID()),
|
||||
|
@ -656,7 +659,8 @@ func doConfigMapE2EWithMappings(f *framework.Framework, uid, fsGroup int64, item
|
|||
},
|
||||
},
|
||||
},
|
||||
RestartPolicy: v1.RestartPolicyNever,
|
||||
RestartPolicy: v1.RestartPolicyNever,
|
||||
TerminationGracePeriodSeconds: &one,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ const testContainerName = "test-container"
|
|||
func entrypointTestPod() *v1.Pod {
|
||||
podName := "client-containers-" + string(uuid.NewUUID())
|
||||
|
||||
one := int64(1)
|
||||
return &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: podName,
|
||||
|
@ -82,7 +83,8 @@ func entrypointTestPod() *v1.Pod {
|
|||
Image: "gcr.io/google_containers/eptest:0.1",
|
||||
},
|
||||
},
|
||||
RestartPolicy: v1.RestartPolicyNever,
|
||||
RestartPolicy: v1.RestartPolicyNever,
|
||||
TerminationGracePeriodSeconds: &one,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -958,12 +958,13 @@ func CheckTestingNSDeletedExcept(c clientset.Interface, skip string) error {
|
|||
// deleteNS deletes the provided namespace, waits for it to be completely deleted, and then checks
|
||||
// whether there are any pods remaining in a non-terminating state.
|
||||
func deleteNS(c clientset.Interface, clientPool dynamic.ClientPool, namespace string, timeout time.Duration) error {
|
||||
startTime := time.Now()
|
||||
if err := c.Core().Namespaces().Delete(namespace, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// wait for namespace to delete or timeout.
|
||||
err := wait.PollImmediate(5*time.Second, timeout, func() (bool, error) {
|
||||
err := wait.PollImmediate(2*time.Second, timeout, func() (bool, error) {
|
||||
if _, err := c.Core().Namespaces().Get(namespace, metav1.GetOptions{}); err != nil {
|
||||
if apierrs.IsNotFound(err) {
|
||||
return true, nil
|
||||
|
@ -1011,6 +1012,7 @@ func deleteNS(c clientset.Interface, clientPool dynamic.ClientPool, namespace st
|
|||
// no remaining content, but namespace was not deleted (namespace controller is probably wedged)
|
||||
return fmt.Errorf("namespace %v was not deleted with limit: %v, namespace is empty but is not yet removed", namespace, err)
|
||||
}
|
||||
Logf("namespace %v deletion completed in %s", namespace, time.Now().Sub(startTime))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -494,6 +494,7 @@ func (config *RCConfig) create() error {
|
|||
if config.DNSPolicy == nil {
|
||||
config.DNSPolicy = &dnsDefault
|
||||
}
|
||||
one := int64(1)
|
||||
rc := &v1.ReplicationController{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: config.Name,
|
||||
|
@ -517,8 +518,9 @@ func (config *RCConfig) create() error {
|
|||
ReadinessProbe: config.ReadinessProbe,
|
||||
},
|
||||
},
|
||||
DNSPolicy: *config.DNSPolicy,
|
||||
NodeSelector: config.NodeSelector,
|
||||
DNSPolicy: *config.DNSPolicy,
|
||||
NodeSelector: config.NodeSelector,
|
||||
TerminationGracePeriodSeconds: &one,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue