Documentation ¶
Index ¶
- Constants
- Variables
- func CreateRecorder(kubeClient kubernetes.Interface, componentName string) (record.EventRecorder, error)
- func GetAllNamespaces(client kubernetes.Interface, labelSelector metav1.LabelSelector) ([]string, error)
- func GetOperatorName() (string, error)
- func GetOperatorNamespace() (string, error)
- func GetOperatorNamespacedName() (types.NamespacedName, error)
- func GetSelectedNamespaces(client kubernetes.Interface, selector policyv1.Target) ([]string, error)
- func GetWatchNamespace() (string, error)
- func Matches(namespaces []string, includeList []policyv1.NonEmptyString, ...) ([]string, error)
- type RunModeType
Constants ¶
const ( ForceRunModeEnv = "OSDK_FORCE_RUN_MODE" 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" )
const UninstallingAnnotation string = "policy.open-cluster-management.io/uninstalling"
Variables ¶
var ErrNoNamespace = fmt.Errorf("namespace not found for current environment")
ErrNoNamespace indicates that a namespace could not be found for the current environment
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)
Functions ¶
func CreateRecorder ¶
func CreateRecorder(kubeClient kubernetes.Interface, componentName string) (record.EventRecorder, error)
CreateRecorder return recorder
func GetAllNamespaces ¶
func GetAllNamespaces(client kubernetes.Interface, labelSelector metav1.LabelSelector) ([]string, error)
GetAllNamespaces gets the list of all namespaces from k8s that matches the input label selector.
func GetOperatorName ¶ added in v0.10.0
GetOperatorName returns the operator name
func GetOperatorNamespace ¶
GetOperatorNamespace returns the namespace the operator should be running in.
func GetOperatorNamespacedName ¶ added in v0.10.0
func GetOperatorNamespacedName() (types.NamespacedName, error)
GetOperatorNamespacedName returns the name and namespace of the operator.
func GetSelectedNamespaces ¶
GetSelectedNamespaces returns the list of filtered namespaces according to the policy namespace selector.
func GetWatchNamespace ¶
GetWatchNamespace returns the Namespace the operator should be watching for changes
func Matches ¶ added in v0.8.0
func Matches( namespaces []string, includeList []policyv1.NonEmptyString, excludeList []policyv1.NonEmptyString, ) ([]string, error)
Matches filters a slice of strings, and returns ones that match the selector
Types ¶
type RunModeType ¶
type RunModeType string