discovery

package
v0.0.0-...-b25b198 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package discovery is implements discovery interface for plugin discovery Discovery is the interface to fetch the list of available plugins, their supported versions and how to download them either stand-alone or scoped to a server. A separate interface for discovery helps to decouple discovery (which is usually tied to a server or user identity) from distribution (which can be shared).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDiscoveryName

func CheckDiscoveryName(ds configapi.PluginDiscovery, dn string) bool

CheckDiscoveryName returns true if discovery name exists else return false

func CompareDiscoverySource

func CompareDiscoverySource(ds1, ds2 configapi.PluginDiscovery, dsType string) bool

CompareDiscoverySource returns true if both discovery source are same for the given type

func DiscoveredFromK8sV1alpha1

func DiscoveredFromK8sV1alpha1(p *cliv1alpha1.CLIPlugin) (plugin.Discovered, error)

DiscoveredFromK8sV1alpha1 returns discovered plugin object from k8sV1alpha1

func DiscoveredFromK8sV1alpha1WithImageRepositoryOverride

func DiscoveredFromK8sV1alpha1WithImageRepositoryOverride(p *cliv1alpha1.CLIPlugin, imageRepoOverride map[string]string) (plugin.Discovered, error)

DiscoveredFromK8sV1alpha1WithImageRepositoryOverride returns discovered plugin object from k8sV1alpha1

func DiscoveredFromREST

func DiscoveredFromREST(p *Plugin) (plugin.Discovered, error)

DiscoveredFromREST returns discovered plugin object from a REST API.

func SortVersions

func SortVersions(vStrArr []string) error

SortVersions sorts the supported version strings in semver 2.0 order.

func UpdateArtifactsBasedOnImageRepositoryOverride

func UpdateArtifactsBasedOnImageRepositoryOverride(p *cliv1alpha1.CLIPlugin, imageRepoOverride map[string]string)

UpdateArtifactsBasedOnImageRepositoryOverride updates artifacts based on image repository override

Types

type DescribePluginResponse

type DescribePluginResponse struct {
	Plugin Plugin `json:"plugin"`
}

DescribePluginResponse defines the response from Describe Plugin API.

type Discovery

type Discovery interface {
	// Name of the repository.
	Name() string

	// List available plugins.
	List() ([]plugin.Discovered, error)

	// Describe a plugin.
	Describe(name string) (plugin.Discovered, error)

	// Type returns type of discovery.
	Type() string
}

Discovery is the interface to fetch the list of available plugins

func CreateDiscoveryFromV1alpha1

func CreateDiscoveryFromV1alpha1(pd configapi.PluginDiscovery) (Discovery, error)

CreateDiscoveryFromV1alpha1 creates discovery interface from v1alpha1 API

func NewGCPDiscovery

func NewGCPDiscovery(bucket, manifestPath, name string) Discovery

NewGCPDiscovery returns a new GCP bucket repository.

func NewKubernetesDiscovery

func NewKubernetesDiscovery(name, kubeconfigPath, kubecontext string) Discovery

NewKubernetesDiscovery returns a new kubernetes repository

func NewLocalDiscovery

func NewLocalDiscovery(name, localPath string) Discovery

NewLocalDiscovery returns a new local repository. If provided localPath is not an absolute path search under `xdg.ConfigHome/tanzu-plugin/discovery` directory

func NewOCIDiscovery

func NewOCIDiscovery(name, image string) Discovery

NewOCIDiscovery returns a new local repository.

func NewRESTDiscovery

func NewRESTDiscovery(name, endpoint, basePath string) Discovery

NewRESTDiscovery returns a new kubernetes repository

type GCPDiscovery

type GCPDiscovery struct {
	// contains filtered or unexported fields
}

GCPDiscovery is an artifact discovery endpoint utilizing a GCP bucket.

func (*GCPDiscovery) Describe

func (g *GCPDiscovery) Describe(name string) (p plugin.Discovered, err error)

Describe a plugin.

func (*GCPDiscovery) List

func (g *GCPDiscovery) List() (plugins []plugin.Discovered, err error)

List available plugins.

func (*GCPDiscovery) Name

func (g *GCPDiscovery) Name() string

Name of the repository.

func (*GCPDiscovery) Type

func (g *GCPDiscovery) Type() string

Type of the discovery.

type KubernetesDiscovery

type KubernetesDiscovery struct {
	// contains filtered or unexported fields
}

KubernetesDiscovery is an artifact discovery utilizing CLIPlugin API in kubernetes cluster

func (*KubernetesDiscovery) Describe

func (k *KubernetesDiscovery) Describe(name string) (p plugin.Discovered, err error)

Describe a plugin.

func (*KubernetesDiscovery) GetDiscoveredPlugins

func (k *KubernetesDiscovery) GetDiscoveredPlugins(clusterClient cluster.Client) ([]plugin.Discovered, error)

GetDiscoveredPlugins returns the list of discovered plugin from a kubernetes cluster

func (*KubernetesDiscovery) List

func (k *KubernetesDiscovery) List() ([]plugin.Discovered, error)

List available plugins.

func (*KubernetesDiscovery) Manifest

func (k *KubernetesDiscovery) Manifest() ([]plugin.Discovered, error)

Manifest returns the manifest for a kubernetes repository.

func (*KubernetesDiscovery) Name

func (k *KubernetesDiscovery) Name() string

Name of the repository.

func (*KubernetesDiscovery) Type

func (k *KubernetesDiscovery) Type() string

Type of the repository.

type ListPluginsResponse

type ListPluginsResponse struct {
	Plugins []Plugin `json:"plugins"`
}

ListPluginsResponse defines the response from List Plugins API.

type LocalDiscovery

type LocalDiscovery struct {
	// contains filtered or unexported fields
}

LocalDiscovery is an artifact discovery endpoint utilizing a local host os.

func (*LocalDiscovery) Describe

func (l *LocalDiscovery) Describe(name string) (p plugin.Discovered, err error)

Describe a plugin.

func (*LocalDiscovery) List

func (l *LocalDiscovery) List() ([]plugin.Discovered, error)

List available plugins.

func (*LocalDiscovery) Manifest

func (l *LocalDiscovery) Manifest() ([]plugin.Discovered, error)

Manifest returns the manifest for a local repository.

func (*LocalDiscovery) Name

func (l *LocalDiscovery) Name() string

Name of the repository.

func (*LocalDiscovery) Type

func (l *LocalDiscovery) Type() string

Type of the repository.

type OCIDiscovery

type OCIDiscovery struct {
	// contains filtered or unexported fields
}

OCIDiscovery is an artifact discovery endpoint utilizing OCI image

func (*OCIDiscovery) Describe

func (od *OCIDiscovery) Describe(name string) (p plugin.Discovered, err error)

Describe a plugin.

func (*OCIDiscovery) List

func (od *OCIDiscovery) List() (plugins []plugin.Discovered, err error)

List available plugins.

func (*OCIDiscovery) Manifest

func (od *OCIDiscovery) Manifest() ([]plugin.Discovered, error)

Manifest returns the manifest for a local repository.

func (*OCIDiscovery) Name

func (od *OCIDiscovery) Name() string

Name of the repository.

func (*OCIDiscovery) Type

func (od *OCIDiscovery) Type() string

Type of the discovery.

type Plugin

type Plugin struct {
	// Name of the plugin.
	Name string `json:"name"`

	// Description is the plugin's description.
	Description string `json:"description"`

	// Recommended version that Tanzu CLI should use if available.
	// The value should be a valid semantic version as defined in
	// https://semver.org/. E.g., 2.0.1
	RecommendedVersion string `json:"recommendedVersion"`

	// Artifacts contains an artifact list for every supported version.
	Artifacts map[string]cliv1alpha1.ArtifactList `json:"artifacts"`

	// Optional specifies whether the plugin is mandatory or optional
	// If optional, the plugin will not get auto-downloaded as part of
	// `tanzu login` or `tanzu plugin sync` command
	// To view the list of plugin, user can use `tanzu plugin list` and
	// to download a specific plugin run, `tanzu plugin install <plugin-name>`
	Optional bool `json:"optional"`

	// Target the target of the plugin
	Target cliv1alpha1.Target `json:"target"`
}

Plugin contains information about a Tanzu CLI plugin discovered via a REST API.

type RESTDiscovery

type RESTDiscovery struct {
	// contains filtered or unexported fields
}

RESTDiscovery is an artifact discovery utilizing CLIPlugin API in kubernetes cluster

func (*RESTDiscovery) Describe

func (d *RESTDiscovery) Describe(name string) (p plugin.Discovered, err error)

Describe a plugin.

func (*RESTDiscovery) List

func (d *RESTDiscovery) List() ([]plugin.Discovered, error)

List available plugins.

func (*RESTDiscovery) Name

func (d *RESTDiscovery) Name() string

Name of the repository.

func (*RESTDiscovery) Type

func (d *RESTDiscovery) Type() string

Type of the repository.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL