discovery

package
v0.0.0-...-7801012 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KnativeScheme    = "knative"
	KubernetesScheme = "kubernetes"
	OpenshiftScheme  = "openshift"

	// PortQueryParam well known query param to select a particular target port, for example when a service is being
	// discovered and there are many ports to select.
	PortQueryParam = "port"

	// KubernetesDNSAddress use this output format with kubernetes services and pods to resolve to the corresponding
	// kubernetes DNS name. see: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
	KubernetesDNSAddress = "KubernetesDNSAddress"

	// KubernetesIPAddress default format, resolves objects addresses to the corresponding cluster IP address.
	KubernetesIPAddress = "KubernetesIPAddress"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type KnDiscoveryClient

type KnDiscoveryClient struct {
	ServingClient  clientservingv1.ServingV1Interface
	EventingClient clienteventingv1.EventingV1Interface
}

type OpenShiftDiscoveryClient

type OpenShiftDiscoveryClient struct {
	Client      client.Client
	RouteClient routev1.RouteV1Interface
	AppsClient  appsv1.AppsV1Interface
}

type ResourceUri

type ResourceUri struct {
	Scheme      string
	GVK         v1.GroupVersionKind
	Namespace   string
	Name        string
	QueryParams map[string]string
}

func ParseUri

func ParseUri(uri string) (*ResourceUri, error)

func (*ResourceUri) AddQueryParam

func (r *ResourceUri) AddQueryParam(name string, value string)

func (*ResourceUri) GetCustomLabels

func (r *ResourceUri) GetCustomLabels() map[string]string

GetCustomLabels returns all the query parameters that not considered well known query parameters, and thus, has no particular semantic during the discovery. These arbitrary parameters are normally considered as labels, and when present, and the service discovery must give a preference over a set of resources, they can be used to do a filtering. by labels.

func (*ResourceUri) GetPort

func (r *ResourceUri) GetPort() string

func (*ResourceUri) GetQueryParam

func (r *ResourceUri) GetQueryParam(name string) string

func (*ResourceUri) SetPort

func (r *ResourceUri) SetPort(value string)

func (*ResourceUri) String

func (r *ResourceUri) String() string

type ResourceUriBuilder

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

func NewResourceUriBuilder

func NewResourceUriBuilder(scheme string) ResourceUriBuilder

func (ResourceUriBuilder) Build

func (b ResourceUriBuilder) Build() *ResourceUri

func (ResourceUriBuilder) Group

func (ResourceUriBuilder) Kind

func (ResourceUriBuilder) Name

func (ResourceUriBuilder) Namespace

func (b ResourceUriBuilder) Namespace(namespace string) ResourceUriBuilder

func (ResourceUriBuilder) Version

func (b ResourceUriBuilder) Version(version string) ResourceUriBuilder

func (ResourceUriBuilder) WithPort

func (b ResourceUriBuilder) WithPort(customPort string) ResourceUriBuilder

func (ResourceUriBuilder) WithQueryParam

func (b ResourceUriBuilder) WithQueryParam(param string, value string) ResourceUriBuilder

type ServiceCatalog

type ServiceCatalog interface {
	// Query returns the address corresponding to the resource identified by the uri. In the case of services or pods,
	// the outputFormat can be used to determine the type of address to calculate.
	// If the outputFormat is KubernetesDNSAddress, the returned value for a service will be like this: http://my-service.my-namespace.svc:8080,
	// and the returned value for pod will be like this: http://10-244-1-135.my-namespace.pod.cluster.local:8080.
	// If the outputFormat is KubernetesIPAddress, the returned value for pods and services, and other resource types,
	// will be like this: http://10.245.1.132:8080
	Query(ctx context.Context, uri ResourceUri, outputFormat string) (string, error)
}

ServiceCatalog is the entry point to resolve resource addresses given a ResourceUri.

func NewServiceCatalog

func NewServiceCatalog(cli client.Client, knDiscoveryClient *KnDiscoveryClient, openShiftDiscoveryClient *OpenShiftDiscoveryClient) ServiceCatalog

NewServiceCatalog returns a new ServiceCatalog configured to resolve kubernetes, knative, and openshift resource addresses.

func NewServiceCatalogForConfig

func NewServiceCatalogForConfig(cli client.Client, cfg *rest.Config) ServiceCatalog

Jump to

Keyboard shortcuts

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