util

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	OperatorNamespaceEnv   = "OPERATOR_NAMESPACE"
	OperatorWebhookModeEnv = "WEBHOOK_MODE"
	HcoKvIoVersionName     = "HCO_KV_IO_VERSION"
	KubevirtVersionEnvV    = "KUBEVIRT_VERSION"
	CdiVersionEnvV         = "CDI_VERSION"
	CnaoVersionEnvV        = "NETWORK_ADDONS_VERSION"
	SspVersionEnvV         = "SSP_VERSION"
	NmoVersionEnvV         = "NMO_VERSION"
	HppoVersionEnvV        = "HPPO_VERSION"
	VMImportEnvV           = "VM_IMPORT_VERSION"
	HcoValidatingWebhook   = "validate-hco.kubevirt.io"
	AppLabel               = "app"
	UndefinedNamespace     = ""
	OpenshiftNamespace     = "openshift"
	APIVersionAlpha        = "v1alpha1"
	APIVersionBeta         = "v1beta1"
	CurrentAPIVersion      = APIVersionBeta
	APIVersionGroup        = "hco.kubevirt.io"
	APIVersion             = APIVersionGroup + "/" + APIVersionBeta
	// HyperConvergedName is the name of the HyperConverged resource that will be reconciled
	HyperConvergedName = "kubevirt-hyperconverged"
)

HCO common constants

Variables

This section is empty.

Functions

func ComponentResourceRemoval added in v1.2.0

func ComponentResourceRemoval(ctx context.Context, c client.Client, obj interface{}, hcoName string, logger logr.Logger, dryRun bool) error

ComponentResourceRemoval removes the resource `obj` if it exists and belongs to the HCO

func EnsureCreated added in v1.2.0

func EnsureCreated(ctx context.Context, c client.Client, obj runtime.Object, logger logr.Logger) error

EnsureCreated creates the runtime object if it does not exist

func EnsureDeleted added in v1.2.0

func EnsureDeleted(ctx context.Context, c client.Client, obj runtime.Object, hcoName string, logger logr.Logger, dryRun bool) error

EnsureDeleted calls ComponentResourceRemoval if the runtime object exists

func GetCSVfromPod

func GetCSVfromPod(pod *corev1.Pod, c client.Reader, logger logr.Logger) (*csvv1alpha1.ClusterServiceVersion, error)

func GetOperatorNamespaceFromEnv

func GetOperatorNamespaceFromEnv() (string, error)

func GetPod

func GetPod(ctx context.Context, c client.Reader, logger logr.Logger, ci ClusterInfo) (*corev1.Pod, error)

func GetRuntimeObject added in v1.2.0

func GetRuntimeObject(ctx context.Context, c client.Client, obj runtime.Object, logger logr.Logger) error

GetRuntimeObject will query the apiserver for the object

func GetWebhookModeFromEnv added in v1.2.0

func GetWebhookModeFromEnv() (bool, error)

Types

type ClusterInfo added in v1.1.0

type ClusterInfo interface {
	CheckRunningInOpenshift(logger logr.Logger, runningLocally bool) error
	IsOpenshift() bool
	IsRunningLocally() bool
}

func GetClusterInfo added in v1.2.0

func GetClusterInfo() ClusterInfo

type ClusterInfoImp added in v1.1.0

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

func (*ClusterInfoImp) CheckRunningInOpenshift added in v1.1.0

func (c *ClusterInfoImp) CheckRunningInOpenshift(logger logr.Logger, runningLocally bool) error

func (ClusterInfoImp) IsOpenshift added in v1.1.0

func (c ClusterInfoImp) IsOpenshift() bool

func (ClusterInfoImp) IsRunningLocally added in v1.2.0

func (c ClusterInfoImp) IsRunningLocally() bool

type EventEmitter added in v1.2.0

type EventEmitter interface {
	Init(ctx context.Context, mgr manager.Manager, ci ClusterInfo, logger logr.Logger)
	EmitEvent(object runtime.Object, eventType, reason, msg string)
	UpdateClient(ctx context.Context, clnt client.Reader, logger logr.Logger)
}

func GetEventEmitter added in v1.2.0

func GetEventEmitter() EventEmitter

Jump to

Keyboard shortcuts

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