client

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Overview

Package client encapsulates all calls to Kubernetes/OpenShift API into meaningful functions

Index

Constants

View Source
const (
	// OpenShiftGroupName name included in OpenShift APIs
	OpenShiftGroupName = "openshift.io"
)

Variables

This section is empty.

Functions

func GetKubeConfigFile

func GetKubeConfigFile() string

GetKubeConfigFile gets the .kubeconfig file. Never returns an empty string, fallback to default path if not present in the known locations

Types

type Builder

type Builder interface {
	// UseConfig sets the restconfig to use for the different CLIs
	UseConfig(kubeconfig *restclient.Config) Builder
	// UseControllerClient sets a specific controllerclient
	UseControllerClient(controllerClient client.Client) Builder
	// UseControllerDynamicMapper will set a dynamic mapper to the constructed controller client. Cannot be used with `UseControllerClient`
	UseControllerDynamicMapper() Builder
	// WithDiscoveryClient tells the builder to create the discovery client
	WithDiscoveryClient() Builder
	// WithBuildClient tells the builder to create the build client
	WithBuildClient() Builder
	// WithImageClient tells the builder to create the image client
	WithImageClient() Builder
	// WithDeploymentClient tells the builder to create the deployment client
	WithDeploymentClient() Builder
	// WithKubernetesClient tells the builder to create the kubernetes extension client
	WithKubernetesExtensionClient() Builder
	// WithAllClients is a shortcut to tell the builder to create all clients
	WithAllClients() Builder
	// Build build the final client structure
	Build() (*Client, error)
}

Builder wraps information about what to create for a client before building it

func NewClientBuilder

func NewClientBuilder(scheme *runtime.Scheme) Builder

NewClientBuilder creates a builder to setup the client

type Client

type Client struct {
	// ControlCli is a reference for the controller-runtime client, normally built by a Manager inside the controller context.
	ControlCli             client.Client
	BuildCli               buildv1.BuildV1Interface
	ImageCli               imagev1.ImageV1Interface
	Discovery              discovery.DiscoveryInterface
	DeploymentCli          appsv1.AppsV1Interface
	KubernetesExtensionCli kubernetes.Interface
}

Client wraps clients functions from controller-runtime, Kube and OpenShift cli for generic API calls to the cluster

func NewForConsole

func NewForConsole(scheme *runtime.Scheme) *Client

NewForConsole will create a brand new client using the local machine

func NewForController

func NewForController(manager controllerruntime.Manager) *Client

NewForController creates a new client based on the rest config and the controller client created by Operator SDK Panic if something goes wrong

func (*Client) HasServerGroup

func (c *Client) HasServerGroup(groupName string) bool

HasServerGroup detects if the given api group is supported by the server

func (*Client) IsOpenshift

func (c *Client) IsOpenshift() bool

IsOpenshift detects if the application is running on OpenShift or not

Directories

Path Synopsis
Package kubernetes encapsulates all calls to the Kubernetes API into meaningful functions for use by the CLI and controllers
Package kubernetes encapsulates all calls to the Kubernetes API into meaningful functions for use by the CLI and controllers
Package openshift encapsulates all calls to the OpenShift API (only yo specific OpenShift objects) into meaningful functions for use by the CLI and controllers
Package openshift encapsulates all calls to the OpenShift API (only yo specific OpenShift objects) into meaningful functions for use by the CLI and controllers

Jump to

Keyboard shortcuts

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