cluster

package
v2.12.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package cluster contains utility functions used to operate on cluster resources.

This includes getting cluster domain, operator namespace and CSV, defining different GVK being used in the project, config metadata on reousrces, managing reousrces like rolebinding, secret and configmap.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyMetaOptions added in v2.10.0

func ApplyMetaOptions(obj metav1.Object, opts ...MetaOptions) error

func CreateNamespace

func CreateNamespace(cli client.Client, namespace string, metaOptions ...MetaOptions) (*corev1.Namespace, error)

CreateNamespace creates a namespace and apply metadata. If a namespace already exists, the operation has no effect on it.

func CreateOrUpdateConfigMap added in v2.10.1

func CreateOrUpdateConfigMap(c client.Client, desiredCfgMap *corev1.ConfigMap, metaOptions ...MetaOptions) error

CreateOrUpdateConfigMap creates a new configmap or updates an existing one. If the configmap already exists, it will be updated with the merged Data and MetaOptions, if any. ConfigMap.ObjectMeta.Name and ConfigMap.ObjectMeta.Namespace are both required, it returns an error otherwise.

func CreateSecret

func CreateSecret(cli client.Client, name, namespace string, metaOptions ...MetaOptions) error

CreateSecret creates secrets required by dashboard component in downstream.

func CreateWithRetry added in v2.12.0

func CreateWithRetry(ctx context.Context, cli client.Client, obj client.Object, timeoutMin int) error

func GetClusterServiceVersion added in v2.10.0

func GetClusterServiceVersion(ctx context.Context, c client.Client, watchNameSpace string) (*ofapi.ClusterServiceVersion, error)

GetClusterServiceVersion retries the clusterserviceversions available in the operator namespace.

func GetDomain added in v2.8.0

func GetDomain(c client.Client) (string, error)

func GetOperatorNamespace added in v2.10.0

func GetOperatorNamespace() (string, error)

func UpdatePodSecurityRolebinding

func UpdatePodSecurityRolebinding(cli client.Client, namespace string, serviceAccountsList ...string) error

UpdatePodSecurityRolebinding update default rolebinding which is created in applications namespace by manifests being used by different components and SRE monitoring.

func WaitForDeploymentAvailable added in v2.12.0

func WaitForDeploymentAvailable(ctx context.Context, c client.Client, componentName string, namespace string, interval int, timeout int) error

WaitForDeploymentAvailable to check if component deployment from 'namespace' is ready within 'timeout' before apply prometheus rules for the component.

Types

type MetaOptions added in v2.7.0

type MetaOptions func(obj metav1.Object) error

MetaOptions allows to add additional settings for the object being created through a chain of functions which are applied on metav1.Object before actual resource creation.

func OwnedBy added in v2.11.0

func OwnedBy(owner metav1.Object, scheme *runtime.Scheme) MetaOptions

func WithLabels added in v2.7.0

func WithLabels(labels ...string) MetaOptions

func WithOwnerReference added in v2.10.0

func WithOwnerReference(ownerReferences ...metav1.OwnerReference) MetaOptions

type Platform added in v2.12.0

type Platform string
const (
	// ManagedRhods defines expected addon catalogsource.
	ManagedRhods Platform = "addon-managed-odh-catalog"
	// SelfManagedRhods defines display name in csv.
	SelfManagedRhods Platform = "Red Hat OpenShift Data Science"
	// OpenDataHub defines display name in csv.
	OpenDataHub Platform = "Open Data Hub Operator"
	// Unknown indicates that operator is not deployed using OLM.
	Unknown Platform = ""
)

func GetPlatform added in v2.12.0

func GetPlatform(cli client.Client) (Platform, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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