kubernetes

package
v0.0.0-...-46ee869 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OperationResultUpdatedStatus means that an existing resource and its status is updated
	OperationResultUpdatedStatus controllerutil.OperationResult = "updatedStatus"
	// OperationResultUpdatedStatusOnly means that only an existing status is updated
	OperationResultUpdatedStatusOnly controllerutil.OperationResult = "updatedStatusOnly"

	EventReasonResourceNotReady = "ResourceNotReady"
)

Variables

This section is empty.

Functions

func AreAllPodsReady

func AreAllPodsReady(podList *corev1.PodList) bool

func ArePodIPsReady

func ArePodIPsReady(pods *corev1.PodList) bool

func CreateOrPatch

CreateOrPatch creates or patches the given object in the Kubernetes cluster. The object's desired state must be reconciled with the before state inside the passed in callback MutateFn.

The MutateFn is called regardless of creating or updating an object.

It returns the executed operation and an error.

Ported from https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/controller/controllerutil/controllerutil.go

func FindKubeConfig

func FindKubeConfig() string

FindKubeConfig returns local Kubernetes configuration

func FindStorageClass

func FindStorageClass(name string, client crclient.Client) (*storagev1.StorageClass, error)

FindStorageClass finds an existed storage class

func GetEnvVarIndex

func GetEnvVarIndex(envVarName string, env *[]corev1.EnvVar) int

func GetOperatorNamespace

func GetOperatorNamespace() (string, error)

func GetOperatorPodOwnerRef

func GetOperatorPodOwnerRef(ns string, client crclient.Client) (*metav1.OwnerReference, error)

func GetPodDefaultImage

func GetPodDefaultImage(container corev1.Container) string

GetPodDefaultImage returns an Infinispan pod's default image. If the default image cannot be found, it returns the running image.

func IsPodReady

func IsPodReady(pod corev1.Pod) bool

func LookupResource

func LookupResource(name, namespace string, resource runtime.Object, client client.Client, logger logr.Logger, eventRec record.EventRecorder) (*reconcile.Result, error)

LookupResource lookup for resource to be created by separate resource controller

func LookupServiceAccountTokenSecret

func LookupServiceAccountTokenSecret(name, namespace string, client client.Client) (*corev1.Secret, error)

func SetConfigDefaults

func SetConfigDefaults(config *rest.Config) *rest.Config

Types

type ExecOptions

type ExecOptions struct {
	Command   []string
	Namespace string
	PodName   string
}

ExecOptions specify execution options

type Kubernetes

type Kubernetes struct {
	Client     client.Client
	RestClient rest.Interface
	RestConfig *rest.Config
}

Kubernetes abstracts interaction with a Kubernetes cluster

func NewKubernetesFromConfig

func NewKubernetesFromConfig(config *rest.Config) (*Kubernetes, error)

NewKubernetesFromConfig creates a new Kubernetes from the Kubernetes master URL to connect to

func NewKubernetesFromController

func NewKubernetesFromController(mgr manager.Manager) *Kubernetes

NewKubernetesFromController creates a new Kubernetes instance from controller runtime Manager

func (Kubernetes) ExecWithOptions

func (k Kubernetes) ExecWithOptions(options ExecOptions) (bytes.Buffer, string, error)

ExecWithOptions executes command on pod command example { "/usr/bin/ls", "folderName" }

func (Kubernetes) GetExternalAddress

func (k Kubernetes) GetExternalAddress(route *corev1.Service) string

GetExternalAddress extract LoadBalancer Hostname (typically for AWS load-balancers) or IP (typically for GCE or OpenStack load-balancers) address

func (Kubernetes) GetKubernetesRESTConfig

func (k Kubernetes) GetKubernetesRESTConfig(masterURL, secretName, namespace string, logger logr.Logger) (*restclient.Config, error)

func (Kubernetes) GetNodeHost

func (k Kubernetes) GetNodeHost(logger logr.Logger) (string, error)

func (Kubernetes) GetOpenShiftRESTConfig

func (k Kubernetes) GetOpenShiftRESTConfig(masterURL, secretName, namespace string, logger logr.Logger) (*restclient.Config, error)

func (Kubernetes) GetSecret

func (k Kubernetes) GetSecret(secretName, namespace string) (*corev1.Secret, error)

GetSecret returns secret associated with given secret name

func (Kubernetes) GetServingCertsMode

func (k Kubernetes) GetServingCertsMode() string

GetServingCertsMode returns a label that identify the kind of serving certs service is available. Returns 'openshift.io' for service-ca on openshift

func (Kubernetes) IsGroupVersionSupported

func (k Kubernetes) IsGroupVersionSupported(groupVersion string, kind string) (bool, error)

func (Kubernetes) Logs

func (k Kubernetes) Logs(pod, namespace string) (logs string, err error)

func (Kubernetes) ResourcesList

func (k Kubernetes) ResourcesList(namespace string, set labels.Set, list runtime.Object) error

ResourcesList returns a typed list of resource associated with the cluster

Jump to

Keyboard shortcuts

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