Bug 1961317
| Summary: | storage ClusterOperator does not declare ClusterRoleBindings in relatedObjects | ||
|---|---|---|---|
| Product: | OpenShift Container Platform | Reporter: | W. Trevor King <wking> |
| Component: | Storage | Assignee: | Jan Safranek <jsafrane> |
| Storage sub component: | Operators | QA Contact: | Wei Duan <wduan> |
| Status: | CLOSED ERRATA | Docs Contact: | |
| Severity: | medium | ||
| Priority: | unspecified | CC: | aos-bugs, jsafrane, melbeher |
| Version: | 4.9 | ||
| Target Milestone: | --- | ||
| Target Release: | 4.10.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-03-12 04:35:20 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
W. Trevor King
2021-05-17 17:07:57 UTC
> While we're touching this, we should probably also drop the namespace declaration from the ClusterRoleBinding manifest [2], because ClusterRoleBindings are not namespaced (they are cluster-scoped) [3,4]. This has been addressed through bug 1961538. ClusterOperator.Status.RelatedObjects in CSO is composed partly statically at operator startup [1] and partly dynamically when we know what CSI driver we're going to start [2] 1: https://github.com/openshift/cluster-storage-operator/blob/c757199372ff217ef96e379f2add3c5d380d601e/pkg/operator/starter.go#L55 2: https://github.com/openshift/cluster-storage-operator/blob/c757199372ff217ef96e379f2add3c5d380d601e/pkg/operator/csidriveroperator/driverstarter.go#L146 At [2] we know what RBAC (and other) objects we're going to create in ctrl.operatorConfig.StaticAssets, e.g. for AWS EBS: https://github.com/openshift/cluster-storage-operator/blob/c757199372ff217ef96e379f2add3c5d380d601e/pkg/operator/csidriveroperator/csioperatorclient/aws.go#L26 We could add code to parse these YAML files and add them to relatedObjects at [2]. Verified with 4.9.0-0.nightly-2021-06-23-160041
CSI Driver related resource are added:
$ oc get co storage -ojson | jq -r '.status.relatedObjects[] | select(.resource == "clusterrolebindings")'
{
"group": "rbac.authorization.k8s.io",
"name": "aws-ebs-csi-driver-operator-clusterrolebinding",
"resource": "clusterrolebindings"
}
But there is no clusterrolebindings/cluster-storage-operator-role:
$ oc get clusterrolebindings cluster-storage-operator-role
NAME ROLE AGE
cluster-storage-operator-role ClusterRole/cluster-admin 84m
Assigned back, please help confirm if this is expected result.
so the `static assets` for the "drivers" which are managed by "cluster-storage-operator" does not contain "cluster/-admin"
For example, "aws-ebs-csi-driver-operator" is managed by "cluster-storage-operator", contains the following static assets
```
relatedObjects:
- group: operator.openshift.io
name: ebs.csi.aws.com
resource: clustercsidrivers
- group: ""
name: aws-ebs-csi-driver-operator
namespace: openshift-cluster-csi-drivers
resource: serviceaccounts
- group: rbac.authorization.k8s.io
name: aws-ebs-csi-driver-operator-role
namespace: openshift-cluster-csi-drivers
resource: roles
- group: rbac.authorization.k8s.io
name: aws-ebs-csi-driver-operator-rolebinding
namespace: openshift-cluster-csi-drivers
resource: rolebindings
- group: rbac.authorization.k8s.io
name: aws-ebs-csi-driver-operator-clusterrole
resource: clusterroles
- group: rbac.authorization.k8s.io
name: aws-ebs-csi-driver-operator-clusterrolebinding
resource: clusterrolebindings
- group: rbac.authorization.k8s.io
name: aws-ebs-csi-driver-operator-aws-config-role
namespace: openshift-config-managed
resource: roles
- group: rbac.authorization.k8s.io
name: aws-ebs-csi-driver-operator-aws-config-clusterrolebinding
namespace: openshift-config-managed
resource: rolebindings
- group: ""
name: openshift-cluster-storage-operator
resource: namespaces
- group: ""
name: openshift-cluster-csi-drivers
resource: namespaces
- group: operator.openshift.io
name: cluster
resource: storages
```
Moreover, any resources which are cluster-wide, or within the `all` category for a resource, will be collected by `oc adm inspect`
cluster-storage-operator-role is created by CVO and not by cluster-storage-operator. It needs to be listed statically. @jan I am still assigned to it, however I do not know what I should do more here. It's assigned to me, now we miss just one ClusterRoleBinding that I'm adding manually in the linked PR. thanks so much Verified pass with 4.10.0-0.nightly-2022-01-16-191814
$ oc get co storage -ojson | jq -r '.status.relatedObjects[] | select(.resource == "clusterrolebindings")'
{
"group": "rbac.authorization.k8s.io",
"name": "gcp-pd-csi-driver-operator-clusterrolebinding",
"resource": "clusterrolebindings"
}
{
"group": "rbac.authorization.k8s.io",
"name": "cluster-storage-operator-role",
"resource": "clusterrolebindings"
}
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 (Moderate: OpenShift Container Platform 4.10.3 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:0056 |