本文整理匯總了Golang中k8s/io/kubernetes/pkg/genericapiserver.GenericAPIServer.InstallAPIGroup方法的典型用法代碼示例。如果您正苦於以下問題:Golang GenericAPIServer.InstallAPIGroup方法的具體用法?Golang GenericAPIServer.InstallAPIGroup怎麽用?Golang GenericAPIServer.InstallAPIGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/kubernetes/pkg/genericapiserver.GenericAPIServer
的用法示例。
在下文中一共展示了GenericAPIServer.InstallAPIGroup方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: installExtensionsAPIs
func installExtensionsAPIs(s *options.ServerRunOptions, g *genericapiserver.GenericAPIServer, f genericapiserver.StorageFactory) {
replicaSetStorage := replicasetetcd.NewStorage(createRESTOptionsOrDie(s, g, f, extensions.Resource("replicasets")))
ingressStorage, ingressStatusStorage := ingressetcd.NewREST(createRESTOptionsOrDie(s, g, f, extensions.Resource("ingresses")))
extensionsResources := map[string]rest.Storage{
"replicasets": replicaSetStorage.ReplicaSet,
"replicasets/status": replicaSetStorage.Status,
"replicasets/scale": replicaSetStorage.Scale,
"ingresses": ingressStorage,
"ingresses/status": ingressStatusStorage,
}
extensionsGroupMeta := registered.GroupOrDie(extensions.GroupName)
apiGroupInfo := genericapiserver.APIGroupInfo{
GroupMeta: *extensionsGroupMeta,
VersionedResourcesStorageMap: map[string]map[string]rest.Storage{
"v1beta1": extensionsResources,
},
OptionsExternalVersion: ®istered.GroupOrDie(api.GroupName).GroupVersion,
Scheme: api.Scheme,
ParameterCodec: api.ParameterCodec,
NegotiatedSerializer: api.Codecs,
}
if err := g.InstallAPIGroup(&apiGroupInfo); err != nil {
glog.Fatalf("Error in registering group versions: %v", err)
}
}
示例2: installExtensionsAPIs
func installExtensionsAPIs(g *genericapiserver.GenericAPIServer, optsGetter generic.RESTOptionsGetter) {
replicaSetStorage := replicasetetcd.NewStorage(optsGetter)
deploymentStorage := deploymentetcd.NewStorage(optsGetter)
ingressStorage, ingressStatusStorage := ingressetcd.NewREST(optsGetter)
daemonSetStorage, daemonSetStatusStorage := daemonsetetcd.NewREST(optsGetter)
extensionsResources := map[string]rest.Storage{
"replicasets": replicaSetStorage.ReplicaSet,
"replicasets/status": replicaSetStorage.Status,
"replicasets/scale": replicaSetStorage.Scale,
"ingresses": ingressStorage,
"ingresses/status": ingressStatusStorage,
"daemonsets": daemonSetStorage,
"daemonsets/status": daemonSetStatusStorage,
"deployments": deploymentStorage.Deployment,
"deployments/status": deploymentStorage.Status,
"deployments/scale": deploymentStorage.Scale,
"deployments/rollback": deploymentStorage.Rollback,
}
extensionsGroupMeta := registered.GroupOrDie(extensions.GroupName)
apiGroupInfo := genericapiserver.APIGroupInfo{
GroupMeta: *extensionsGroupMeta,
VersionedResourcesStorageMap: map[string]map[string]rest.Storage{
"v1beta1": extensionsResources,
},
OptionsExternalVersion: ®istered.GroupOrDie(api.GroupName).GroupVersion,
Scheme: api.Scheme,
ParameterCodec: api.ParameterCodec,
NegotiatedSerializer: api.Codecs,
}
if err := g.InstallAPIGroup(&apiGroupInfo); err != nil {
glog.Fatalf("Error in registering group versions: %v", err)
}
}
示例3: installCoreAPIs
func installCoreAPIs(s *genericoptions.ServerRunOptions, g *genericapiserver.GenericAPIServer, f genericapiserver.StorageFactory) {
serviceStore, serviceStatusStore := serviceetcd.NewREST(createRESTOptionsOrDie(s, g, f, api.Resource("service")))
namespaceStore, namespaceStatusStore, _ := namespaceetcd.NewREST(createRESTOptionsOrDie(s, g, f, api.Resource("namespaces")))
secretStore := secretetcd.NewREST(createRESTOptionsOrDie(s, g, f, api.Resource("secrets")))
coreResources := map[string]rest.Storage{
"secrets": secretStore,
"services": serviceStore,
"services/status": serviceStatusStore,
"namespaces": namespaceStore,
"namespaces/status": namespaceStatusStore,
}
coreGroupMeta := registered.GroupOrDie(core.GroupName)
apiGroupInfo := genericapiserver.APIGroupInfo{
GroupMeta: *coreGroupMeta,
VersionedResourcesStorageMap: map[string]map[string]rest.Storage{
v1.SchemeGroupVersion.Version: coreResources,
},
OptionsExternalVersion: ®istered.GroupOrDie(core.GroupName).GroupVersion,
IsLegacyGroup: true,
Scheme: core.Scheme,
ParameterCodec: core.ParameterCodec,
NegotiatedSerializer: core.Codecs,
}
if err := g.InstallAPIGroup(&apiGroupInfo); err != nil {
glog.Fatalf("Error in registering group version: %v", err)
}
}
示例4: installCoreAPIs
func installCoreAPIs(s *options.ServerRunOptions, g *genericapiserver.GenericAPIServer, restOptionsFactory restOptionsFactory) {
serviceStore, serviceStatusStore := serviceetcd.NewREST(restOptionsFactory.NewFor(api.Resource("service")))
namespaceStore, namespaceStatusStore, namespaceFinalizeStore := namespaceetcd.NewREST(restOptionsFactory.NewFor(api.Resource("namespaces")))
secretStore := secretetcd.NewREST(restOptionsFactory.NewFor(api.Resource("secrets")))
eventStore := eventetcd.NewREST(restOptionsFactory.NewFor(api.Resource("events")), uint64(s.EventTTL.Seconds()))
coreResources := map[string]rest.Storage{
"secrets": secretStore,
"services": serviceStore,
"services/status": serviceStatusStore,
"namespaces": namespaceStore,
"namespaces/status": namespaceStatusStore,
"namespaces/finalize": namespaceFinalizeStore,
"events": eventStore,
}
coreGroupMeta := registered.GroupOrDie(core.GroupName)
apiGroupInfo := genericapiserver.APIGroupInfo{
GroupMeta: *coreGroupMeta,
VersionedResourcesStorageMap: map[string]map[string]rest.Storage{
v1.SchemeGroupVersion.Version: coreResources,
},
OptionsExternalVersion: ®istered.GroupOrDie(core.GroupName).GroupVersion,
IsLegacyGroup: true,
Scheme: core.Scheme,
ParameterCodec: core.ParameterCodec,
NegotiatedSerializer: core.Codecs,
}
if err := g.InstallAPIGroup(&apiGroupInfo); err != nil {
glog.Fatalf("Error in registering group version: %+v.\n Error: %v\n", apiGroupInfo, err)
}
}
示例5: installFederationAPIs
func installFederationAPIs(s *options.APIServer, g *genericapiserver.GenericAPIServer, f genericapiserver.StorageFactory) {
storage, err := f.New(federation.Resource("clusters"))
if err != nil {
glog.Fatalf("Unable to find storage destination for %v, due to %v", "clusters", err.Error())
}
clusterStorage, clusterStatusStorage := clusteretcd.NewREST(generic.RESTOptions{
Storage: storage,
Decorator: g.StorageDecorator(),
DeleteCollectionWorkers: s.DeleteCollectionWorkers,
})
federationResources := map[string]rest.Storage{
"clusters": clusterStorage,
"clusters/status": clusterStatusStorage,
}
federationGroupMeta := registered.GroupOrDie(federation.GroupName)
apiGroupInfo := genericapiserver.APIGroupInfo{
GroupMeta: *federationGroupMeta,
VersionedResourcesStorageMap: map[string]map[string]rest.Storage{
"v1alpha1": federationResources,
},
OptionsExternalVersion: ®istered.GroupOrDie(api.GroupName).GroupVersion,
Scheme: api.Scheme,
ParameterCodec: api.ParameterCodec,
NegotiatedSerializer: api.Codecs,
}
if err := g.InstallAPIGroup(&apiGroupInfo); err != nil {
glog.Fatalf("Error in registering group versions: %v", err)
}
}
示例6: installFederationAPIs
func installFederationAPIs(s *genericapiserver.ServerRunOptions, g *genericapiserver.GenericAPIServer, f genericapiserver.StorageFactory) {
clusterStorage, clusterStatusStorage := clusteretcd.NewREST(createRESTOptionsOrDie(s, g, f, federation.Resource("clusters")))
federationResources := map[string]rest.Storage{
"clusters": clusterStorage,
"clusters/status": clusterStatusStorage,
}
federationGroupMeta := registered.GroupOrDie(federation.GroupName)
apiGroupInfo := genericapiserver.APIGroupInfo{
GroupMeta: *federationGroupMeta,
VersionedResourcesStorageMap: map[string]map[string]rest.Storage{
"v1alpha1": federationResources,
},
OptionsExternalVersion: ®istered.GroupOrDie(api.GroupName).GroupVersion,
Scheme: api.Scheme,
ParameterCodec: api.ParameterCodec,
NegotiatedSerializer: api.Codecs,
}
if err := g.InstallAPIGroup(&apiGroupInfo); err != nil {
glog.Fatalf("Error in registering group versions: %v", err)
}
}
示例7: installBatchAPIs
func installBatchAPIs(g *genericapiserver.GenericAPIServer, optsGetter generic.RESTOptionsGetter) {
jobStorage := jobetcd.NewStorage(optsGetter)
batchResources := map[string]rest.Storage{
"jobs": jobStorage.Job,
"jobs/status": jobStorage.Status,
}
batchGroupMeta := registered.GroupOrDie(batch.GroupName)
apiGroupInfo := genericapiserver.APIGroupInfo{
GroupMeta: *batchGroupMeta,
VersionedResourcesStorageMap: map[string]map[string]rest.Storage{
"v1": batchResources,
},
OptionsExternalVersion: ®istered.GroupOrDie(api.GroupName).GroupVersion,
Scheme: api.Scheme,
ParameterCodec: api.ParameterCodec,
NegotiatedSerializer: api.Codecs,
}
if err := g.InstallAPIGroup(&apiGroupInfo); err != nil {
glog.Fatalf("Error in registering group versions: %v", err)
}
}
示例8: installMetricsAPIs
func installMetricsAPIs(s *genericoptions.ServerRunOptions, g *genericapiserver.GenericAPIServer,
metricSink *metricsink.MetricSink, nodeLister *cache.StoreToNodeLister, podLister *cache.StoreToPodLister) {
nodemetricsStorage := nodemetricsstorage.NewStorage(metrics.Resource("nodemetrics"), metricSink, nodeLister)
podmetricsStorage := podmetricsstorage.NewStorage(metrics.Resource("podmetrics"), metricSink, podLister)
heapsterResources := map[string]rest.Storage{
"nodes": nodemetricsStorage,
"pods": podmetricsStorage,
}
heapsterGroupMeta := registered.GroupOrDie(metrics.GroupName)
apiGroupInfo := genericapiserver.APIGroupInfo{
GroupMeta: *heapsterGroupMeta,
VersionedResourcesStorageMap: map[string]map[string]rest.Storage{
"v1alpha1": heapsterResources,
},
OptionsExternalVersion: ®istered.GroupOrDie(api.GroupName).GroupVersion,
Scheme: api.Scheme,
ParameterCodec: api.ParameterCodec,
NegotiatedSerializer: api.Codecs,
}
if err := g.InstallAPIGroup(&apiGroupInfo); err != nil {
glog.Fatalf("Error in registering group versions: %v", err)
}
}