Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
125 changes: 125 additions & 0 deletions components/dependencies/openstack-operator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# openstack-operator deployment component

Deploys the Red Hat OpenStack Services on OpenShift (RHOSO) `openstack-operator`
through a plain OLM `Subscription`, **without pinning a CatalogSource image to a
specific OpenShift version** and **without pinning the operator CSV**
(`spec.startingCSV` is intentionally absent).

## Requirements

- An **entitled/subscribed OpenShift cluster** with a healthy built-in
`redhat-operators` CatalogSource in the `openshift-marketplace` namespace:

```bash
oc get catalogsource redhat-operators -n openshift-marketplace
```

- On **disconnected** clusters, the mirror of `redhat-operators` must include
the `openstack-operator` package (see the RHOSO documentation on mirroring
operator catalogs for restricted networks).

Because the component references the cluster's own `redhat-operators` catalog,
the operator version resolved by OLM always matches what the cluster's catalog
offers for the `stable-v1.0` channel — there is no `redhat-operator-index:vX.Y`
image reference to drift from the cluster version.

## What it deploys

| Resource | Notes |
|----------|-------|
| `Namespace/openstack-operators` | OLM namespace for the Subscription |
| `Namespace/openstack` | `privileged` pod security, no label sync |
| `OperatorGroup/openstack` | AllNamespaces install mode |
| `Subscription/openstack` | channel `stable-v1.0`, `installPlanApproval: Manual`, **no `startingCSV`** |

Note: `installPlanApproval: Manual` means InstallPlans must be approved — either
manually or with the `components/utilities/approve-installplan` component (as
`example/openstack-operator` does).

When consumed through the [rhoso-gitops validated pattern][rhoso-gitops], the
pattern's overrides delete the Namespaces and the OperatorGroup from this
component (they are managed by the pattern's ClusterGroup chart and by OLM's
AllNamespaces mode respectively) — only the Subscription survives.

## Usage

From a sibling path in this repository (as `example/openstack-operator` does):

```yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
components:
- ../../components/dependencies/openstack-operator
```

Or remotely, pinned to a ref of this repository:

```yaml
components:
- https://github.com/openstack-k8s-operators/gitops/components/dependencies/openstack-operator?ref=v0.3.5
```

## Patching

### Pin the operator version

This component is unpinned by design. To pin to a specific CSV, add a patch
targeting the Subscription instead of re-introducing the former
`pin-version`/`olm-values` machinery:

```yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
components:
- ../../components/dependencies/openstack-operator
patches:
- target:
kind: Subscription
name: openstack
patch: |-
- op: add
path: /spec/startingCSV
value: "openstack-operator.v1.0.16"
```

Remember that `spec.startingCSV` is a **floor, not a ceiling**: if the catalog
contains a newer CSV in the same channel, OLM resolves to the newer one.

### Use a different catalog or channel

Same mechanism — patch the Subscription fields:

```yaml
patches:
- target:
kind: Subscription
name: openstack
patch: |-
- op: replace
path: /spec/channel
value: "alpha"
- op: replace
path: /spec/source
value: "my-mirrored-catalog"
- op: replace
path: /spec/sourceNamespace
value: "openshift-marketplace"
```

### Local overlay

For more involved changes (extra resources, different approval mode), create a
local overlay that composes this component instead of copying it, so upstream
fixes still flow in:

```
my-overlay/
├── kustomization.yaml # components: ../components/dependencies/openstack-operator + patches
└── ...
```

Consumers deploying through ArgoCD can equivalently use the Application's
`spec.source.kustomize.patches` — that is how the rhoso-gitops validated
pattern adjusts this component's resources without forking.

[rhoso-gitops]: https://github.com/validatedpatterns-sandbox/rhoso-gitops
10 changes: 10 additions & 0 deletions components/dependencies/openstack-operator/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# Deploys the openstack-operator Subscription, relying on the catalog that
# OpenShift ships on every subscribed cluster (redhat-operators). See README.md.
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

resources:
- namespaces.yaml
- operatorgroup.yaml
- subscription.yaml
13 changes: 13 additions & 0 deletions components/dependencies/openstack-operator/namespaces.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: openstack-operators
---
apiVersion: v1
kind: Namespace
metadata:
name: openstack
labels:
pod-security.kubernetes.io/enforce: privileged
security.openshift.io/scc.podSecurityLabelSync: "false"
6 changes: 6 additions & 0 deletions components/dependencies/openstack-operator/operatorgroup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: openstack
namespace: openstack-operators
14 changes: 14 additions & 0 deletions components/dependencies/openstack-operator/subscription.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: openstack
namespace: openstack-operators
spec:
channel: stable-v1.0
installPlanApproval: Manual
name: openstack-operator
# Rely on the catalog OpenShift ships on subscribed clusters instead of
# pinning a CatalogSource image to a specific OCP version. See README.md.
source: redhat-operators
sourceNamespace: openshift-marketplace
6 changes: 0 additions & 6 deletions example/openstack-operator/catalog/kustomization.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions example/openstack-operator/catalog/values.yaml

This file was deleted.

16 changes: 6 additions & 10 deletions example/openstack-operator/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- catalog

# pin-version must run before the remote OLM component (olm-values feeds replacements).
# approve-installplan must run after the remote component so the Subscription exists for the sync-wave patch.
# openstack-operator is deployed from the cluster's own redhat-operators
# catalog (no pinned CatalogSource image, no pinned CSV), see
# ../../components/dependencies/openstack-operator/README.md.
# approve-installplan must run after the Subscription exists (it patches
# the Subscription sync-wave).
components:
- pin-version
- https://github.com/openstack-k8s-operators/architecture/lib/olm-openstack-subscriptions/overlays/default?ref=7da5f2e1dc2bfce99e269b0017783679ca405d8c
# TODO: replace the local path with a git HTTPS URI, e.g.
# https://github.com/openstack-k8s-operators/gitops/components/utilities/approve-installplan?ref=v0.3.1
# once that tag includes this component (same pattern as other example overlays).
- ../../components/dependencies/openstack-operator
- ../../components/utilities/approve-installplan
9 changes: 0 additions & 9 deletions example/openstack-operator/pin-version/kustomization.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions example/openstack-operator/pin-version/patch.yaml

This file was deleted.

Loading