本文整理汇总了Golang中github.com/openshift/origin/pkg/client.Interface.ImageStreams方法的典型用法代码示例。如果您正苦于以下问题:Golang Interface.ImageStreams方法的具体用法?Golang Interface.ImageStreams怎么用?Golang Interface.ImageStreams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/openshift/origin/pkg/client.Interface
的用法示例。
在下文中一共展示了Interface.ImageStreams方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SetOpenShiftClient
// SetOpenShiftClient sets the passed OpenShift client in the application configuration
func (c *AppConfig) SetOpenShiftClient(osclient client.Interface, OriginNamespace string) {
c.OSClient = osclient
c.OriginNamespace = OriginNamespace
namespaces := []string{OriginNamespace}
if openshiftNamespace := "openshift"; OriginNamespace != openshiftNamespace {
namespaces = append(namespaces, openshiftNamespace)
}
c.ImageStreamSearcher = app.ImageStreamSearcher{
Client: osclient,
ImageStreamImages: osclient,
Namespaces: namespaces,
}
c.ImageStreamByAnnotationSearcher = app.NewImageStreamByAnnotationSearcher(osclient, osclient, namespaces)
c.TemplateSearcher = app.TemplateSearcher{
Client: osclient,
TemplateConfigsNamespacer: osclient,
Namespaces: namespaces,
}
c.TemplateFileSearcher = &app.TemplateFileSearcher{
Typer: c.Typer,
Mapper: c.Mapper,
ClientMapper: c.ClientMapper,
Namespace: OriginNamespace,
}
c.DockerSearcher = app.ImageImportSearcher{
Client: osclient.ImageStreams(OriginNamespace),
AllowInsecure: c.InsecureRegistry,
Fallback: c.DockerImageSearcher(),
}
}
示例2: SetOpenShiftClient
// SetOpenShiftClient sets the passed OpenShift client in the application configuration
func (c *AppConfig) SetOpenShiftClient(osclient client.Interface, originNamespace string) {
c.osclient = osclient
c.originNamespace = originNamespace
namespaces := []string{originNamespace}
if openshiftNamespace := "openshift"; originNamespace != openshiftNamespace {
namespaces = append(namespaces, openshiftNamespace)
}
c.imageStreamSearcher = app.ImageStreamSearcher{
Client: osclient,
ImageStreamImages: osclient,
Namespaces: namespaces,
StopOnMatch: !c.AsSearch,
}
c.imageStreamByAnnotationSearcher = app.NewImageStreamByAnnotationSearcher(osclient, osclient, namespaces)
c.templateSearcher = app.TemplateSearcher{
Client: osclient,
TemplateConfigsNamespacer: osclient,
Namespaces: namespaces,
}
c.templateFileSearcher = &app.TemplateFileSearcher{
Typer: c.typer,
Mapper: c.mapper,
ClientMapper: c.clientMapper,
Namespace: originNamespace,
}
c.dockerSearcher = app.ImageImportSearcher{
Client: osclient.ImageStreams(originNamespace),
AllowInsecure: c.InsecureRegistry,
Fallback: c.dockerImageSearcher(),
}
}
示例3: deleteImageStreams
func deleteImageStreams(client osclient.Interface, ns string) error {
items, err := client.ImageStreams(ns).List(labels.Everything(), fields.Everything())
if err != nil {
return err
}
for i := range items.Items {
err := client.ImageStreams(ns).Delete(items.Items[i].Name)
if err != nil && !errors.IsNotFound(err) {
return err
}
}
return nil
}
示例4: deleteImageStreams
func deleteImageStreams(client osclient.Interface, ns string) error {
items, err := client.ImageStreams(ns).List(kapi.ListOptions{})
if err != nil {
return err
}
for i := range items.Items {
err := client.ImageStreams(ns).Delete(items.Items[i].Name)
if err != nil && !errors.IsNotFound(err) {
return err
}
}
return nil
}
示例5: unloadImageStreamLabel
func unloadImageStreamLabel(client osclient.Interface, application *api.Application, labelSelector labels.Selector) error {
resourceList, _ := client.ImageStreams(application.Namespace).List(kapi.ListOptions{LabelSelector: labelSelector, FieldSelector: fields.Everything()})
errs := []error{}
for _, resource := range resourceList.Items {
if !hasItem(application.Spec.Items, api.Item{Kind: "ImageStream", Name: resource.Name}) {
delete(resource.Labels, fmt.Sprintf("%s.application.%s", application.Namespace, application.Name))
if _, err := client.ImageStreams(application.Namespace).Update(&resource); err != nil {
errs = append(errs, err)
}
}
}
return nil
}
示例6: SetOpenShiftClient
// SetOpenShiftClient sets the passed OpenShift client in the application configuration
func (c *AppConfig) SetOpenShiftClient(osclient client.Interface, OriginNamespace string, dockerclient *docker.Client) {
c.OSClient = osclient
c.OriginNamespace = OriginNamespace
namespaces := []string{OriginNamespace}
if openshiftNamespace := "openshift"; OriginNamespace != openshiftNamespace {
namespaces = append(namespaces, openshiftNamespace)
}
c.ImageStreamSearcher = app.ImageStreamSearcher{
Client: osclient,
ImageStreamImages: osclient,
Namespaces: namespaces,
AllowMissingTags: c.AllowMissingImageStreamTags,
}
c.ImageStreamByAnnotationSearcher = app.NewImageStreamByAnnotationSearcher(osclient, osclient, namespaces)
c.TemplateSearcher = app.TemplateSearcher{
Client: osclient,
TemplateConfigsNamespacer: osclient,
Namespaces: namespaces,
}
c.TemplateFileSearcher = &app.TemplateFileSearcher{
Typer: c.Typer,
Mapper: c.Mapper,
ClientMapper: c.ClientMapper,
Namespace: OriginNamespace,
}
// the hierarchy of docker searching is:
// 1) if we have an openshift client - query docker registries via openshift,
// if we're unable to query via openshift, query the docker registries directly(fallback),
// if we don't find a match there and a local docker daemon exists, look in the local registry.
// 2) if we don't have an openshift client - query the docker registries directly,
// if we don't find a match there and a local docker daemon exists, look in the local registry.
c.DockerSearcher = app.DockerClientSearcher{
Client: dockerclient,
Insecure: c.InsecureRegistry,
AllowMissingImages: c.AllowMissingImages,
RegistrySearcher: app.ImageImportSearcher{
Client: osclient.ImageStreams(OriginNamespace),
AllowInsecure: c.InsecureRegistry,
Fallback: c.DockerRegistrySearcher(),
},
}
}
示例7: NewImageStreamEvaluator
// NewImageStreamEvaluator computes resource usage of ImageStreams. Instantiating this is necessary for
// resource quota admission controller to properly work on image stream related objects.
func NewImageStreamEvaluator(osClient osclient.Interface) kquota.Evaluator {
computeResources := []kapi.ResourceName{
imageapi.ResourceImages,
}
matchesScopeFunc := func(kapi.ResourceQuotaScope, runtime.Object) bool { return true }
getFuncByNamespace := func(namespace, name string) (runtime.Object, error) {
return osClient.ImageStreams(namespace).Get(name)
}
listFuncByNamespace := func(namespace string, options kapi.ListOptions) (runtime.Object, error) {
return osClient.ImageStreams(namespace).List(options)
}
return quotautil.NewSharedContextEvaluator(
imageStreamEvaluatorName,
kapi.Kind("ImageStream"),
nil,
computeResources,
matchesScopeFunc,
getFuncByNamespace,
listFuncByNamespace,
imageStreamConstraintsFunc,
makeImageStreamUsageComputerFactory(osClient))
}
示例8: loadImageStreams
func loadImageStreams(g osgraph.Graph, graphLock sync.Mutex, namespace string, kclient kclient.Interface, client client.Interface) error {
iss, err := client.ImageStreams(namespace).List(labels.Everything(), fields.Everything())
if err != nil {
return err
}
graphLock.Lock()
defer graphLock.Unlock()
for i := range iss.Items {
imagegraph.EnsureImageStreamNode(g, &iss.Items[i])
imagegraph.EnsureAllImageStreamTagNodes(g, &iss.Items[i])
}
return nil
}