Documentation ¶
Index ¶
- Variables
- func CheckMultiInstances(r client.Reader) (enable bool)
- func CheckSaas(r client.Reader) (enable bool)
- func CheckStorageClass(r client.Reader) error
- func CompareObj(newObj *unstructured.Unstructured, existingObj *unstructured.Unstructured) (needUpdate bool)
- func CompareVersion(v1, v2 string) (v1IsLarger bool, err error)
- func Contains(list []string, s string) bool
- func EncodeBase64(data []byte) string
- func EnsureLabels(resource *unstructured.Unstructured, labels map[string]string)
- func EnsureLabelsForConfigMap(cm *corev1.ConfigMap, labels map[string]string)
- func EnsureLabelsForCsCR(cs *apiv3.CommonService, labels map[string]string)
- func FieldIndexName(field string) string
- func GetApprovalModeinNs(r client.Reader, ns string) (approvalMode string, err error)
- func GetCPFSNamespace(r client.Reader) (cpfsNamespace string)
- func GetCatalogSource(packageName, ns string, r client.Reader) (CatalogSourceName, CatalogSourceNS string)
- func GetCmOfMapCs(r client.Reader) (*corev1.ConfigMap, error)
- func GetCmOfNss(r client.Reader, operatorNs string) (*corev1.ConfigMap, error)
- func GetControlNs(r client.Reader) (controlNs string)
- func GetCsScope(cm *corev1.ConfigMap, cpfsNamespace string) ([]string, error)
- func GetEnableOpreqWebhook() bool
- func GetFirstNCharacter(str string, n int) string
- func GetImage(imageName string) string
- func GetNSSCMSynchronization() bool
- func GetNssCmNs(r client.Reader, cpfsNamespace string) ([]string, error)
- func GetOperatorName() (string, error)
- func GetOperatorNamespace() (string, error)
- func GetPackageNameByServiceName(opreg *odlm.OperandRegistry, operatorName string) string
- func GetRequestNs(r client.Reader) (requestNs []string)
- func GetResourcesDynamically(ctx context.Context, dynamic dynamic.Interface, group string, version string, ...) ([]unstructured.Unstructured, error)
- func GetServicesNamespace(r client.Reader) (servicesNamespace string)
- func GetWatchNamespace() string
- func KeyToNamespacedKey(ns string, baseKey string) string
- func Namespacelize(resource, placeholder, ns string) string
- func NewCSCache(clusterGVKList []schema.GroupVersionKind, ...) cache.NewCacheFunc
- func NewUnstructured(group, kind, version string) *unstructured.Unstructured
- func NewUnstructuredList(group, kind, version string) *unstructured.UnstructuredList
- func ObjectListToNewUnstructuredList(objs interface{}) (*unstructured.UnstructuredList, error)
- func ReadFile(path string) ([]byte, error)
- func ReplaceImages(resource string) (result string)
- func Reverse(original []string) []string
- func SanitizeData(data interface{}, valueType string, isEmpty bool) interface{}
- func UpdateAllNSList(r client.Reader, c client.Client, cm *corev1.ConfigMap, nssKey, nssNs string) error
- func UpdateCsMaps(cm *corev1.ConfigMap, requestNsList, servicesNS, operatorNs string) error
- func UpdateNSList(r client.Reader, c client.Client, cm *corev1.ConfigMap, ...) error
- func UpdateOpRegUserManaged(opreg *odlm.OperandRegistry, operatorName string, value bool) error
- func ValidateCsMaps(cm *corev1.ConfigMap) error
- func YamlToObject(yamlContent []byte) (*unstructured.Unstructured, error)
- func YamlToObjects(yamlContent []byte) ([]*unstructured.Unstructured, error)
- type CSCache
- func (c CSCache) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error
- func (c CSCache) GetInformer(ctx context.Context, obj client.Object) (cache.Informer, error)
- func (c CSCache) GetInformerForKind(ctx context.Context, gvk schema.GroupVersionKind) (cache.Informer, error)
- func (c CSCache) IndexField(ctx context.Context, obj client.Object, field string, ...) error
- func (c CSCache) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
- func (c CSCache) Start(ctx context.Context) error
- func (c CSCache) WaitForCacheSync(ctx context.Context) bool
- type CsMaps
- type NsMapping
Constants ¶
This section is empty.
Variables ¶
var (
ImageList = []string{"IBM_SECRETSHARE_OPERATOR_IMAGE", "IBM_CS_WEBHOOK_IMAGE"}
)
Functions ¶
func CheckMultiInstances ¶
CheckMultiInstance checks whether it is a MultiInstances including SaaS and on-prem MultiInstances
func CheckStorageClass ¶
CheckStorageClass gets StorageClassList in current cluster, then validates whether StorageClass created
func CompareObj ¶
func CompareObj(newObj *unstructured.Unstructured, existingObj *unstructured.Unstructured) (needUpdate bool)
func CompareVersion ¶
CompareVersion takes vx.y.z, vx.y.z -> bool: if v1 is larger than v2
func EncodeBase64 ¶
EncodeBase64 encodes data to base64 string
func EnsureLabels ¶
func EnsureLabels(resource *unstructured.Unstructured, labels map[string]string)
EnsureLabels ensures that the specifc resource has the certain labels
func EnsureLabelsForConfigMap ¶
EnsureLabelsForConfigMap ensures that the specifc ConfigMap has the certain labels
func EnsureLabelsForCsCR ¶
func EnsureLabelsForCsCR(cs *apiv3.CommonService, labels map[string]string)
EnsureLabelsForConfigMap ensures that the specifc ConfigMap has the certain labels
func FieldIndexName ¶
FieldIndexName constructs the name of the index over the given field, for use with an indexer.
func GetApprovalModeinNs ¶
func GetCPFSNamespace ¶
GetCPFSNamespace returns the namespace where foundational services operator should be running
func GetCatalogSource ¶
func GetCatalogSource(packageName, ns string, r client.Reader) (CatalogSourceName, CatalogSourceNS string)
GetCatalogSource gets CatalogSource will be used by operators
func GetCmOfMapCs ¶
GetCmOfMapCs gets ConfigMap of Common Services Maps
func GetCmOfNss ¶
GetCmOfNss gets ConfigMap of Namespace-scope
func GetControlNs ¶
GetControlNs gets control namespace of deploying cluster scope services
func GetCsScope ¶
GetCsScope fetchs the namespaces from its own requested-from-namespace and map-to-common-service-namespace
func GetEnableOpreqWebhook ¶
func GetEnableOpreqWebhook() bool
GetEnableOpreqWebhook check if enable the webhook for the OperandRequest
func GetFirstNCharacter ¶ added in v4.10.0
func GetNSSCMSynchronization ¶
func GetNSSCMSynchronization() bool
GetNSSCMSynchronization returns whether NSS ConfigMap shchronization with OperatorGroup is enabled
func GetNssCmNs ¶
GetNssCmNs gets namespaces from namespace-scope ConfigMap
func GetOperatorName ¶
GetOperatorName return the operator name
func GetOperatorNamespace ¶
GetOperatorNamespace returns the namespace the operator should be running in.
func GetPackageNameByServiceName ¶
func GetPackageNameByServiceName(opreg *odlm.OperandRegistry, operatorName string) string
func GetRequestNs ¶
GetRequestNs gets requested-from-namespace of map-to-common-service-namespace
func GetResourcesDynamically ¶
func GetResourcesDynamically(ctx context.Context, dynamic dynamic.Interface, group string, version string, resource string) ( []unstructured.Unstructured, error)
func GetServicesNamespace ¶
GetServicesNamespace returns the namespace where foundational services CRs should be running
func GetWatchNamespace ¶
func GetWatchNamespace() string
GetWatchNamespace returns the list of namespaces that the operator watches
func KeyToNamespacedKey ¶
KeyToNamespacedKey prefixes the given index key with a namespace for use in field selector indexes.
func Namespacelize ¶
Namespacelize adds the namespace specified
func NewCSCache ¶
func NewCSCache(clusterGVKList []schema.GroupVersionKind, gvkLabelMap map[schema.GroupVersionKind]filteredcache.Selector, watchNamespaceList []string) cache.NewCacheFunc
NewCSCache implements a customized cache with a for CS
func NewUnstructured ¶
func NewUnstructured(group, kind, version string) *unstructured.Unstructured
NewUnstructured return Unstructured object
func NewUnstructuredList ¶
func NewUnstructuredList(group, kind, version string) *unstructured.UnstructuredList
NewUnstructuredList return UnstructuredList object
func ObjectListToNewUnstructuredList ¶
func ObjectListToNewUnstructuredList(objs interface{}) (*unstructured.UnstructuredList, error)
func ReplaceImages ¶
func SanitizeData ¶
SanitizeData keep the key-value pair in the map if the value fulfill the valueType and requirement
func UpdateAllNSList ¶
func UpdateAllNSList(r client.Reader, c client.Client, cm *corev1.ConfigMap, nssKey, nssNs string) error
UpdateAllNSList updates all adopter and CS namespaces into NSS CR
func UpdateCsMaps ¶
UpdateCsMaps will update namespaceMapping in common-service-maps
func UpdateNSList ¶
func UpdateNSList(r client.Reader, c client.Client, cm *corev1.ConfigMap, nssKey, cpfsNamespace string, addControlNs bool) error
UpdateNSList updates adopter namespaces of Common Services
func UpdateOpRegUserManaged ¶
func UpdateOpRegUserManaged(opreg *odlm.OperandRegistry, operatorName string, value bool) error
func ValidateCsMaps ¶
ValidateCsMaps checks common-service-maps has no scope overlapping
func YamlToObject ¶
func YamlToObject(yamlContent []byte) (*unstructured.Unstructured, error)
YamlToObject converting large yaml file, we can remove it after using "apimachinery" v0.19.0
func YamlToObjects ¶
func YamlToObjects(yamlContent []byte) ([]*unstructured.Unstructured, error)
YamlToObjects convert YAML content to unstructured objects
Types ¶
type CSCache ¶
CSCache is the customized cache for CS
func (CSCache) Get ¶
Get implements Reader If the resource is in the cache, Get function get fetch in from the informer Otherwise, resource will be get by the k8s client
func (CSCache) GetInformer ¶
GetInformer fetches or constructs an informer for the given object that corresponds to a single API kind and resource.
func (CSCache) GetInformerForKind ¶
func (c CSCache) GetInformerForKind(ctx context.Context, gvk schema.GroupVersionKind) (cache.Informer, error)
GetInformerForKind is similar to GetInformer, except that it takes a group-version-kind, instead of the underlying object.
func (CSCache) IndexField ¶
func (c CSCache) IndexField(ctx context.Context, obj client.Object, field string, extractValue client.IndexerFunc) error
IndexField adds an indexer to the underlying cache, using extraction function to get value(s) from the given field. The filtered cache doesn't support the index yet.
func (CSCache) List ¶
func (c CSCache) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
List lists items out of the indexer and writes them to list