Skip to content

App: Fix openstack-operator app installation #791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Akrog
Copy link
Contributor

@Akrog Akrog commented Mar 3, 2025

When installing the openstack-operator it is correctly installed in the openstack-operators namespace, but because of this kcli also creates an OperatorGroup that is limiting the namespaces where it will take effect.

This means that following the installation of OpenStack in OpenShift will not work, and we'll get the following error when creating a valid OpenStackControlPlane object in the openstack namespace:

The OpenStackControlPlane "rhoso" is invalid:
* spec.galera.templates.openstack.storageClass: Required value
* spec.galera.templates.openstack-cell1.storageClass: Required value
* spec.glance.template.glanceAPIs.default.containerImage: Required value
* spec.glance.template.imageCache: Required value
* spec.barbican.template.serviceAccount: Required value
* spec.nova.template.apiContainerImageURL: Required value
* spec.nova.template.computeContainerImageURL: Required value
* spec.nova.template.conductorContainerImageURL: Required value
* spec.nova.template.metadataContainerImageURL: Required value
* spec.nova.template.novncproxyContainerImageURL: Required value
* spec.nova.template.schedulerContainerImageURL: Required value
* <nil>: Invalid value: "null": some validation rules were not checked because the object was invalid; correct the existing errors to complete validation

This is because the mutating webhooks are restricted by the targetNamespaces.

In this patch we make a small change to the install.yml.j2 template so that the targetNamespaces is not created when deploying the openstack-operator.

(cherry picked from commit dee7a94d98b0d50e17a6e8866c4e627fe20c7180)

@karmab
Copy link
Owner

karmab commented Mar 4, 2025

the information on whether to create an operator group comes from the olm spec of the operator

@Akrog
Copy link
Contributor Author

Akrog commented Mar 4, 2025

the information on whether to create an operator group comes from the olm spec of the operator

But we are still creating it after this patch, we are just not restricting it to a single namespaces.
I believe installing it using the UI doesn't restrict it to a single namespace either by default.
I will double check tomorrow.

@Akrog
Copy link
Contributor Author

Akrog commented Mar 5, 2025

Screenshot_2025-03-05-13-46-02_2560x2790

@Akrog
Copy link
Contributor Author

Akrog commented Mar 5, 2025

You can see in that picture the default behavior on the UI, and that is the Installation mode to be for All namespaces on the cluster, which is what this change does.
Though that may need to not be hardcoded but instead to be auto detected.

Currently whenever an operator defines a preferred installation
namespace we limit it's installation mode to that specific namespace of
the cluster.

This goes against the default behavior of the web console, where the
default (if the operator supports it) is to install it for all
namespaces of the cluster.

In this patch we change kcli to behave like the web console, so even if
the operator is installed in the desired namespace it will only be
restricted to that namespace if it doesn't support `AllNamespaces`.

This is important because there are operators, like the openstack
operator, that expects them to handle all the namespaces.

When that's not the case the installation of OpenStack in OpenShift
(following deployment guides) will not work, and we'll get the following
error when creating a valid `OpenStackControlPlane` object in the
`openstack` namespace:

```
The OpenStackControlPlane "rhoso" is invalid:
* spec.galera.templates.openstack.storageClass: Required value
* spec.galera.templates.openstack-cell1.storageClass: Required value
* spec.glance.template.glanceAPIs.default.containerImage: Required value
* spec.glance.template.imageCache: Required value
* spec.barbican.template.serviceAccount: Required value
* spec.nova.template.apiContainerImageURL: Required value
* spec.nova.template.computeContainerImageURL: Required value
* spec.nova.template.conductorContainerImageURL: Required value
* spec.nova.template.metadataContainerImageURL: Required value
* spec.nova.template.novncproxyContainerImageURL: Required value
* spec.nova.template.schedulerContainerImageURL: Required value
* <nil>: Invalid value: "null": some validation rules were not checked because the object was invalid; correct the existing errors to complete validation
```

This is because the mutating webhooks are restricted by the
`targetNamespaces`.
@Akrog Akrog force-pushed the fix-openstack-operator branch from 3387e0a to 9dba5bd Compare March 5, 2025 13:45
@Akrog
Copy link
Contributor Author

Akrog commented Mar 5, 2025

I have made a change to the approach, now I use the information from the package manifest (installModes) for the condition instead of hardcoding it for the openstack operator.

I haven't tested the approach, but if you are ok with this approach I will.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants