k8sutil

package
v0.0.0-...-9735c57 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LocalRunMode   RunModeType = "local"
	ClusterRunMode RunModeType = "cluster"

	// OperatorNameEnvVar is the constant for env variable OPERATOR_NAME
	// which is the name of the current operator
	OperatorNameEnvVar = "OPERATOR_NAME"

	// WatchNamespaceEnvVar is the constant for env variable WATCH_NAMESPACE
	// which is the namespace where the watch activity happens.
	// this value is empty if the operator is running with clusterScope.
	WatchNamespaceEnvVar = "WATCH_NAMESPACE"
)

Variables

View Source
var ErrNoNamespace = fmt.Errorf("namespace not found for current environment")

ErrNoNamespace indicates that a namespace could not be found for the current environment

View Source
var ErrRunLocal = fmt.Errorf("operator run mode forced to local")

ErrRunLocal indicates that the operator is set to run in local mode (this error is returned by functions that only work on operators running in cluster mode)

View Source
var ForceRunModeEnv = "OSDK_FORCE_RUN_MODE"

ForceRunModeEnv indicates if the operator should be forced to run in either local or cluster mode (currently only used for local mode)

Functions

func GetOperatorName

func GetOperatorName() (string, error)

GetOperatorName return the operator name

func GetOperatorNamespace

func GetOperatorNamespace() (string, error)

GetOperatorNamespace returns the namespace the operator should be running in.

func GetOperatorNamespaceEnv

func GetOperatorNamespaceEnv() (string, error)

GetOperatorNamespace retrieves the operator namespace from the running environment or error if unavailable

func GetWatchNamespace

func GetWatchNamespace() (string, error)

GetWatchNamespace returns the namespace the operator should be watching for changes

Types

type RunModeType

type RunModeType string

Jump to

Keyboard shortcuts

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