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


Golang Framework.GetUnderlyingFederatedContexts方法代碼示例

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


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

示例1: registerClusters

// can not be moved to util, as By and Expect must be put in Ginkgo test unit
func registerClusters(clusters map[string]*cluster, userAgentName, federationName string, f *framework.Framework) string {
	contexts := f.GetUnderlyingFederatedContexts()

	for _, context := range contexts {
		createClusterObjectOrFail(f, &context)
	}

	By("Obtaining a list of all the clusters")
	clusterList := waitForAllClustersReady(f, len(contexts))

	framework.Logf("Checking that %d clusters are Ready", len(contexts))
	for _, context := range contexts {
		clusterIsReadyOrFail(f, &context)
	}
	framework.Logf("%d clusters are Ready", len(contexts))

	primaryClusterName := clusterList.Items[0].Name
	By(fmt.Sprintf("Labeling %q as the first cluster", primaryClusterName))
	for i, c := range clusterList.Items {
		framework.Logf("Creating a clientset for the cluster %s", c.Name)
		Expect(framework.TestContext.KubeConfig).ToNot(Equal(""), "KubeConfig must be specified to load clusters' client config")
		clusters[c.Name] = &cluster{c.Name, createClientsetForCluster(c, i, userAgentName), false, nil}
	}
	createNamespaceInClusters(clusters, f)
	return primaryClusterName
}
開發者ID:nak3,項目名稱:kubernetes,代碼行數:27,代碼來源:federation-util.go

示例2: buildClustersOrFail_14

func buildClustersOrFail_14(f *framework.Framework) []*federation_api.Cluster {
	contexts := f.GetUnderlyingFederatedContexts()

	for _, context := range contexts {
		createClusterObjectOrFail_14(f, &context)
	}

	// Wait for all clusters to become ready for up to 5 min.
	if err := wait.PollImmediate(5*time.Second, 5*time.Minute, func() (bool, error) {
		for _, context := range contexts {
			cluster, err := f.FederationClientset_1_4.Federation().Clusters().Get(context.Name)
			if err != nil {
				return false, err
			}
			ready := false
			for _, condition := range cluster.Status.Conditions {
				if condition.Type == federation_api.ClusterReady && condition.Status == api_v1.ConditionTrue {
					ready = true
				}
			}
			if !ready {
				return false, nil
			}
		}
		return true, nil
	}); err != nil {
		framework.Failf("Not all clusters are ready: %v", err)
	}

	clusterList, err := f.FederationClientset_1_4.Federation().Clusters().List(api.ListOptions{})
	if err != nil {
		framework.Failf("Error in get clusters: %v", err)
	}
	result := make([]*federation_api.Cluster, 0, len(contexts))
	for i := range clusterList.Items {
		result = append(result, &clusterList.Items[i])
	}
	return result
}
開發者ID:juanluisvaladas,項目名稱:origin,代碼行數:39,代碼來源:federation-util-14.go


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