Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ OPERATOR_SDK ?= $(shell which operator-sdk)
CONTROLLER_GEN ?= $(shell which controller-gen)
KUSTOMIZE ?= $(shell which kustomize)
YQ_VERSION=v4.27.3
KUSTOMIZE_VERSION=v5.0.0
KUSTOMIZE_VERSION=v5.6.0
OPERATOR_SDK_VERSION=v1.38.0
CONTROLLER_TOOLS_VERSION ?= v0.14.0
CONTROLLER_TOOLS_VERSION ?= v0.18.0
OPENSHIFT_VERSIONS ?= v4.12-v4.17

CSV_PATH=bundle/manifests/ibm-common-service-operator.clusterserviceversion.yaml
Expand Down
1 change: 1 addition & 0 deletions api/v3/commonservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type CSData struct {
CatalogSourceNs string
ODLMCatalogSourceName string
ODLMCatalogSourceNs string
ODLMChannel string
IsolatedModeEnable string
ApprovalMode string
OnPremMultiEnable string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ metadata:
capabilities: Seamless Upgrades
cloudPakThemesVersion: styles467.css
containerImage: icr.io/cpopen/common-service-operator:4.6.19
createdAt: "2025-06-06T02:09:35Z"
createdAt: "2025-10-15T21:55:18Z"
description: The IBM Cloud Pak foundational services operator is used to deploy IBM foundational services.
features.operators.openshift.io/disconnected: "true"
features.operators.openshift.io/fips-compliant: "true"
Expand Down Expand Up @@ -623,6 +623,13 @@ spec:
- get
- list
- update
- apiGroups:
- packages.operators.coreos.com
resources:
- packagemanifests
verbs:
- get
- list
serviceAccountName: ibm-common-service-operator
strategy: deployment
installModes:
Expand Down
2 changes: 1 addition & 1 deletion bundle/manifests/operator.ibm.com_commonservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.18.0
creationTimestamp: null
labels:
app.kubernetes.io/instance: ibm-common-service-operator
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/operator.ibm.com_commonservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.18.0
labels:
foundationservices.cloudpak.ibm.com: crd
name: commonservices.operator.ibm.com
Expand Down
10 changes: 9 additions & 1 deletion config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ rules:
- patch
- update
- watch

---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
Expand Down Expand Up @@ -272,4 +273,11 @@ rules:
verbs:
- get
- list
- update
- update
- apiGroups:
- packages.operators.coreos.com
resources:
- packagemanifests
verbs:
- get
- list
16 changes: 14 additions & 2 deletions internal/controller/bootstrap/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func NewBootstrap(mgr manager.Manager) (bs *Bootstrap, err error) {
CatalogSourceNs: "",
ODLMCatalogSourceName: odlmCatalogSourceName,
ODLMCatalogSourceNs: odlmcatalogSourceNs,
ODLMChannel: constant.ODLMChannel,
ApprovalMode: approvalMode,
WatchNamespaces: util.GetWatchNamespace(),
OnPremMultiEnable: strconv.FormatBool(util.CheckMultiInstances(mgr.GetAPIReader())),
Expand Down Expand Up @@ -254,9 +255,20 @@ func (b *Bootstrap) InitResources(instance *apiv3.CommonService, forceUpdateODLM
}
}

klog.Info("Installing ODLM Operator")
if err := b.renderTemplate(constant.ODLMSubscription, b.CSData); err != nil {
// Install ODLM Operator
// Check if CatalogSource contains the correct version of ODLM
// if contains, install ODLM Operator
// if not, skip the installation of ODLM Operator, and show warning event
if installODLM, err := util.CheckODLMCatalogSource(b.Reader, constant.ODLMPackageName, b.CSData.ODLMCatalogSourceName, b.CSData.ODLMCatalogSourceNs, b.CSData.OperatorNs); err != nil {
return err
} else if installODLM {
klog.Info("Installing ODLM Operator")
if err := b.renderTemplate(constant.ODLMSubscription, b.CSData); err != nil {
return err
}
} else {
b.EventRecorder.Event(instance, corev1.EventTypeWarning, "ODLMCatalogSourceWarning", fmt.Sprintf("The catalogsource %s in namespace %s does not contain the correct version of ODLM, skip the installation/update of ODLM Operator", b.CSData.ODLMCatalogSourceName, b.CSData.ODLMCatalogSourceNs))
return fmt.Errorf("the catalogsource %s in namespace %s does not contain the correct version of ODLM, skip the installation/update of ODLM Operator", b.CSData.ODLMCatalogSourceName, b.CSData.ODLMCatalogSourceNs)
}

klog.Info("Waiting for ODLM Operator to be ready")
Expand Down
21 changes: 21 additions & 0 deletions internal/controller/common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (

utilyaml "github.com/ghodss/yaml"
olmv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
operatorsv1 "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/operators/v1"
corev1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
"k8s.io/apimachinery/pkg/api/equality"
Expand Down Expand Up @@ -544,6 +545,26 @@ func GetCatalogSource(packageName, ns string, r client.Reader) (CatalogSourceNam
return subscriptions[0].Spec.CatalogSource, subscriptions[0].Spec.CatalogSourceNamespace
}

func CheckODLMCatalogSource(r client.Reader, packageName, catalogSourceName, catalogSourceNamespace, operatorNamespace string) (bool, error) {
found := false
// Get CatalogSource from PackageManifest
pmList := &operatorsv1.PackageManifestList{}
if err := r.List(context.TODO(), pmList, &client.ListOptions{Namespace: operatorNamespace}); err != nil {
return found, fmt.Errorf("failed to list PackageManifest: %v", err)
}

for _, pm := range pmList.Items {
if pm.Status.PackageName == packageName && pm.Status.CatalogSource == catalogSourceName && pm.Status.CatalogSourceNamespace == catalogSourceNamespace {
for _, channel := range pm.Status.Channels {
if channel.Name == constant.ODLMChannel {
found = true
}
}
}
}
return found, nil
}

// UpdateCsMaps will update namespaceMapping in common-service-maps
func UpdateCsMaps(cm *corev1.ConfigMap, requestNsList, servicesNS, operatorNs string) error {
commonServiceMaps, ok := cm.Data["common-service-maps.yaml"]
Expand Down
4 changes: 4 additions & 0 deletions internal/controller/constant/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ const (
CsMapConfigMapNs = "kube-public"
// CS Saas configMap
SaasConfigMap = "saas-config"
// ODLM Channel
ODLMChannel = "v4.3"
// ODLM PackageName
ODLMPackageName = "ibm-odlm"
// Namespace Scope Operator resource name
NsSubResourceName = "nsSubscription"
// Namespace Scope Operator sub name
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/constant/odlm.go
Original file line number Diff line number Diff line change
Expand Up @@ -2364,7 +2364,7 @@ metadata:
name: operand-deployment-lifecycle-manager-app
namespace: "{{ .CPFSNs }}"
spec:
channel: v4.3
channel: "{{ .ODLMChannel }}"
installPlanApproval: {{ .ApprovalMode }}
name: ibm-odlm
source: {{ .ODLMCatalogSourceName }}
Expand Down