本文整理匯總了Golang中k8s/io/kubernetes/pkg/genericapiserver.StorageFactory.New方法的典型用法代碼示例。如果您正苦於以下問題:Golang StorageFactory.New方法的具體用法?Golang StorageFactory.New怎麽用?Golang StorageFactory.New使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/kubernetes/pkg/genericapiserver.StorageFactory
的用法示例。
在下文中一共展示了StorageFactory.New方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: 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)
}
}
示例2: createRESTOptionsOrDie
func createRESTOptionsOrDie(s *genericoptions.ServerRunOptions, g *genericapiserver.GenericAPIServer, f genericapiserver.StorageFactory, resource unversioned.GroupResource) generic.RESTOptions {
storage, err := f.New(resource)
if err != nil {
glog.Fatalf("Unable to find storage destination for %v, due to %v", resource, err.Error())
}
return generic.RESTOptions{
Storage: storage,
Decorator: g.StorageDecorator(),
DeleteCollectionWorkers: s.DeleteCollectionWorkers,
}
}