Skip to content

Commit

Permalink
salt: install operatorhubio catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
eg-ayoub committed Dec 23, 2024
1 parent b84fa43 commit 2f0a6fd
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
3 changes: 3 additions & 0 deletions buildchain/buildchain/salt_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ def task(self) -> types.TaskDict:
file_dep=[METALK8S_OPERATOR_MANIFESTS],
),
Path("salt/metalk8s/addons/metalk8s-operator/deployed/init.sls"),
Path("salt/metalk8s/addons/olm/catalog/deployed/cluster-catalog.sls"),
Path("salt/metalk8s/addons/olm/catalog/deployed/init.sls"),
Path("salt/metalk8s/addons/olm/catalogd/deployed/catalogd.sls"),
Path("salt/metalk8s/addons/olm/catalogd/deployed/cert.sls"),
Path("salt/metalk8s/addons/olm/catalogd/deployed/crds.sls"),
Expand Down Expand Up @@ -696,6 +698,7 @@ def task(self) -> types.TaskDict:
Path("salt/_modules/metalk8s_kubernetes_utils.py"),
Path("salt/_modules/metalk8s_monitoring.py"),
Path("salt/_modules/metalk8s_network.py"),
Path("salt/_modules/metalk8s_olm.py"),
Path("salt/_modules/metalk8s_os.py"),
Path("salt/_modules/metalk8s_package_manager_yum.py"),
Path("salt/_modules/metalk8s_service_configuration.py"),
Expand Down
17 changes: 17 additions & 0 deletions salt/_modules/metalk8s_olm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Interacts with OLMv1 CRs"""

__virtualname__ = "metalk8s_olm"


def __virtual__():
return __virtualname__


def check_clustercatalog_serving(name: str):
catalog = __salt__["metalk8s_kubernetes.get_object"](
kind="ClusterCatalog", apiVersion="olm.operatorframework.io/v1", name=name
)
for cond in catalog["status"]["conditions"]:
if cond["type"] == "Serving":
return cond["status"] == "True"
return False
12 changes: 12 additions & 0 deletions salt/metalk8s/addons/olm/catalog/deployed/cluster-catalog.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!jinja | metalk8s_kubernetes

apiVersion: olm.operatorframework.io/v1
kind: ClusterCatalog
metadata:
name: operatorhubio
spec:
source:
type: Image
image:
ref: quay.io/operatorhubio/catalog:latest
pollIntervalMinutes: 10
14 changes: 14 additions & 0 deletions salt/metalk8s/addons/olm/catalog/deployed/init.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
include:
- ...operator-controller.deployed
- .cluster-catalog

Wait for Cluster Catalog to be Serving:
test.configurable_test_state:
- changes: False
- result: __slot__:salt:metalk8s_olm.check_catalogsource_serving(name=operatorhubio)
- comment: Wait for ClusterCatalog to be Ready
- retry:
attempts: 30
- require:
- test: Wait for the Operator Controller Controller Manager Deployment to be Ready
- sls: metalk8s.addons.olm.catalog.deployed.cluster-catalog
1 change: 1 addition & 0 deletions salt/metalk8s/deployed/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include:
- metalk8s.addons.cert-manager.deployed
- metalk8s.addons.olm.catalogd.deployed
- metalk8s.addons.olm.operator-controller.deployed
- metalk8s.addons.olm.catalog.deployed
- metalk8s.addons.nginx-ingress.deployed
- metalk8s.addons.nginx-ingress-control-plane.deployed
- metalk8s.addons.volumes.deployed
Expand Down

0 comments on commit 2f0a6fd

Please sign in to comment.