common

package
v0.0.0-...-3cbe5de Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ForceRunModeEnv indicates if the operator should be forced to run in either local
	// or cluster mode (currently only used for local mode)
	ForceRunModeEnv string = "OSDK_FORCE_RUN_MODE"
	// ForceOperatorNsEnv provides an override value to indicate which namespace the Operator is running in; this is
	// largely meant for testing purposes (e.g. with envtest)
	ForceOperatorNsEnv string = "FORCE_OPERATOR_NS"
)
View Source
const CommonServiceName string = "common-service"
View Source
const DatastoreEDBCMName string = "im-datastore-edb-cm"

Name of ConfigMap that configures external or embedded EDB for IM

View Source
const DatastoreEDBCSName string = "im-common-service"

Name of CommonService created by IM Operator to provision EDB share

View Source
const DatastoreEDBSecretName string = "im-datastore-edb-secret"

Name of Secret containing certificates for connecting to EDB

View Source
const GlobalConfigMapName string = "ibm-cpp-config"
View Source
const MongoOprDeploymentName string = "ibm-mongodb-operator"

Name of the mongodb operator deployment name

View Source
const MongoStatefulsetName string = "icp-mongodb"

Name of the mongodb statefulset name

Variables

View Source
var CsConfigAnnotationSuffix = "common-service/config"
View Source
var CsDefaultNamespace = "ibm-common-services"
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)

Functions

func ClusterHasOpenShiftConfigGroupVerison

func ClusterHasOpenShiftConfigGroupVerison(dc *discovery.DiscoveryClient) (found bool)

func ClusterHasRouteGroupVersion

func ClusterHasRouteGroupVersion(dc *discovery.DiscoveryClient) (found bool)

func ClusterHasZenExtensionGroupVersion

func ClusterHasZenExtensionGroupVersion(dc *discovery.DiscoveryClient) (found bool)

func GenerateRandomString

func GenerateRandomString(rule string) string

GenerateRandomString generates a random string based upon a string that is a valid regex pattern.

func GetControllerKind

func GetControllerKind(controlled client.Object) (kind string)

func GetControllerRefIndex

func GetControllerRefIndex(controlled client.Object) (index int)

func GetCsConfigAnnotation

func GetCsConfigAnnotation(namespace string) string

GetCsConfigAnnotation returns '<namespace>.common-service/config' annotation name for given namespace

func GetImageRef

func GetImageRef(envVar string) string

func GetOperatorNamespace

func GetOperatorNamespace() (string, error)

GetOperatorNamespace returns the namespace the Operator should be running in.

func GetServicesNamespace

func GetServicesNamespace(ctx context.Context, k8sClient *client.Client) (namespace string, err error)

GetServicesNamespace finds the namespace that contains the shared services by listing all Authentications in all namespaces where the Operator has visibility. There should only ever be one Authentication CR for a given IM Operator instance, so wherever that one Authentication CR is found is assumed to be where the other Operands are. If no or more than one Authentication CR is found, an error is reported as this is an unsupported usage of the CR.

func GetWatchNamespace

func GetWatchNamespace() (string, error)

GetWatchNamespace returns the Namespace the operator should be watching for changes

func IsControllerOf

func IsControllerOf(controller, controlled client.Object) (isController bool)

IsControllerOf determines whether one object is listed as the controller of another object within its OwnerReferences.

func IsCsConfigAnnotationExists

func IsCsConfigAnnotationExists(annotations map[string]string) bool

IsCsConfigAnnotationExists checks if '<namespace>.common-service/config' annotation name exists in the given annotations map or not

func IsOwnerOf

func IsOwnerOf(owner, owned client.Object) (isOwner bool)

IsOwnerOf determines whether one object is listed in another object's OwnerReferences.

func MergeMap

func MergeMap(in map[string]string, mergeMap map[string]string) map[string]string

func ReduceSubreconcilerResultsAndErrors

func ReduceSubreconcilerResultsAndErrors(results []*ctrl.Result, errs []error) (result *ctrl.Result, err error)

ReduceSubreconcilerResultsAndErrors takes a slice of Result pointers and a slice of errors and reduces them to a single Result pointer and error to be used in a subreconciler.Evaluate call.

Types

type ClusterType

type ClusterType int64
const (
	Unknown ClusterType = iota
	OpenShift
	CNCF
)

func GetClusterType

func GetClusterType(ctx context.Context, k8sClient *client.Client, cmName string) (clusterType ClusterType, err error)

GetClusterType attempts to determine whether the Operator is running on Openshift versus a CNCF cluster. Exits in the event that the cluster config can't be obtained to make queries or if the watch namespace can't be obtained.

func (ClusterType) String

func (ct ClusterType) String() string

type DeploymentName

type DeploymentName string
const (
	PlatformIdentityProvider   DeploymentName = "platform-identity-provider"
	PlatformIdentityManagement DeploymentName = "platform-identity-management"
	PlatformAuthService        DeploymentName = "platform-auth-service"
)

The current names of Deployments managed by this Operator

type RunModeType

type RunModeType string
const (
	LocalRunMode   RunModeType = "local"
	ClusterRunMode RunModeType = "cluster"
)

Jump to

Keyboard shortcuts

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