Setting custom `spec.application.route.host` not working using the RHDH Operator on OpenShift, due to inconsistent permissions between downstream and upstream CSVs #360
RHDH operator next version (image: registry.redhat.io/rhdh/rhdh-rhel9-operator@sha256:f9e4e29b935cae26df62191e59f8240cddcc160d0ed29efe9d7d6f9ac549bc8e)
or RHDH operator latest released version (image: registry.redhat.io/rhdh/rhdh-rhel9-operator@sha256:9bea7eabdea44342248dfd6091a8f5c3b6e65884c916b3c2a073a4a64481aa6f)
OpenShift 4.15.0
What did you do exactly?
Against an OpenShift cluster:
# Similar issue when installing the released operator from the OpenShift OperatorHub
.rhdh/scripts/install-rhdh-catalog-source.sh --next --install-operator rhdh
cat <<EOF | oc apply -f -
apiVersion: rhdh.redhat.com/v1alpha1
kind: Backstage
metadata:
name: test-bs-route
spec:
application:
route:
host: test-bs-route.example.com
EOF
Actual behavior
The CR status is DeployFailed, and not all resources are created.
Using the upcoming 1.2 (--next)
The error message is failed to patch object *v1.Deployment: deployments.apps "backstage-test-bs-route" is forbidden: User "system:serviceaccount:rhdh-operator:rhdh-operator" cannot patch resource "deployments" in API group "apps" in the namespace "my-ns", which indicates a missing role for the operator service account.
Using the released 1.1.2 (--latest)
The error message is failed to deploy Backstage Route: Route.route.openshift.io "backstage-test-bs-route" is invalid: spec.host: Forbidden: you do not have permission to set the host field of the route, which also indicates a missing role for the operator service account.
Expected behavior
The downstream RHDH operator should reconcile successfully without any errors, and the Route created by the Operator should have the specified host set.
It works as expected when running the Backstage operator (using make deploy or make run), not the downstream RHDH bundle. This indicates an issue with out-of-sync RBAC permissions between both bundles, as already caught in https://github.com/janus-idp/operator/pull/351#discussion_r1599790206
We should make sure to keep those permissions in sync.
$ oc get route
No resources found in my-ns namespace.
$ oc get statefulset
NAME READY AGE
backstage-psql-test-bs-route 1/1 4m9s
$ oc get statefulset
NAME READY AGE
backstage-psql-test-bs-route 1/1 4m9s
$ oc describe backstage test-bs-route
Name: test-bs-route
Namespace: my-ns
Labels: <none>
Annotations: <none>
API Version: rhdh.redhat.com/v1alpha1
Kind: Backstage
Metadata:
Creation Timestamp: 2024-05-15T07:20:33Z
Generation: 1
Resource Version: 316845
UID: da912858-8314-4c1d-a176-a9bc63715745
Spec:
Application:
Replicas: 1
Route:
Enabled: true
Host: test-bs-route.example.com
Status:
Conditions:
Last Transition Time: 2024-05-15T07:20:33Z
Message: failed to deploy Backstage Route: Route.route.openshift.io "backstage-test-bs-route" is invalid: spec.host: Forbidden: you do not have permission to set the host field of the route
Reason: DeployFailed
Status: False
Type: Deployed
Events: <none>
/kind bug
What versions of software are you using?
registry.redhat.io/rhdh/rhdh-rhel9-operator@sha256:f9e4e29b935cae26df62191e59f8240cddcc160d0ed29efe9d7d6f9ac549bc8e
)registry.redhat.io/rhdh/rhdh-rhel9-operator@sha256:9bea7eabdea44342248dfd6091a8f5c3b6e65884c916b3c2a073a4a64481aa6f
)What did you do exactly?
Against an OpenShift cluster:
Actual behavior
The CR status is
DeployFailed
, and not all resources are created.Using the upcoming 1.2 (--next)
The error message is
failed to patch object *v1.Deployment: deployments.apps "backstage-test-bs-route" is forbidden: User "system:serviceaccount:rhdh-operator:rhdh-operator" cannot patch resource "deployments" in API group "apps" in the namespace "my-ns"
, which indicates a missing role for the operator service account.Using the released 1.1.2 (--latest)
The error message is
failed to deploy Backstage Route: Route.route.openshift.io "backstage-test-bs-route" is invalid: spec.host: Forbidden: you do not have permission to set the host field of the route
, which also indicates a missing role for the operator service account.Expected behavior
The downstream RHDH operator should reconcile successfully without any errors, and the Route created by the Operator should have the specified host set.
It works as expected when running the Backstage operator (using
make deploy
ormake run
), not the downstream RHDH bundle. This indicates an issue with out-of-sync RBAC permissions between both bundles, as already caught in https://github.com/janus-idp/operator/pull/351#discussion_r1599790206We should make sure to keep those permissions in sync.
Any logs, error output, etc?