client

package
v0.0.0-...-bd27db3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 34 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListAllNamespaces

func ListAllNamespaces(ctx context.Context, client Client) ([]*v1.Namespace, error)

func ListAllOfSpecifiedType

func ListAllOfSpecifiedType(resourceType schema.GroupVersionResource, ctx context.Context, client Client) ([]*uns.Unstructured, error)

for use with dynamic client

Types

type Client

type Client interface {
	// Clients returns all known cluster clietns.
	Clients() map[string]ClusterClient

	// ClientFor returns the ClusterClient for a given named cluster.
	ClientFor(name string) ClusterClient

	// Default returns the "default" cluster's Client. This is probably what you want.
	Default() ClusterClient

	// Start may start all informers for all clients, if applicable.
	Start(context.Context) error
}

Client holds all apiserver connections.

type ClusterClient

type ClusterClient interface {
	// Kuberetes returns the typed Kubernetes client
	Kubernetes() kubernetes.Interface

	// OpenshiftOperatorClient returns the clientset for operator.openshift.io
	OpenshiftOperatorClient() *osoperclient.Clientset

	// Config returns the clients rest config
	Config() *rest.Config

	// Dynamic returns an untyped, dynamic client.
	Dynamic() dynamic.Interface

	// CRClient returns the controller-runtime client, another untyped client
	CRClient() crclient.Client

	// RESTMapper returns this cluster's RESTMapper, a mapping from type to api resource
	RESTMapper() meta.RESTMapper

	Scheme() *runtime.Scheme

	// OpenshiftOperatorClient returns the clientset for operator.openshift.io
	OperatorHelperClient() operatorv1helpers.OperatorClient

	// HostPort returns the host and port, as a string, of this connection
	HostPort() (string, string)

	AddCustomInformer(inf cache.SharedInformer)
}

ClusterClient is the connection to a single cluster / apiserver. It exposes various "clients" to this single apiserver.

type OperatorClient

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

func NewClient

func NewClient(cfg, protocfg *rest.Config, inClusterClientName string, extraClusters map[string]string) (*OperatorClient, error)

func (*OperatorClient) ClientFor

func (c *OperatorClient) ClientFor(name string) ClusterClient

ClientFor returns a ClusterClient reference based on the name provided, if name is empty returns the default ClusterClient

func (*OperatorClient) Clients

func (c *OperatorClient) Clients() map[string]ClusterClient

func (*OperatorClient) Default

func (c *OperatorClient) Default() ClusterClient

func (*OperatorClient) Start

func (c *OperatorClient) Start(ctx context.Context) error

type OperatorClusterClient

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

OperatorClusterClient is a bag of holding for object clients & informers. It is generally responsible for managing informer lifecycle.

int 5, wis 2, dex 10, cha 6

func NewClusterClient

func NewClusterClient(cfg, protocfg *rest.Config) (*OperatorClusterClient, error)

func (*OperatorClusterClient) AddCustomInformer

func (c *OperatorClusterClient) AddCustomInformer(inf cache.SharedInformer)

AddCustomInformer adds any informers not created by the factory to the ClusterClient lifecycle management.

Example for a label-selected ConfigMap watch:

c.AddCustomInformer(

    v1coreinformers.NewFilteredServiceInformer(
         c.Kubernetes(),
			kapi.NamespaceAll,
			5 * time.Minute, // resync Period
			cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc},
			func(options *metav1.ListOptions) {
				// use k8s.io/apimachinery/pkg/labels for more sophisticated selectors
				options.LabelSelector = "operator.example.dev/mylabel=myval"
			}))

func (*OperatorClusterClient) CRClient

func (c *OperatorClusterClient) CRClient() crclient.Client

func (*OperatorClusterClient) Config

func (c *OperatorClusterClient) Config() *rest.Config

func (*OperatorClusterClient) Dynamic

Dynamic returns an untyped, dynamic client.

func (*OperatorClusterClient) HostPort

func (c *OperatorClusterClient) HostPort() (string, string)

URL returns the host and port of the apiserver endpoint for this client

func (*OperatorClusterClient) Kubernetes

func (c *OperatorClusterClient) Kubernetes() kubernetes.Interface

func (*OperatorClusterClient) OpenshiftOperatorClient

func (c *OperatorClusterClient) OpenshiftOperatorClient() *osoperclient.Clientset

OpenshiftOperatorClient returns the clientset for operator.openshift.io

func (*OperatorClusterClient) OperatorHelperClient

func (c *OperatorClusterClient) OperatorHelperClient() operatorv1helpers.OperatorClient

OperatorHelperClient returns an implementation of the v1helpers.OperatorClient interface for use by the library-go controllers.

func (*OperatorClusterClient) RESTMapper

func (c *OperatorClusterClient) RESTMapper() meta.RESTMapper

func (*OperatorClusterClient) Scheme

func (c *OperatorClusterClient) Scheme() *runtime.Scheme

func (*OperatorClusterClient) Start

type OperatorHelperClient

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

OperatorHelperClient is used by the generic library-go operator controllers; it provides accessors to the operator state.

func (*OperatorHelperClient) GetObjectMeta

func (c *OperatorHelperClient) GetObjectMeta() (*metav1.ObjectMeta, error)

func (*OperatorHelperClient) GetOperatorState

func (*OperatorHelperClient) Informer

func (*OperatorHelperClient) UpdateOperatorSpec

func (c *OperatorHelperClient) UpdateOperatorSpec(ctx context.Context, resourceVersion string, spec *operatorv1.OperatorSpec) (*operatorv1.OperatorSpec, string, error)

func (*OperatorHelperClient) UpdateOperatorStatus

func (c *OperatorHelperClient) UpdateOperatorStatus(ctx context.Context, resourceVersion string, status *operatorv1.OperatorStatus) (*operatorv1.OperatorStatus, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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