本文整理汇总了Golang中k8s/io/kubernetes/test/e2e/framework.NewDefaultFederatedFramework函数的典型用法代码示例。如果您正苦于以下问题:Golang NewDefaultFederatedFramework函数的具体用法?Golang NewDefaultFederatedFramework怎么用?Golang NewDefaultFederatedFramework使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewDefaultFederatedFramework函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
*/
package e2e
import (
"fmt"
. "github.com/onsi/ginkgo"
federationapi "k8s.io/kubernetes/federation/apis/federation"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/test/e2e/framework"
)
// Create/delete cluster api objects
var _ = framework.KubeDescribe("Federation apiserver [Feature:Federation]", func() {
f := framework.NewDefaultFederatedFramework("federated-cluster")
It("should allow creation of cluster api objects", func() {
framework.SkipUnlessFederated(f.Client)
contexts := f.GetUnderlyingFederatedContexts()
for _, context := range contexts {
framework.Logf("Creating cluster object: %s (%s)", context.Name, context.Cluster.Cluster.Server)
cluster := federationapi.Cluster{
ObjectMeta: api.ObjectMeta{
Name: context.Name,
},
Spec: federationapi.ClusterSpec{
ServerAddressByClientCIDRs: []federationapi.ServerAddressByClientCIDR{
{
ClientCIDR: "0.0.0.0/0",
示例2:
"k8s.io/kubernetes/test/e2e/framework"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
const (
MaxRetriesOnFederatedApiserver = 3
FederatedIngressTimeout = 120 * time.Second
FederatedIngressName = "federated-ingress"
FederatedIngressServiceName = "federated-ingress-service"
FederatedIngressServicePodName = "federated-ingress-service-test-pod"
)
var _ = framework.KubeDescribe("Federated ingresses [Feature:Federation]", func() {
f := framework.NewDefaultFederatedFramework("federated-ingress")
// Create/delete ingress api objects
// Validate federation apiserver, does not rely on underlying clusters or federation ingress controller.
Describe("Ingress objects", func() {
AfterEach(func() {
nsName := f.FederationNamespace.Name
// Delete registered ingresses.
ingressList, err := f.FederationClientset_1_4.Extensions().Ingresses(nsName).List(api.ListOptions{})
Expect(err).NotTo(HaveOccurred())
for _, ingress := range ingressList.Items {
err := f.FederationClientset_1_4.Extensions().Ingresses(nsName).Delete(ingress.Name, &api.DeleteOptions{})
Expect(err).NotTo(HaveOccurred())
}
})
示例3:
"foo": "bar",
}
/*
cluster keeps track of the assorted objects and state related to each cluster
in the federation
*/
type cluster struct {
name string
*release_1_3.Clientset
namespaceCreated bool // Did we need to create a new namespace in this cluster? If so, we should delete it.
backendPod *v1.Pod // The backend pod, if one's been created.
}
var _ = framework.KubeDescribe("[Feature:Federation]", func() {
f := framework.NewDefaultFederatedFramework("federated-service")
var clusters map[string]*cluster // All clusters, keyed by cluster name
var federationName string
var primaryClusterName string // The name of the "primary" cluster
var _ = Describe("Federated Services", func() {
BeforeEach(func() {
framework.SkipUnlessFederated(f.Client)
// TODO: Federation API server should be able to answer this.
if federationName = os.Getenv("FEDERATION_NAME"); federationName == "" {
federationName = DefaultFederationName
}
contexts := f.GetUnderlyingFederatedContexts()
示例4:
. "github.com/onsi/ginkgo"
"k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_4"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/test/e2e/framework"
. "github.com/onsi/gomega"
)
const (
FederationEventName = "federation-event"
)
// Create/delete event api objects.
var _ = framework.KubeDescribe("Federation events [Feature:Federation]", func() {
f := framework.NewDefaultFederatedFramework("federation-event")
Describe("Event objects", func() {
AfterEach(func() {
framework.SkipUnlessFederated(f.Client)
nsName := f.FederationNamespace.Name
// Delete registered events.
eventList, err := f.FederationClientset_1_4.Core().Events(nsName).List(api.ListOptions{})
Expect(err).NotTo(HaveOccurred())
for _, event := range eventList.Items {
err := f.FederationClientset_1_4.Core().Events(nsName).Delete(event.Name, &api.DeleteOptions{})
Expect(err).NotTo(HaveOccurred())
}
})
示例5:
import (
"fmt"
"k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_5"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
"k8s.io/kubernetes/test/e2e/framework"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = framework.KubeDescribe("[Feature:Federation]", func() {
f := framework.NewDefaultFederatedFramework("federation-apiserver-authn")
var _ = Describe("Federation API server authentication", func() {
BeforeEach(func() {
framework.SkipUnlessFederated(f.Client)
})
It("should accept cluster resources when the client has right authentication credentials", func() {
framework.SkipUnlessFederated(f.Client)
nsName := f.FederationNamespace.Name
svc := createServiceOrFail(f.FederationClientset_1_5, nsName, FederatedServiceName)
deleteServiceOrFail(f.FederationClientset_1_5, nsName, svc.Name)
})
It("should not accept cluster resources when the client has invalid authentication credentials", func() {
示例6:
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
api_v1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/test/e2e/framework"
. "github.com/onsi/ginkgo"
)
const (
namespacePrefix = "e2e-namespace-test-"
)
// Create/delete ingress api objects
var _ = framework.KubeDescribe("Federation namespace [Feature:Federation]", func() {
f := framework.NewDefaultFederatedFramework("federation-namespace")
Describe("Namespace objects", func() {
var federationName string
var clusters map[string]*cluster // All clusters, keyed by cluster name
var nsName string
BeforeEach(func() {
framework.SkipUnlessFederated(f.ClientSet)
// TODO: Federation API server should be able to answer this.
if federationName = os.Getenv("FEDERATION_NAME"); federationName == "" {
federationName = DefaultFederationName
}
clusters = map[string]*cluster{}
示例7:
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/test/e2e/framework"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"k8s.io/kubernetes/pkg/api/errors"
)
const (
FederationDeploymentName = "federation-deployment"
FederatedDeploymentTimeout = 120 * time.Second
)
// Create/delete deployment api objects
var _ = framework.KubeDescribe("Federation deployments [Feature:Federation]", func() {
f := framework.NewDefaultFederatedFramework("federation-deployment")
Describe("Deployment objects", func() {
AfterEach(func() {
framework.SkipUnlessFederated(f.ClientSet)
// Delete all deployments.
nsName := f.FederationNamespace.Name
deleteAllDeploymentsOrFail(f.FederationClientset_1_5, nsName)
})
It("should be created and deleted successfully", func() {
framework.SkipUnlessFederated(f.ClientSet)
nsName := f.FederationNamespace.Name
deployment := createDeploymentOrFail(f.FederationClientset_1_5, nsName)
示例8:
. "github.com/onsi/ginkgo"
"k8s.io/kubernetes/federation/client/clientset_generated/federation_release_1_4"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/test/e2e/framework"
. "github.com/onsi/gomega"
)
const (
FederatedSecretName = "federated-secret"
)
// Create/delete secret api objects
var _ = framework.KubeDescribe("Federation secrets [Feature:Federation]", func() {
f := framework.NewDefaultFederatedFramework("federated-secret")
Describe("Secret objects", func() {
AfterEach(func() {
framework.SkipUnlessFederated(f.Client)
// Delete registered secrets.
// This is if a test failed, it should not affect other tests.
secretList, err := f.FederationClientset_1_4.Core().Secrets(f.Namespace.Name).List(api.ListOptions{})
Expect(err).NotTo(HaveOccurred())
for _, secret := range secretList.Items {
err := f.FederationClientset_1_4.Core().Secrets(f.Namespace.Name).Delete(secret.Name, &api.DeleteOptions{})
Expect(err).NotTo(HaveOccurred())
}
})
示例9:
"reflect"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"k8s.io/kubernetes/pkg/api/errors"
)
const (
FederationReplicaSetName = "federation-replicaset"
FederatedReplicaSetTimeout = 120 * time.Second
)
// Create/delete replicaset api objects
var _ = framework.KubeDescribe("Federation replicasets [Feature:Federation]", func() {
f := framework.NewDefaultFederatedFramework("federation-replicaset")
Describe("ReplicaSet objects", func() {
AfterEach(func() {
framework.SkipUnlessFederated(f.ClientSet)
// Delete all replicasets.
nsName := f.FederationNamespace.Name
deleteAllReplicaSetsOrFail(f.FederationClientset_1_5, nsName)
})
It("should be created and deleted successfully", func() {
framework.SkipUnlessFederated(f.ClientSet)
nsName := f.FederationNamespace.Name
replicaset := createReplicaSetOrFail(f.FederationClientset_1_5, nsName)
示例10:
kubeclientset "k8s.io/kubernetes/pkg/client/clientset_generated/release_1_5"
"k8s.io/kubernetes/pkg/util/wait"
"k8s.io/kubernetes/test/e2e/framework"
)
const (
FederatedDaemonSetName = "federated-daemonset"
FederatedDaemonSetTimeout = 60 * time.Second
FederatedDaemonSetMaxRetries = 3
)
// Create/delete daemonset api objects
var _ = framework.KubeDescribe("Federation daemonsets [Feature:Federation]", func() {
var clusters map[string]*cluster // All clusters, keyed by cluster name
f := framework.NewDefaultFederatedFramework("federated-daemonset")
Describe("DaemonSet objects", func() {
BeforeEach(func() {
framework.SkipUnlessFederated(f.ClientSet)
clusters = map[string]*cluster{}
registerClusters(clusters, UserAgentName, "", f)
})
AfterEach(func() {
framework.SkipUnlessFederated(f.ClientSet)
// Delete all daemonsets.
nsName := f.FederationNamespace.Name
deleteAllDaemonSetsOrFail(f.FederationClientset_1_5, nsName)
unregisterClusters(clusters, f)