本文整理汇总了Golang中k8s/io/kubernetes/pkg/client/typed/discovery.NewDiscoveryClientForConfigOrDie函数的典型用法代码示例。如果您正苦于以下问题:Golang NewDiscoveryClientForConfigOrDie函数的具体用法?Golang NewDiscoveryClientForConfigOrDie怎么用?Golang NewDiscoveryClientForConfigOrDie使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewDiscoveryClientForConfigOrDie函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewClusterClientSet
func NewClusterClientSet(c *federation_v1alpha1.Cluster) (*ClusterClient, error) {
var serverAddress string
hostIP, err := utilnet.ChooseHostInterface()
if err != nil {
return nil, err
}
for _, item := range c.Spec.ServerAddressByClientCIDRs {
_, cidrnet, err := net.ParseCIDR(item.ClientCIDR)
if err != nil {
return nil, err
}
myaddr := net.ParseIP(hostIP.String())
if cidrnet.Contains(myaddr) == true {
serverAddress = item.ServerAddress
break
}
}
var clusterClientSet = ClusterClient{}
if serverAddress != "" {
clusterConfig, err := clientcmd.BuildConfigFromFlags(serverAddress, "")
if err != nil {
return nil, err
}
clusterConfig.QPS = KubeAPIQPS
clusterConfig.Burst = KubeAPIBurst
clusterClientSet.discoveryClient = discovery.NewDiscoveryClientForConfigOrDie((restclient.AddUserAgent(clusterConfig, UserAgentName)))
if clusterClientSet.discoveryClient == nil {
return nil, nil
}
}
return &clusterClientSet, err
}
示例2: NewForConfigOrDie
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var cs Clientset
cs.TestgroupClient = internalversiontestgroup.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
}
示例3: NewForConfigOrDie
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset
clientset.FederationClient = unversionedfederation.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset
}
示例4: NewForConfigOrDie
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var cs Clientset
cs.ApiregistrationClient = internalversionapiregistration.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
}
示例5: NewForConfigOrDie
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset
clientset.CoreClient = unversionedcore.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset
}
示例6: NewForConfigOrDie
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset
clientset.CoreClient = v1core.NewForConfigOrDie(c)
clientset.ExtensionsClient = v1beta1extensions.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset
}
示例7: NewForConfigOrDie
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset
clientset.FederationClient = v1beta1federation.NewForConfigOrDie(c)
clientset.CoreClient = v1core.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset
}
示例8: NewForConfigOrDie
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset
clientset.CoreClient = internalversioncore.NewForConfigOrDie(c)
clientset.ExtensionsClient = internalversionextensions.NewForConfigOrDie(c)
clientset.FederationClient = internalversionfederation.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset
}
示例9: NewForConfigOrDie
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset
clientset.CoreClient = unversionedcore.NewForConfigOrDie(c)
clientset.ExtensionsClient = unversionedextensions.NewForConfigOrDie(c)
clientset.BatchClient = unversionedbatch.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset
}
示例10: NewForConfigOrDie
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var cs Clientset
cs.CoreClient = internalversioncore.NewForConfigOrDie(c)
cs.BatchClient = internalversionbatch.NewForConfigOrDie(c)
cs.ExtensionsClient = internalversionextensions.NewForConfigOrDie(c)
cs.FederationClient = internalversionfederation.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
}
示例11: NewForConfigOrDie
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset
clientset.CoreClient = unversionedcore.NewForConfigOrDie(c)
clientset.ExtensionsClient = unversionedextensions.NewForConfigOrDie(c)
clientset.AutoscalingClient = unversionedautoscaling.NewForConfigOrDie(c)
clientset.BatchClient = unversionedbatch.NewForConfigOrDie(c)
clientset.RbacClient = unversionedrbac.NewForConfigOrDie(c)
clientset.CertificatesClient = unversionedcertificates.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset
}
示例12: NewForConfigOrDie
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var clientset Clientset
clientset.CoreClient = v1core.NewForConfigOrDie(c)
clientset.AppsClient = v1alpha1apps.NewForConfigOrDie(c)
clientset.AuthenticationClient = v1beta1authentication.NewForConfigOrDie(c)
clientset.AuthorizationClient = v1beta1authorization.NewForConfigOrDie(c)
clientset.AutoscalingClient = v1autoscaling.NewForConfigOrDie(c)
clientset.BatchClient = v1batch.NewForConfigOrDie(c)
clientset.CertificatesClient = v1alpha1certificates.NewForConfigOrDie(c)
clientset.ExtensionsClient = v1beta1extensions.NewForConfigOrDie(c)
clientset.PolicyClient = v1alpha1policy.NewForConfigOrDie(c)
clientset.RbacClient = v1alpha1rbac.NewForConfigOrDie(c)
clientset.StorageClient = v1beta1storage.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset
}
示例13: NewForConfigOrDie
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *Clientset {
var cs Clientset
cs.CoreClient = internalversioncore.NewForConfigOrDie(c)
cs.AppsClient = internalversionapps.NewForConfigOrDie(c)
cs.AuthenticationClient = internalversionauthentication.NewForConfigOrDie(c)
cs.AuthorizationClient = internalversionauthorization.NewForConfigOrDie(c)
cs.AutoscalingClient = internalversionautoscaling.NewForConfigOrDie(c)
cs.BatchClient = internalversionbatch.NewForConfigOrDie(c)
cs.CertificatesClient = internalversioncertificates.NewForConfigOrDie(c)
cs.ExtensionsClient = internalversionextensions.NewForConfigOrDie(c)
cs.PolicyClient = internalversionpolicy.NewForConfigOrDie(c)
cs.RbacClient = internalversionrbac.NewForConfigOrDie(c)
cs.StorageClient = internalversionstorage.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
}
示例14: NewClusterClientSet
func NewClusterClientSet(c *federation_v1beta1.Cluster) (*ClusterClient, error) {
clusterConfig, err := util.BuildClusterConfig(c)
if err != nil {
return nil, err
}
var clusterClientSet = ClusterClient{}
if clusterConfig != nil {
clusterClientSet.discoveryClient = discovery.NewDiscoveryClientForConfigOrDie((restclient.AddUserAgent(clusterConfig, UserAgentName)))
if clusterClientSet.discoveryClient == nil {
return nil, nil
}
clusterClientSet.kubeClient = clientset.NewForConfigOrDie((restclient.AddUserAgent(clusterConfig, UserAgentName)))
if clusterClientSet.kubeClient == nil {
return nil, nil
}
}
return &clusterClientSet, nil
}
示例15: StartControllers
func StartControllers(s *options.CMServer, restClientCfg *restclient.Config) error {
glog.Infof("Loading client config for cluster controller %q", "cluster-controller")
ccClientset := federationclientset.NewForConfigOrDie(restclient.AddUserAgent(restClientCfg, "cluster-controller"))
glog.Infof("Running cluster controller")
go clustercontroller.NewclusterController(ccClientset, s.ClusterMonitorPeriod.Duration).Run()
dns, err := dnsprovider.InitDnsProvider(s.DnsProvider, s.DnsConfigFile)
if err != nil {
glog.Fatalf("Cloud provider could not be initialized: %v", err)
}
discoveryClient := discovery.NewDiscoveryClientForConfigOrDie(restClientCfg)
serverResources, err := discoveryClient.ServerResources()
if err != nil {
glog.Fatalf("Could not find resources from API Server: %v", err)
}
glog.Infof("Loading client config for namespace controller %q", "namespace-controller")
nsClientset := federationclientset.NewForConfigOrDie(restclient.AddUserAgent(restClientCfg, "namespace-controller"))
namespaceController := namespacecontroller.NewNamespaceController(nsClientset)
glog.Infof("Running namespace controller")
namespaceController.Run(wait.NeverStop)
secretcontrollerClientset := federationclientset.NewForConfigOrDie(restclient.AddUserAgent(restClientCfg, "secret-controller"))
secretcontroller := secretcontroller.NewSecretController(secretcontrollerClientset)
secretcontroller.Run(wait.NeverStop)
configmapcontrollerClientset := federationclientset.NewForConfigOrDie(restclient.AddUserAgent(restClientCfg, "configmap-controller"))
configmapcontroller := configmapcontroller.NewConfigMapController(configmapcontrollerClientset)
configmapcontroller.Run(wait.NeverStop)
daemonsetcontrollerClientset := federationclientset.NewForConfigOrDie(restclient.AddUserAgent(restClientCfg, "daemonset-controller"))
daemonsetcontroller := daemonset.NewDaemonSetController(daemonsetcontrollerClientset)
daemonsetcontroller.Run(wait.NeverStop)
replicaSetClientset := federationclientset.NewForConfigOrDie(restclient.AddUserAgent(restClientCfg, replicasetcontroller.UserAgentName))
replicaSetController := replicasetcontroller.NewReplicaSetController(replicaSetClientset)
go replicaSetController.Run(s.ConcurrentReplicaSetSyncs, wait.NeverStop)
deploymentClientset := federationclientset.NewForConfigOrDie(restclient.AddUserAgent(restClientCfg, deploymentcontroller.UserAgentName))
deploymentController := deploymentcontroller.NewDeploymentController(deploymentClientset)
// TODO: rename s.ConcurentReplicaSetSyncs
go deploymentController.Run(s.ConcurrentReplicaSetSyncs, wait.NeverStop)
if controllerEnabled(s.Controllers, serverResources, ingresscontroller.ControllerName, ingresscontroller.RequiredResources, true) {
glog.Infof("Loading client config for ingress controller %q", "ingress-controller")
ingClientset := federationclientset.NewForConfigOrDie(restclient.AddUserAgent(restClientCfg, "ingress-controller"))
ingressController := ingresscontroller.NewIngressController(ingClientset)
glog.Infof("Running ingress controller")
ingressController.Run(wait.NeverStop)
}
glog.Infof("Loading client config for service controller %q", servicecontroller.UserAgentName)
scClientset := federationclientset.NewForConfigOrDie(restclient.AddUserAgent(restClientCfg, servicecontroller.UserAgentName))
servicecontroller := servicecontroller.New(scClientset, dns, s.FederationName, s.ServiceDnsSuffix, s.ZoneName, s.ZoneID)
glog.Infof("Running service controller")
if err := servicecontroller.Run(s.ConcurrentServiceSyncs, wait.NeverStop); err != nil {
glog.Errorf("Failed to start service controller: %v", err)
}
select {}
}