Documentation
¶
Index ¶
- Constants
- Variables
- func ClusterHasCSIGroupVersion(dc *discovery.DiscoveryClient) (found bool)
- func ClusterHasCertificateV1Alpha1(dc *discovery.DiscoveryClient) (found bool)
- func ClusterHasOpenShiftConfigGroupVerison(dc *discovery.DiscoveryClient) (found bool)
- func ClusterHasOpenShiftUserGroupVersion(dc *discovery.DiscoveryClient) (found bool)
- func ClusterHasOperandBindInfoAPIResource(dc *discovery.DiscoveryClient) (found bool)
- func ClusterHasOperandRequestAPIResource(dc *discovery.DiscoveryClient) (found bool)
- func ClusterHasRouteGroupVersion(dc *discovery.DiscoveryClient) (found bool)
- func ClusterHasZenExtensionGroupVersion(dc *discovery.DiscoveryClient) (found bool)
- func ContainsString(slice []string, s string) bool
- func GetAuthentication(ctx context.Context, k8sClient client.Client, namespaces ...string) (authCR *operatorv1alpha1.Authentication, err error)
- func GetBindInfoRefreshMap() map[string]string
- func GetCommonLabels() (l map[string]string)
- func GetControllerKind(controlled client.Object) (kind string)
- func GetControllerRefIndex(controlled client.Object) (index int)
- func GetCsConfigAnnotation(namespace string) string
- func GetImageRef(envVar string) string
- func GetObjectKey(o ObjectKeyed) types.NamespacedName
- func GetOperatorNamespace() (string, error)
- func GetServicesNamespace(ctx context.Context, k8sClient client.Client) (namespace string, err error)
- func GetWatchNamespace() (string, error)
- func IsControllerOf(scheme *runtime.Scheme, controller, controlled client.Object) (isController bool)
- func IsCsConfigAnnotationExists(annotations map[string]string) bool
- func IsOperatorNsForced() (string, bool)
- func IsOwnerOf(scheme *runtime.Scheme, owner, owned client.Object) (isOwner bool)
- func IsRunModeLocal() bool
- func MergeMap(in map[string]string, mergeMap map[string]string) map[string]string
- func MergeMaps(dst map[string]string, srcs ...map[string]string) map[string]string
- func NewLazySubreconcilers(fns ...Subreconciler) *subreconcilers
- func NewStrictSubreconcilers(fns ...Subreconciler) *subreconcilers
- func ReduceSubreconcilerResultsAndErrors(results []*ctrl.Result, errs []error) (result *ctrl.Result, err error)
- func RemoveString(slice []string, s string) (result []string)
- func Scrub(b []byte) (n int)
- func ScrubMap(m map[string][]byte) (n int)
- type ByteGenerator
- type ClusterType
- type DeploymentName
- type FallbackClient
- type Finisher
- type GenerateFn
- type Generator
- type Modifier
- type ModifyFn
- type Named
- type Namespaced
- type ObjectKeyed
- type OnFinishedFn
- type OnWriteFn
- type RandomByteGenerator
- type RunModeType
- type Secondary
- type SecondaryReconciler
- type SecondaryReconcilerBuilder
- func (b *SecondaryReconcilerBuilder[T]) Build() (*secondaryReconciler[T], error)
- func (b *SecondaryReconcilerBuilder[T]) MustBuild() *secondaryReconciler[T]
- func (b *SecondaryReconcilerBuilder[T]) WithClient(cl client.Client) *SecondaryReconcilerBuilder[T]
- func (b *SecondaryReconcilerBuilder[T]) WithGenerateFns(fns ...GenerateFn[T]) *SecondaryReconcilerBuilder[T]
- func (b *SecondaryReconcilerBuilder[T]) WithModifyFns(fns ...ModifyFn[T]) *SecondaryReconcilerBuilder[T]
- func (b *SecondaryReconcilerBuilder[T]) WithName(name string) *SecondaryReconcilerBuilder[T]
- func (b *SecondaryReconcilerBuilder[T]) WithNamespace(namespace string) *SecondaryReconcilerBuilder[T]
- func (b *SecondaryReconcilerBuilder[T]) WithOnFinishedFns(fns ...OnFinishedFn[T]) *SecondaryReconcilerBuilder[T]
- func (b *SecondaryReconcilerBuilder[T]) WithOnWriteFns(fns ...OnWriteFn[T]) *SecondaryReconcilerBuilder[T]
- func (b *SecondaryReconcilerBuilder[T]) WithPrimary(primary client.Object) *SecondaryReconcilerBuilder[T]
- type SecondaryReconcilerFn
- type Subreconciler
- type Subreconcilers
- type WriteResponder
Constants ¶
const ( AlphaNum string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" LowerAlphaNum string = "abcdefghijklmnopqrstuvwxyz0123456789" )
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" )
const CommonServiceName string = "common-service"
const DatastoreEDBCMName string = "im-datastore-edb-cm"
Name of ConfigMap that configures external or embedded EDB for IM
const DatastoreEDBCSName string = "im-common-service"
Name of CommonService created by IM Operator to provision EDB share
const DatastoreEDBSecretName string = "im-datastore-edb-secret"
Name of Secret containing certificates for connecting to EDB
const DefaultAdminSecret string = "platform-auth-idp-credentials"
Name of default admin credentials secret created by IM Operator
const DefaultSCIMAdminSecret string = "platform-auth-scim-credentials"
Name of default scim admin credentials secret created by IM Operator
const GlobalConfigMapName string = "ibm-cpp-config"
const IBMCloudClusterInfoCMName string = "ibmcloud-cluster-info"
Name of ConfigMap that configures IBM Cloud cluster information
const IMExtEDBSecretSpc string = "im-external-edb-creds-spc"
Name of SecretProvoderClass created by Paks that contains external edb certs
const IMLdapBindCredSpc string = "im-ldap-bind-creds-spc"
Name of SecretProvoderClass created by Paks that contains ldap bindpassword
const IMLdapBindPwdVolume string = "ldap-bind-cred-vol"
Name of volume that holds ldap bindpassword spc
const ManagerVersionLabel string = "authentication.operator.ibm.com/manager-version"
const MongoOprDeploymentName string = "ibm-mongodb-operator"
Name of the mongodb operator deployment name
const MongoStatefulsetName string = "icp-mongodb"
Name of the mongodb statefulset name
Variables ¶
var CsConfigAnnotationSuffix = "common-service/config"
var CsDefaultNamespace = "ibm-common-services"
var DefaultLowerWait time.Duration = 5 * time.Millisecond
DefaultLowerWait is used in instances where a requeue is needed quickly, regardless of previous requeues
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 ClusterHasCSIGroupVersion ¶
func ClusterHasCSIGroupVersion(dc *discovery.DiscoveryClient) (found bool)
func ClusterHasCertificateV1Alpha1 ¶
func ClusterHasCertificateV1Alpha1(dc *discovery.DiscoveryClient) (found bool)
func ClusterHasOpenShiftConfigGroupVerison ¶
func ClusterHasOpenShiftConfigGroupVerison(dc *discovery.DiscoveryClient) (found bool)
func ClusterHasOpenShiftUserGroupVersion ¶
func ClusterHasOpenShiftUserGroupVersion(dc *discovery.DiscoveryClient) (found bool)
func ClusterHasOperandBindInfoAPIResource ¶
func ClusterHasOperandBindInfoAPIResource(dc *discovery.DiscoveryClient) (found bool)
func ClusterHasOperandRequestAPIResource ¶
func ClusterHasOperandRequestAPIResource(dc *discovery.DiscoveryClient) (found bool)
func ClusterHasRouteGroupVersion ¶
func ClusterHasRouteGroupVersion(dc *discovery.DiscoveryClient) (found bool)
func ClusterHasZenExtensionGroupVersion ¶
func ClusterHasZenExtensionGroupVersion(dc *discovery.DiscoveryClient) (found bool)
func ContainsString ¶
Returns whether the string slice contains the provided string.
func GetAuthentication ¶
func GetAuthentication(ctx context.Context, k8sClient client.Client, namespaces ...string) (authCR *operatorv1alpha1.Authentication, err error)
GetAuthentication finds the Authentication for this install of the Cloud Pak Foundational Services. It does this 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 GetBindInfoRefreshMap ¶
func GetCommonLabels ¶
GetCommonLabels sets Kubernetes' recommended labels for the given object. It returns true if any labels were changed, false otherwise.
func GetControllerKind ¶
func GetControllerRefIndex ¶
func GetCsConfigAnnotation ¶
GetCsConfigAnnotation returns '<namespace>.common-service/config' annotation name for given namespace
func GetImageRef ¶
func GetObjectKey ¶
func GetObjectKey(o ObjectKeyed) types.NamespacedName
GetObjectKey returns a types.NamespacedName from an ObjectKeyed.
func GetOperatorNamespace ¶
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 deriving from the Authentication CR for this IM install. Returns an error when
func GetWatchNamespace ¶
GetWatchNamespace returns the Namespace the operator should be watching for changes
func IsControllerOf ¶
func IsControllerOf(scheme *runtime.Scheme, controller, controlled client.Object) (isController bool)
IsControllerOf determines whether one object is listed as the controller of another object within its OwnerReferences.
func IsCsConfigAnnotationExists ¶
IsCsConfigAnnotationExists checks if '<namespace>.common-service/config' annotation name exists in the given annotations map or not
func IsOperatorNsForced ¶
func IsOwnerOf ¶
IsOwnerOf determines whether one object is listed in another object's OwnerReferences.
func IsRunModeLocal ¶
func IsRunModeLocal() bool
func NewLazySubreconcilers ¶
func NewLazySubreconcilers(fns ...Subreconciler) *subreconcilers
func NewStrictSubreconcilers ¶
func NewStrictSubreconcilers(fns ...Subreconciler) *subreconcilers
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.
func RemoveString ¶
Returns a copy of the provided string slice without the specified string.
Types ¶
type ByteGenerator ¶
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 FallbackClient ¶
FallbackClient implements client.Client, but will specifically read directly from the API server instead of the cache when a cache miss happens on an attempt to GET a particular object. Useful when there is a need to work around the cache's filters.
type Finisher ¶
Finisher is an interface that wraps the OnFinished method.
It takes a context assumed to be scoped to the current reconcile loop, the observed and generated client.Objects, and performs any work that needs to be done at the end of the subreconciler.
Returns an error if something goes wrong.
type GenerateFn ¶
GenerateFn is a type of function used when a SecondaryReconciler supports creation of the secondary resource based upon various factors including settings on the primary resource, cluster observations, or other internal controller logic.
type Generator ¶
Generator is an interface that wraps the Generate method.
It takes a context assumed to be scoped to the current reconcile loop and a client.Object that is the recipient of the new object state. It returns an error if something goes wrong over the course of performing this operation.
type Modifier ¶
Modifier is an interface that wraps the Modify method.
It takes a context assumed to be scoped to the current reconcile loop and two client.Object arguments - the first should be the observed object that represents what is on the cluster currently, and the second is what the reconciler determines should be installed on the cluster instead.
If there are relevant differences between the two objects, the first is updated with the values from the second so that they are now the same in those relevant ways.
Returns an bool representing whether a change was made to the first client.Object as well as an error if something goes wrong over the course of performing this operation.
type ModifyFn ¶
ModifyFn is a type of function used when a SecondaryReconciler supports modification of its secondary resource; this function is assumed to make modifications to the first of the two T arguments based upon the state in the second T argument and/or the behavior contained within the ModifyFn[T] itself.
type Namespaced ¶
type Namespaced interface {
GetNamespace() string
}
type ObjectKeyed ¶
type ObjectKeyed interface { Named Namespaced }
ObjectKeyed is a convenience interface for deriving types.NamespacedNames, which are used as keys for Kubernetes client calls, from objects that already have their name and namespace set on them.
type OnFinishedFn ¶
Finisher is a type of function used when a SecondaryReconciler is about to finish running.
type OnWriteFn ¶
OnWriteFn is a type of function used when a SecondaryReconciler either creates or updates its object on a cluster.
type RandomByteGenerator ¶
type RandomByteGenerator struct{}
func (*RandomByteGenerator) GenerateBytes ¶
func (g *RandomByteGenerator) GenerateBytes(charset string, n int) (b []byte, err error)
type RunModeType ¶
type RunModeType string
const ( LocalRunMode RunModeType = "local" ClusterRunMode RunModeType = "cluster" )
type Secondary ¶
type Secondary interface { GetName() string // returns the name of the implementer GetNamespace() string // returns the namespace of the implementer GetEmptyObject() client.Object // returns an empty client.Object of the same type as the implementer GetPrimary() client.Object // returns the object that is primary to this one GetKind() string // returns the kind of the implementer }
Secondary is used to denote a relationship between a primary object/resource and a secondary one.
type SecondaryReconciler ¶
type SecondaryReconciler interface { Secondary Subreconciler GetClient() client.Client Generator Modifier WriteResponder Finisher }
SecondaryReconciler represents a secondary resource that needs to be created and/or modified alongside its related logic whenever its primary resource is being reconciled.
type SecondaryReconcilerBuilder ¶
type SecondaryReconcilerBuilder[T client.Object] struct { // contains filtered or unexported fields }
func NewSecondaryReconcilerBuilder ¶
func NewSecondaryReconcilerBuilder[T client.Object]() *SecondaryReconcilerBuilder[T]
NewSecondaryReconcilerBuilder creates a new builder for a SecondaryReconciler.
func (*SecondaryReconcilerBuilder[T]) Build ¶
func (b *SecondaryReconcilerBuilder[T]) Build() (*secondaryReconciler[T], error)
Build creates a new SecondaryReconciler using the configurations supplied by other builder functions. Returns an error if no client or GVK is configured on the SecondaryReconciler.
func (*SecondaryReconcilerBuilder[T]) MustBuild ¶
func (b *SecondaryReconcilerBuilder[T]) MustBuild() *secondaryReconciler[T]
MustBuild creates a new SecondaryReconciler using the configurations supplied by other builder functions. Panics if a client or GVK is not configured on the SecondaryReconciler.
func (*SecondaryReconcilerBuilder[T]) WithClient ¶
func (b *SecondaryReconcilerBuilder[T]) WithClient(cl client.Client) *SecondaryReconcilerBuilder[T]
WithClient sets the client to be used for interacting with the cluster while reconciling the secondary object.
func (*SecondaryReconcilerBuilder[T]) WithGenerateFns ¶
func (b *SecondaryReconcilerBuilder[T]) WithGenerateFns(fns ...GenerateFn[T]) *SecondaryReconcilerBuilder[T]
WithGenerateFns defines the SecondaryReconciler's Generate as a single GenerateFn[T] composed of the provided GenerateFn[T] arguments in the order that they appear.
func (*SecondaryReconcilerBuilder[T]) WithModifyFns ¶
func (b *SecondaryReconcilerBuilder[T]) WithModifyFns(fns ...ModifyFn[T]) *SecondaryReconcilerBuilder[T]
WithModifyFns defines the SecondaryReconciler's Modify as a single ModifyFn[T] composed of the provided ModifyFn[T] arguments in the order that they appear.
func (*SecondaryReconcilerBuilder[T]) WithName ¶
func (b *SecondaryReconcilerBuilder[T]) WithName(name string) *SecondaryReconcilerBuilder[T]
WithName sets the name of the secondary object that the SecondaryReconciler is targeting.
func (*SecondaryReconcilerBuilder[T]) WithNamespace ¶
func (b *SecondaryReconcilerBuilder[T]) WithNamespace(namespace string) *SecondaryReconcilerBuilder[T]
WithName sets the namespace of the secondary object that the SecondaryReconciler is targeting.
func (*SecondaryReconcilerBuilder[T]) WithOnFinishedFns ¶
func (b *SecondaryReconcilerBuilder[T]) WithOnFinishedFns(fns ...OnFinishedFn[T]) *SecondaryReconcilerBuilder[T]
WithOnFinishedFns defines the SecondaryReconciler's OnFinished as a single OnFinishedFn[T] composed of the provided OnFinishedFn[T] arguments in the order that they appear.
func (*SecondaryReconcilerBuilder[T]) WithOnWriteFns ¶
func (b *SecondaryReconcilerBuilder[T]) WithOnWriteFns(fns ...OnWriteFn[T]) *SecondaryReconcilerBuilder[T]
WithWriteFns defines the SecondaryReconciler's OnWrite as a single OnWriteFn[T] composed of the provided OnWriteFn[T] arguments in the order that they appear.
func (*SecondaryReconcilerBuilder[T]) WithPrimary ¶
func (b *SecondaryReconcilerBuilder[T]) WithPrimary(primary client.Object) *SecondaryReconcilerBuilder[T]
WithPrimary sets the primary object for the secondary object that the SecondaryReconciler is targeting.
type SecondaryReconcilerFn ¶
type SecondaryReconcilerFn subreconciler.Fn
SecondaryReconcilerFn is an adapter so that subreconciler.Fn's implement Subreconciler.
func NewSecondaryReconcilerFn ¶
func NewSecondaryReconcilerFn(req ctrl.Request, fn subreconciler.FnWithRequest) SecondaryReconcilerFn
NewSecondaryReconcilerFn creates a new SecondaryReconcilerFn from a subreconciler.FnWithRequest.
type Subreconciler ¶
type Subreconciler interface {
Reconcile(context.Context) (result *ctrl.Result, err error) // Reconcile is a subreconciler.Fn
}
Subreconciler represents a unit of what makes up the reconciliation of a given primary resource.
type WriteResponder ¶
WriteResponder is an interface that wraps the OnWrite method.
It takes a context assumed to be scoped to the current reconcile loop and performs any work that needs to be done after a write is performed.
Returns an error if something goes wrong.