Bug 2070172

Summary: SRO uses the chart's name as Helm release, not the SpecialResource's
Product: OpenShift Container Platform Reporter: Quentin Barrand <quba>
Component: Special Resource OperatorAssignee: Quentin Barrand <quba>
Status: CLOSED ERRATA QA Contact: Udi Kalifon <ukalifon>
Severity: high Docs Contact:
Priority: high    
Version: 4.11CC: aos-bugs
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-10 11:02:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Quentin Barrand 2022-03-30 14:25:28 UTC
Description of problem:

SRO uses the recipe chart's name as Helm release, not the SpecialResource.
This leads to issues with the meta.helm.sh/release-name annotation Helm is putting on the resource it owns. If two SpecialResources target the same chart, then both installations might fail as each one will adopt the other's resources through that annotation.

Slack thread: https://coreos.slack.com/archives/C02358PSC03/p1647933385175109

Using the SpecialResource's name (which is unique in the cluster) instead of the chart's should solve this issue.

Comment 2 Quentin Barrand 2022-04-25 10:25:04 UTC
Merged upstream in https://github.com/openshift-psap/special-resource-operator/pull/286
PR downstream and backport TODO.

Comment 4 Udi Kalifon 2022-05-13 11:01:34 UTC
@quba I changed the chart's name in index.yaml and updated my configmap, and I also changed the specialresource's CRD so that the SR's name is simple-kmod-sr-name and the chart's name is simple-kmod-chart-name. I get this in the SRO log:

cm-getter2022/05/13 10:25:51 Element: index.yaml
2022-05-13T10:25:51.612Z	INFO	helmer  	Locating	{"chart": "example/simple-kmod-chart-name"}
2022-05-13T10:25:51.640Z	ERROR	controller.specialresource	Reconciler error	{"reconciler group": "sro.openshift.io", "reconciler kind": "SpecialResource", "name": "simple-kmod-sr-name", "namespace": "", "error": "RECONCILE ERROR: Cannot reconcile special resource: Could not locate chart example/simple-kmod-chart-name: chart \"simple-kmod-chart-name\" matching 0.0.1 not found in example index. (try 'helm repo update'): no chart name found", "errorVerbose": "Could not locate chart example/simple-kmod-chart-name: chart \"simple-kmod-chart-name\" matching 0.0.1 not found in example index. (try 'helm repo update'): no chart name found\nRECONCILE ERROR: Cannot reconcile special resource\ngithub.com/openshift-psap/special-resource-operator/controllers.(*SpecialResourceReconciler).Reconcile\n\t/workspace/controllers/specialresource_controller.go:94\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\t/workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:114\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:311\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:266\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:227\nruntime.goexit\n\t/usr/lib/golang/src/runtime/asm_amd64.s:1581"}
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
	/workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:227

How do I properly change the chart's name?

Comment 5 Quentin Barrand 2022-05-13 14:57:34 UTC
The make-cm-recipe script is the preferred way to create a ConfigMap-based recipe: https://github.com/openshift/special-resource-operator/blob/master/scripts/make-cm-recipe
In that case, I think there was a mismatch between the name of the chart in the index (simple-kmod-chart-name) and the name in Chart.yaml.
The script generates index.yaml and avoids potential errors there.

Comment 7 Udi Kalifon 2022-06-21 15:23:06 UTC
Verified with the latest 4.11 code from bundle. I created 2 special resources from the same CMs.

Comment 8 errata-xmlrpc 2022-08-10 11:02:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Container Platform 4.11.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5069