當前位置: 首頁>>代碼示例>>Golang>>正文


Golang framework.WaitForStableCluster函數代碼示例

本文整理匯總了Golang中k8s/io/kubernetes/test/e2e/framework.WaitForStableCluster函數的典型用法代碼示例。如果您正苦於以下問題:Golang WaitForStableCluster函數的具體用法?Golang WaitForStableCluster怎麽用?Golang WaitForStableCluster使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了WaitForStableCluster函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1:

    // This test verifies that max-pods flag works as advertised. It assumes that cluster add-on pods stay stable
    // and cannot be run in parallel with any other test that touches Nodes or Pods. It is so because to check
    // if max-pods is working we need to fully saturate the cluster and keep it in this state for few seconds.
    //
    // Slow PR #13315 (8 min)
    It("validates MaxPods limit number of pods that are allowed to run [Slow]", func() {
        totalPodCapacity = 0

        for _, node := range nodeList.Items {
            framework.Logf("Node: %v", node)
            podCapacity, found := node.Status.Capacity["pods"]
            Expect(found).To(Equal(true))
            totalPodCapacity += podCapacity.Value()
        }

        currentlyScheduledPods := framework.WaitForStableCluster(c, masterNodes)
        podsNeededForSaturation := int(totalPodCapacity) - currentlyScheduledPods

        By(fmt.Sprintf("Starting additional %v Pods to fully saturate the cluster max pods and trying to start another one", podsNeededForSaturation))

        // As the pods are distributed randomly among nodes,
        // it can easily happen that all nodes are satured
        // and there is no need to create additional pods.
        // StartPods requires at least one pod to replicate.
        if podsNeededForSaturation > 0 {
            framework.ExpectNoError(testutils.StartPods(c, podsNeededForSaturation, ns, "maxp",
                *initPausePod(f, pausePodConfig{
                    Name:   "",
                    Labels: map[string]string{"name": ""},
                }), true, framework.Logf))
        }
開發者ID:Random-Liu,項目名稱:kubernetes,代碼行數:31,代碼來源:scheduler_predicates.go

示例2:

            By("Removing additional replication controllers if any")
            for i := 1; i <= nodeCount; i++ {
                name := additionalPodsPrefix + "-" + strconv.Itoa(i)
                c.ReplicationControllers(ns).Delete(name, nil)
            }
        })
    }

    // Calculate total number of pods from each node's max-pod
    It("[Feature:ManualPerformance] should allow running maximum capacity pods on nodes", func() {
        totalPods = 0
        for _, n := range nodes.Items {
            totalPods += int(n.Status.Capacity.Pods().Value())
        }
        totalPods -= framework.WaitForStableCluster(c, masters)

        fileHndl, err := os.Create(fmt.Sprintf(framework.TestContext.OutputDir+"/%s/pod_states.csv", uuid))
        framework.ExpectNoError(err)
        defer fileHndl.Close()
        rcCnt := 1
        RCConfigs := make([]framework.RCConfig, rcCnt)
        podsPerRC := int(totalPods / rcCnt)
        for i := 0; i < rcCnt; i++ {
            if i == rcCnt-1 {
                podsPerRC += int(math.Mod(float64(totalPods), float64(rcCnt)))
            }
            RCName = "density" + strconv.Itoa(totalPods) + "-" + strconv.Itoa(i) + "-" + uuid
            RCConfigs[i] = framework.RCConfig{Client: c,
                Image:                "gcr.io/google_containers/pause-amd64:3.0",
                Name:                 RCName,
開發者ID:CodeJuan,項目名稱:kubernetes,代碼行數:30,代碼來源:density.go


注:本文中的k8s/io/kubernetes/test/e2e/framework.WaitForStableCluster函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。