Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
179 commits
Select commit Hold shift + click to select a range
d1140d5
tolerate multi entries for same subscription (#907)
Daniel-Fan Mar 13, 2023
fc2994c
Trigger build with new base image
Mar 13, 2023
52c4020
add new value no-op in installmode replace supportStatus (#909)
YCShen1010 Mar 14, 2023
c8b4071
skip sub updating for discontinued services (#910)
YCShen1010 Mar 16, 2023
bf39300
Trigger build with new base image
Mar 27, 2023
c3cf88e
build(deps): bump github.com/prometheus/client_golang (#895)
dependabot[bot] Mar 28, 2023
c927bf9
tolerate multi catalogsource for same service (#914)
YCShen1010 Mar 28, 2023
1cfed4a
Remove annotation patch to avoid status lost (#915)
Daniel-Fan Mar 30, 2023
e9839ec
Trigger build with new base image
Apr 18, 2023
6999157
check for status.services, im service status (#916)
bluzarraga Apr 19, 2023
8960254
cp3 migrate to aws (#920)
qpdpQ Apr 19, 2023
04b32e0
Remove the status.services entry for an operator if it is removed fro…
bluzarraga Apr 24, 2023
ce01d9d
Indicate multi requested service version conflict (#921)
Daniel-Fan Apr 24, 2023
417b855
build(deps): bump golang.org/x/text from 0.3.6 to 0.3.8 (#898)
dependabot[bot] Apr 26, 2023
97a954d
Update test case (#927)
Daniel-Fan May 18, 2023
d188f7c
dolm annotation updated for nss operator (#925)
YCShen1010 May 19, 2023
4eb3537
update go to latest (#928)
bluzarraga May 23, 2023
ed7754e
Trigger build with new base image
May 23, 2023
3d223ab
manage complete tenant scope for subscriptions (#930)
Daniel-Fan May 23, 2023
7231e25
update packages for twistlock (#931)
bluzarraga May 26, 2023
3a69929
[ODLM] bump version to 4.1.0 (#939)
YCShen1010 Jun 22, 2023
d060572
"disconnected" annotation for assessment (#932)
YCShen1010 Jun 22, 2023
bef6fbe
Update ImagePullPolicy to IfNotPresent (#937)
YCShen1010 Jun 22, 2023
018bd4f
Trigger build with new base image
Jul 5, 2023
e1b3bd2
build(deps): bump google.golang.org/grpc from 1.48.0 to 1.53.0 (#942)
dependabot[bot] Jul 6, 2023
63a74a0
update go for 4.1 (#943)
bluzarraga Jul 6, 2023
edb645e
multiple opbi (#944)
qpdpQ Jul 11, 2023
6450c26
updated dependapot to cover release-ltsr branch (#946)
bitscuit Jul 14, 2023
3519d07
Compare updated opreq status with latest opreq (#950)
Daniel-Fan Jul 20, 2023
db6f779
[ODLM] bump version to 4.2.0 (#959)
YCShen1010 Aug 10, 2023
93d54b0
build(deps): bump golang from 1.20.5-bullseye to 1.21.0-bullseye (#957)
dependabot[bot] Aug 10, 2023
344b18f
delete job by using background cascading deletion (#956)
YCShen1010 Aug 14, 2023
769d552
Trigger build with new base image
Aug 14, 2023
20e2431
[4.2] Sort Catalogsource by priority in ODLM (#955)
YCShen1010 Aug 16, 2023
701aa4d
Trigger build with new base image
Aug 22, 2023
b5dcb6a
handle operator namespace could be optional in OperandRegistry (#963)
YCShen1010 Aug 25, 2023
363c5e7
ODLM support concurrently reconciling multiple resources (#965)
YCShen1010 Aug 29, 2023
18a0c60
build(deps): bump golang from 1.21.0-bullseye to 1.21.1-bullseye (#966)
dependabot[bot] Sep 7, 2023
e9760db
Add OperandBindinfo example into alm-example (#968)
Daniel-Fan Sep 7, 2023
c2b30df
update packages for security vulnerabilities (#969)
bluzarraga Sep 11, 2023
d259717
add ephemeral-storage request to container (#961)
qpdpQ Sep 11, 2023
cd3b161
Bump ODLM to v4.3 version (#971)
Daniel-Fan Sep 25, 2023
c3c42f1
revert ODLM back to 4.2.1 and channel v4.2 (#972)
Daniel-Fan Sep 28, 2023
98f085f
Add the common label to operand Pod (#970)
pgodowski Sep 28, 2023
a2f8738
build(deps): bump golang from 1.21.1-bullseye to 1.21.2-bullseye (#974)
dependabot[bot] Oct 6, 2023
cf27df7
Trigger build with new base image
Oct 11, 2023
32e93ae
build(deps): bump golang.org/x/net from 0.9.0 to 0.17.0 (#979)
dependabot[bot] Oct 12, 2023
688c56d
list out basic permission need by ODLM (#980)
YCShen1010 Oct 13, 2023
ffcfedc
Add additional explicitly listed permission (#981)
Daniel-Fan Oct 16, 2023
7720714
Trigger build with new base image
Oct 18, 2023
a85192d
add finalizers permission (#985)
YCShen1010 Oct 19, 2023
f8c7ca1
build(deps): bump golang from 1.21.2-bullseye to 1.21.3-bullseye (#977)
dependabot[bot] Oct 20, 2023
41c5f2d
set OwnerReference for resources created by OperandRequest (#983)
Daniel-Fan Oct 20, 2023
975178b
build(deps): bump google.golang.org/grpc from 1.57.0 to 1.57.1 (#987)
dependabot[bot] Oct 26, 2023
9b77e06
Trigger build with new base image
Oct 31, 2023
e6f4ba3
updated Makefile to generate proper CSV (#988)
bitscuit Oct 31, 2023
5615db2
fix for failing to list packagemanifests resource (#989)
YCShen1010 Nov 1, 2023
15c4823
Add value reference in OperandConfig (#990)
Daniel-Fan Nov 2, 2023
947c757
update grpc pkg (#991)
bluzarraga Nov 2, 2023
144e73b
Add support for sharing Route data via ConfigMap with OperandBindInfo…
bitscuit Nov 3, 2023
b94e873
Add support for sharing Service data via ConfigMap with OperandBindIn…
bitscuit Nov 3, 2023
ff4546c
Support jsonpath in OperandConfig value reference (#994)
Daniel-Fan Nov 7, 2023
8facf58
Bump ODLM to 4.2.2 (#998)
Daniel-Fan Nov 22, 2023
baf5923
allow to add multiple owners to cm/secret (#999)
YCShen1010 Nov 28, 2023
f5da287
Enhance error handling for uninstall procedure (#1002)
Daniel-Fan Dec 5, 2023
964c0ee
Skip reconciling CRs for operators marked as no-op (#1001)
Daniel-Fan Dec 5, 2023
095c558
build(deps): bump golang from 1.21.3-bullseye to 1.21.5-bullseye (#1004)
dependabot[bot] Dec 11, 2023
918193f
Bump ODLM to 4.2.3 for 4.4 release (#1005)
YCShen1010 Dec 11, 2023
7f9f8d3
Trigger build with new base image
Jan 2, 2024
3611ea5
Allow resources to be updated by ODLM when control label is specified…
Daniel-Fan Jan 11, 2024
50a7c57
Bump ODLM to 4.3.0 for CS 4.5 release (#1011)
Daniel-Fan Jan 29, 2024
79d96a8
Trigger build with new base image
Feb 2, 2024
547117d
Trigger build with new base image
Feb 7, 2024
e07f548
build(deps): bump golang from 1.21.5-bullseye to 1.22.0-bullseye (#1012)
dependabot[bot] Feb 8, 2024
01db7ee
Improve logs on Catalog discovery (#1015)
Daniel-Fan Feb 16, 2024
0e8efe4
Reduce CPU and Memory usage (#1009)
Daniel-Fan Feb 16, 2024
a73dc9c
Prioritize the Catalog which ODLM is deployed from (#1016)
Daniel-Fan Feb 21, 2024
0ff537d
Trigger build with new base image
Feb 21, 2024
8d3224d
Read Object from k8s API directly instead of cache to avoid getting o…
Daniel-Fan Feb 22, 2024
5a98d87
Skip OperandRequest for OperandBindinfo if the OperandRequest is in t…
Daniel-Fan Feb 22, 2024
8219fb7
build(deps): bump golang from 1.22.0-bullseye to 1.22.1-bullseye (#1021)
dependabot[bot] Mar 6, 2024
3970760
add CertManager and AuditLogging CR cluster permission to ODLM (#1023)
YCShen1010 Mar 14, 2024
6b51bab
updated base image to explicitly use docker.io instead of implied (#1…
bitscuit Mar 19, 2024
5c0f9c8
Introduce OwnReference API (#1025)
Daniel-Fan Mar 20, 2024
702e443
build(deps): bump google.golang.org/protobuf from 1.31.0 to 1.33.0 (#…
dependabot[bot] Mar 22, 2024
b19d2c5
Enable deep JSON merging for Kubernetes resources when updating them …
YCShen1010 Mar 27, 2024
4857a8c
fix deep copy (#1029)
YCShen1010 Mar 28, 2024
f53293d
scaffolded OperatorConfig API (#1027)
bitscuit Mar 28, 2024
5570fa6
Operatorconfig controller (#1030)
bitscuit Apr 1, 2024
b707a0b
Support uninstallation on intra-dependency (#1028)
Daniel-Fan Apr 2, 2024
e6031a2
Trigger build with new base image
Apr 2, 2024
ab882ee
Trigger build with new base image
Apr 3, 2024
9feb278
Improve UX experience for OperatorConfig (#1033)
Daniel-Fan Apr 4, 2024
7fd4cfc
build(deps): bump golang from 1.22.1-bullseye to 1.22.2-bullseye (#1031)
dependabot[bot] Apr 4, 2024
307337c
Trigger build with new base image
Apr 4, 2024
935adbb
Update OperatorConfig reconciliation and improve error handling (#1034)
Daniel-Fan Apr 5, 2024
6ffbe24
Set channel annotation for no-op equal to spec channel when spec chan…
Daniel-Fan Apr 15, 2024
b808aac
Bump version to 4.3.1 for 4.6.1 (#1038)
Daniel-Fan Apr 23, 2024
83e2a38
overwrite the array in deep merge logic (#1037)
YCShen1010 Apr 23, 2024
a60f12c
Retrigger build after prow fix
ashank07 Apr 24, 2024
480bca5
Trigger build with new base image
Apr 26, 2024
b053b5d
remove discontinued quay configuration (#1042)
Daniel-Fan Apr 30, 2024
3705ead
Fix nil pointer issue when operator is not found in OperandRegistry (…
Daniel-Fan Apr 30, 2024
00b22c2
Update pkgs for security vulnerabilities for 4.6.2 (#1043)
bluzarraga May 1, 2024
b3ed4f6
Update ODLM module to match major version v4 (#1039)
Daniel-Fan May 3, 2024
646f7ea
build(deps): bump golang from 1.22.2-bullseye to 1.22.3-bullseye (#1044)
dependabot[bot] May 13, 2024
ab6ffe1
Bump ODLM to 4.3.2 for 4.6.3 (#1047)
Daniel-Fan May 23, 2024
26bedb3
Trigger build with new base image
May 24, 2024
6db85c0
Only discover catalog for an operator when it has been requested in O…
Daniel-Fan May 27, 2024
c65b695
Trigger build with new base image
May 30, 2024
287eafa
reset the phase of each operator in opreq (#1049)
YCShen1010 Jun 3, 2024
330494d
Skip catalog discover when operator is not found in OperandRegistry (…
Daniel-Fan Jun 3, 2024
85eb084
reconcile k8s resource in parallel and with retry logic (#1053)
Daniel-Fan Jun 5, 2024
13d2591
build(deps): bump golang from 1.22.3-bullseye to 1.22.4-bullseye (#1051)
dependabot[bot] Jun 6, 2024
d4a3db0
Find CSVs by label for an operator, to ensure deleting all the CSVs f…
Daniel-Fan Jun 6, 2024
484e3ee
Raise error when there is no catalog found for a operator (#1054)
Daniel-Fan Jun 6, 2024
4bb675f
Refactor members and services status update (#1056)
Daniel-Fan Jun 7, 2024
929e795
Bump version to 4.3.3 for SC2 4.6.4 (#1058)
Daniel-Fan Jun 20, 2024
d84fbf1
Trigger build with new base image
Jun 26, 2024
afdc424
Bump version to 4.3.4 for SC2 4.6.5 (#1064)
qpdpQ Jul 22, 2024
223a3cf
Trigger build with new base image
Jul 23, 2024
144cdd4
Trigger build with new base image
Jul 24, 2024
c1ffca7
Trigger build with new base image
Jul 29, 2024
5b41ff8
trigger build
bluzarraga Jul 30, 2024
32ea607
build(deps): bump golang from 1.22.4-bullseye to 1.22.5-bullseye (#1063)
dependabot[bot] Jul 31, 2024
17707a9
Clean redundant CSV in service ns during the migration (#1065)
Daniel-Fan Aug 1, 2024
d54ec80
Find semantic versioning from channel (#1066)
Daniel-Fan Aug 1, 2024
2bb0bd1
add securityContext .seccompProfile field (#1071)
qpdpQ Aug 13, 2024
7cb1893
Bump version to 4.3.5 for SC2 4.6.6 (#1074)
qpdpQ Aug 14, 2024
41548e1
Trigger build with new base image
Aug 21, 2024
1ec4497
Trigger build with new base image
Aug 22, 2024
1ce56ca
update golangci version to 1.60.x (#1076)
Daniel-Fan Aug 26, 2024
afe2a5e
remove ltsr branch from dependabot.yml (#1075)
YCShen1010 Aug 26, 2024
67f51c8
updated base image to ubi9 (#1077)
bitscuit Aug 26, 2024
58b5ab1
added feature to handle user managed operators (BYO) (#1078)
bitscuit Aug 30, 2024
7f5d804
implement channel fallback in catalog discovery (#1079)
Daniel-Fan Aug 30, 2024
1a73797
Bump version to 4.3.6 for SC2 4.6.7 (#1082)
qpdpQ Sep 16, 2024
2c3e50f
Trigger build with new base image
Sep 18, 2024
f71913e
Add packagemanifest CRD in test ENV (#1080)
Daniel-Fan Sep 18, 2024
dfc27df
Trigger build with new base image
Sep 25, 2024
f6260a6
Revert the host back to default value (#1083)
YCShen1010 Sep 25, 2024
6baae18
build(deps): bump golang from 1.23.0-bullseye to 1.23.1-bullseye (#1081)
dependabot[bot] Sep 25, 2024
2d8d9d3
Use PackageName name as the name of subscription (#1084)
YCShen1010 Sep 26, 2024
f611358
Enhance ODLM create/update logic by adding hash values (#1086)
YCShen1010 Sep 30, 2024
c1be25c
Add optionalFields into OperandConfig, to conditionally prune fields …
Daniel-Fan Sep 30, 2024
2f1f1e7
omit empty value (#1087)
YCShen1010 Sep 30, 2024
b7388f4
Bump version to 4.3.7 fo SC2 4.6.8 (#1089)
YCShen1010 Oct 7, 2024
b196a87
Revert "build(deps): bump golang from 1.23.0-bullseye to 1.23.1-bulls…
ashank07 Oct 9, 2024
90ac731
Trigger build with new base image
Oct 10, 2024
962c1ad
Test with bookworm golang (#1091)
ashank07 Oct 10, 2024
8fbfdcd
label length limitation (#1092)
qpdpQ Oct 17, 2024
cc65c9e
fix typo in utils (#1093)
qpdpQ Oct 18, 2024
885f03e
ensure label within length limitation (#1094)
qpdpQ Oct 22, 2024
7a535eb
Delete k8s resources by checking the label from OperandConfig (#1095)
YCShen1010 Oct 30, 2024
dd83ace
Bump version to 4.3.8 fo SC2 4.6.9 (#1096)
YCShen1010 Nov 12, 2024
bb44e65
Trigger build with new base image
Nov 15, 2024
ad4b892
Tolerate both opt.channel and opt.FallbackChannels for one operator (…
Daniel-Fan Nov 20, 2024
5667aa0
add cluster permission check for v3 resources (#1097)
YCShen1010 Nov 29, 2024
1b6ff4c
Discover private CatalogSource only if no catalog cluster permission …
YCShen1010 Nov 29, 2024
78df370
Use SelfSubjectAccessReview to check ODLM's permission on getting cat…
Daniel-Fan Nov 30, 2024
511cb5a
Trigger build with new base image
Dec 9, 2024
f1a67b7
Bump version to 4.3.9 for CS 4.6.10 (#1102)
qpdpQ Dec 10, 2024
b1408f8
Trigger build with new base image
Jan 6, 2025
a61b000
Trigger build with new base image
Jan 15, 2025
d7bf88e
Check if Object is updated except certain label and annotations (#1104)
Daniel-Fan Jan 20, 2025
2512f44
add required OLM metadata (#1103)
pgodowski Jan 21, 2025
2ca6b11
Trigger build with new base image
Jan 27, 2025
32664c5
update net to 0.33 (#1107)
bluzarraga Jan 29, 2025
020bc45
prototype ODLM w/o olm (#1105)
bluzarraga Jan 30, 2025
f36b827
Helm chart for ODLM (#1106)
qpdpQ Jan 31, 2025
76c2305
update image tag and chart name (#1109)
qpdpQ Feb 3, 2025
c8d43d0
refactor no olm controller code to handle cleanup on operandrequest d…
bluzarraga Feb 4, 2025
92ec5da
bump up odlm version for CD (#1111)
qpdpQ Feb 4, 2025
872fdf8
updated chart to work with CICD automation (#1112)
bitscuit Feb 4, 2025
f39a52b
updated chart to use global values to meet CPD spec (#1113)
bitscuit Feb 4, 2025
cfc57ce
Trigger build with new base image
Feb 6, 2025
82479bb
specify operator namespace in rolebinding (#1117)
bluzarraga Feb 6, 2025
c50ee8d
Update OWNERS (#1116)
Jeremy-Cheng-stack Feb 6, 2025
e3f0628
Enhance cleanup of OperandRequest for non-OLM case (#1114)
YCShen1010 Feb 12, 2025
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
Prev Previous commit
Next Next commit
check for status.services, im service status (#916)
* check for status.services, im service status

Signed-off-by: Ben Luzarraga <[email protected]>

* alter check for im operator status

Signed-off-by: Ben Luzarraga <[email protected]>

* export function

Signed-off-by: Ben Luzarraga <[email protected]>

* account for opreq that do not request im

Signed-off-by: Ben Luzarraga <[email protected]>

* typo

Signed-off-by: Ben Luzarraga <[email protected]>

* clean up implementation

Signed-off-by: Ben Luzarraga <[email protected]>

* linter changes

Signed-off-by: Ben Luzarraga <[email protected]>

* service.operatorName value from managedBy to requested name

Signed-off-by: Ben Luzarraga <[email protected]>

* change common ui operator name to look for

Signed-off-by: Ben Luzarraga <[email protected]>

---------

Signed-off-by: Ben Luzarraga <[email protected]>
Co-authored-by: Ben Luzarraga <[email protected]>
  • Loading branch information
bluzarraga and bluzarraga authored Apr 19, 2023
commit 6999157ae8040f5c59d5ea05da968a59e8273f20
53 changes: 53 additions & 0 deletions api/v1alpha1/operandrequest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
)

Expand Down Expand Up @@ -650,6 +651,58 @@ func (r *OperandRequest) UpdateLabels() bool {
return isUpdated
}

func (r *OperandRequest) CheckServiceStatus() bool {
requeue := false
monitoredServices := []string{"ibm-iam-operator", "ibm-idp-config-ui-operator", "ibm-mongodb-operator", "ibm-im-operator"}
servicesRequested := false
for _, serviceName := range monitoredServices {
if foundOperand(r.Spec.Requests, serviceName) {
servicesRequested = true
break
}
}
if servicesRequested {
if len(r.Status.Services) == 0 {
klog.Info("Waiting for status.services to be instantiated ...")
requeue = true
return requeue
}
// var IMOrIAM string
exists := false
if foundOperand(r.Spec.Requests, "ibm-iam-operator") {
// IMOrIAM = "ibm-iam-operator"
exists = true
} else if foundOperand(r.Spec.Requests, "ibm-im-operator") {
// IMOrIAM = "ibm-im-operator"
exists = true
}

if exists {
var imIndex int
found := false
for i, s := range r.Status.Services {
if "ibm-iam-operator" == s.OperatorName { //eventually this should be changed to the variable but the operator name is still listed as iam in practice even when im is requested
found = true
imIndex = i
break
}
}
if found {
if r.Status.Services[imIndex].Status != "Ready" {
klog.Info("Waiting for IM service to be Ready ...")
requeue = true
return requeue
}
} else {
klog.Info("Waiting for IM service status ...")
requeue = true
return requeue
}
}
}
return requeue
}

// GetAllRegistryReconcileRequest gets all the Registry ReconcileRequest.
func (r *OperandRequest) GetAllRegistryReconcileRequest() []reconcile.Request {
rrs := []reconcile.Request{}
Expand Down
5 changes: 5 additions & 0 deletions controllers/operandrequest/operandrequest_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Re
return ctrl.Result{RequeueAfter: constant.DefaultRequeueDuration}, nil
}

//check if status.services is present (if a relevant service was requested), requeue again is im/iam is not ready yet
if requestInstance.CheckServiceStatus() {
return ctrl.Result{RequeueAfter: constant.DefaultRequeueDuration}, nil
}

klog.V(1).Infof("Finished reconciling OperandRequest: %s", req.NamespacedName)
return ctrl.Result{RequeueAfter: constant.DefaultSyncPeriod}, nil
}
Expand Down
48 changes: 4 additions & 44 deletions controllers/operandrequest/reconcile_operand.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (r *Reconciler) reconcileOperand(ctx context.Context, requestInstance *oper
klog.V(2).Infof("There is no service: %s from the OperandConfig instance: %s/%s, Skip reconciling Operands", operand.Name, registryKey.Namespace, req.Registry)
continue
}
err = r.reconcileCRwithConfig(ctx, opdConfig, configInstance.Namespace, csv, requestInstance, sub.Namespace, &r.Mutex)
err = r.reconcileCRwithConfig(ctx, opdConfig, configInstance.Namespace, csv, requestInstance, operand.Name, sub.Namespace, &r.Mutex)
if err != nil {
merr.Add(err)
requestInstance.SetMemberStatus(operand.Name, "", operatorv1alpha1.ServiceFailed, &r.Mutex)
Expand Down Expand Up @@ -215,7 +215,7 @@ func (r *Reconciler) reconcileOperand(ctx context.Context, requestInstance *oper
}

// reconcileCRwithConfig merge and create custom resource base on OperandConfig and CSV alm-examples
func (r *Reconciler) reconcileCRwithConfig(ctx context.Context, service *operatorv1alpha1.ConfigService, namespace string, csv *olmv1alpha1.ClusterServiceVersion, requestInstance *operatorv1alpha1.OperandRequest, operatorNamespace string, mu sync.Locker) error {
func (r *Reconciler) reconcileCRwithConfig(ctx context.Context, service *operatorv1alpha1.ConfigService, namespace string, csv *olmv1alpha1.ClusterServiceVersion, requestInstance *operatorv1alpha1.OperandRequest, operandName string, operatorNamespace string, mu sync.Locker) error {
merr := &util.MultiErr{}

// Create k8s resources required by service
Expand Down Expand Up @@ -337,10 +337,6 @@ func (r *Reconciler) reconcileCRwithConfig(ctx context.Context, service *operato
merr.Add(err)
continue
}
managedBy, err := r.getManagedBy(crFromALM)
if err != nil {
return err
}
statusSpec, err := r.getOperandStatus(crFromALM)
if err != nil {
return err
Expand All @@ -349,7 +345,7 @@ func (r *Reconciler) reconcileCRwithConfig(ctx context.Context, service *operato
if serviceKind != "OperandRequest" && statusSpec.ObjectName != "" {
var resources []operatorv1alpha1.OperandStatus
resources = append(resources, statusSpec)
serviceSpec := newServiceStatus(managedBy, operatorNamespace, resources)
serviceSpec := newServiceStatus(operandName, operatorNamespace, resources)
seterr := requestInstance.SetServiceStatus(ctx, serviceSpec, r.Client, mu)
if seterr != nil {
return seterr
Expand Down Expand Up @@ -421,18 +417,14 @@ func (r *Reconciler) reconcileCRwithRequest(ctx context.Context, requestInstance
if err := r.updateCustomResource(ctx, crFromRequest, requestKey.Namespace, operand.Kind, operand.Spec.Raw, map[string]interface{}{}); err != nil {
return err
}
managedBy, err := r.getManagedBy(crFromRequest)
if err != nil {
return err
}
statusSpec, err := r.getOperandStatus(crFromRequest)
if err != nil {
return err
}
if operand.Kind != "OperandRequest" && statusSpec.ObjectName != "" {
var resources []operatorv1alpha1.OperandStatus
resources = append(resources, statusSpec)
serviceSpec := newServiceStatus(managedBy, operatorNamespace, resources)
serviceSpec := newServiceStatus(operand.Name, operatorNamespace, resources)
seterr := requestInstance.SetServiceStatus(ctx, serviceSpec, r.Client, mu)
if seterr != nil {
return seterr
Expand All @@ -449,38 +441,6 @@ func (r *Reconciler) reconcileCRwithRequest(ctx context.Context, requestInstance
return nil
}

func (r *Reconciler) getManagedBy(existingCR unstructured.Unstructured) (string, error) {
byteMetadata, err := json.Marshal(existingCR.Object["metadata"])
if err != nil {
klog.Error(err)
return "", err
}
var rawMetadata map[string]interface{}
err = json.Unmarshal(byteMetadata, &rawMetadata)
if err != nil {
klog.Error(err)
return "", err
}
byteLabels, err := json.Marshal(rawMetadata["labels"])
if err != nil {
klog.Error(err)
return "", err
}
var parsedLabels map[string]string
err = json.Unmarshal(byteLabels, &parsedLabels)
if err != nil {
klog.Error(err)
return "", err
}
var managedBy string
for key, value := range parsedLabels {
if key == "app.kubernetes.io/managed-by" {
managedBy = value
}
}
return managedBy, nil
}

func (r *Reconciler) getOperandStatus(existingCR unstructured.Unstructured) (operatorv1alpha1.OperandStatus, error) {
var emptyStatus operatorv1alpha1.OperandStatus
byteStatus, err := json.Marshal(existingCR.Object["status"])
Expand Down