diff --git a/Makefile b/Makefile index 2ddf0dd02..732765983 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ PROFILES := $(shell find config/manifests -mindepth 1 -maxdepth 1 -type d -exec # to use other config - add a directory with config, # use it as following commands: 'PROFILE= make test|integration-test|run|deploy|deployment-manifest' PROFILE ?= rhdh +OLM_VERSION ?= auto # Enable operator dynamic plugins processing (default: true) OPERATOR_DP_PROCESSING ?= true @@ -424,7 +425,7 @@ undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/. .PHONY: plugin-infra plugin-infra: @if [ -f "config/profile/$(PROFILE)/plugin-infra/plugin-infra.sh" ]; then \ - config/profile/$(PROFILE)/plugin-infra/plugin-infra.sh; \ + config/profile/$(PROFILE)/plugin-infra/plugin-infra.sh --olm-version $(OLM_VERSION); \ else \ echo "File config/profile/$(PROFILE)/plugin-infra/plugin-infra.sh does not exist."; \ fi @@ -432,7 +433,7 @@ plugin-infra: .PHONY: plugin-infra-undeploy plugin-infra-undeploy: @if [ -f "config/profile/$(PROFILE)/plugin-infra/plugin-infra.sh" ]; then \ - config/profile/$(PROFILE)/plugin-infra/plugin-infra.sh delete; \ + config/profile/$(PROFILE)/plugin-infra/plugin-infra.sh delete --olm-version $(OLM_VERSION); \ else \ echo "File config/profile/$(PROFILE)/plugin-infra/plugin-infra.sh does not exist."; \ fi diff --git a/config/profile/rhdh/plugin-infra/plugin-infra.sh b/config/profile/rhdh/plugin-infra/plugin-infra.sh index 88cb694a4..c6440adb5 100755 --- a/config/profile/rhdh/plugin-infra/plugin-infra.sh +++ b/config/profile/rhdh/plugin-infra/plugin-infra.sh @@ -8,6 +8,13 @@ set -euo pipefail action="apply" # Default action branch="main" # Default branch cicd=false # Default CICD mode +olm_version="auto" # Default OLM version (v0, v1, or auto-detect) +resolved_olm_version="" + +PLUGIN_INFRA_LABEL_VALUE="plugin-infra" +REDHAT_OPERATORS_CATALOG_LABEL="olm.operatorframework.io/metadata.name=openshift-redhat-operators" +SERVERLESS_OPERATOR_NAME="serverless-operator" +LOGIC_OPERATOR_NAME="logic-operator" # Parse command-line options while [[ $# -gt 0 ]]; do @@ -16,6 +23,10 @@ while [[ $# -gt 0 ]]; do cicd=true shift ;; + --olm-version) + olm_version="${2:?--olm-version requires v0, v1, or auto}" + shift 2 + ;; apply|delete) action="$1" shift @@ -31,28 +42,379 @@ while [[ $# -gt 0 ]]; do esac done +case "${olm_version}" in + v0|v1|auto) ;; + *) + echo "Unknown --olm-version value: ${olm_version}. Must be v0, v1, or auto." + exit 1 + ;; +esac + +script_dir="$(dirname "$(realpath "$0")")" + +kubectl_get() { + kubectl get "$@" 2>&1 +} + +resource_exists() { + local err exit_code + err="$(kubectl_get "$@" 2>&1)" + exit_code=$? + if [[ ${exit_code} -eq 0 ]]; then + return 0 + fi + if grep -qiE '(not found|NotFound)' <<<"${err}"; then + return 1 + fi + echo "${err}" >&2 + exit 1 +} + +crd_exists() { + resource_exists "crd/${1}" +} + +is_helm_managed() { + local api_resource="$1" + local name="$2" + local namespace="${3:-}" + local release_name + local args=("${api_resource}/${name}" -o "jsonpath={.metadata.annotations.meta\\.helm\\.sh/release-name}") + + if [[ -n "${namespace}" ]]; then + args=(-n "${namespace}" "${args[@]}") + fi + + release_name="$(kubectl get "${args[@]}" 2>/dev/null || true)" + [[ -n "${release_name}" ]] +} + +is_plugin_infra_managed() { + local api_resource="$1" + local name="$2" + local namespace="${3:-}" + local managed_by + local resource="${api_resource}/${name}" + + if [[ -n "${namespace}" ]]; then + managed_by="$(kubectl get -n "${namespace}" "${resource}" \ + -o jsonpath="{.metadata.labels.rhdh\.redhat\.com/managed-by}" 2>/dev/null || true)" + else + managed_by="$(kubectl get "${resource}" \ + -o jsonpath="{.metadata.labels.rhdh\.redhat\.com/managed-by}" 2>/dev/null || true)" + fi + + [[ "${managed_by}" == "${PLUGIN_INFRA_LABEL_VALUE}" ]] +} + +should_skip_resource_mutation() { + local api_resource="$1" + local name="$2" + local namespace="${3:-}" + + if ! resource_exists "${api_resource}/${name}" ${namespace:+-n "${namespace}"}; then + return 1 + fi + + if is_helm_managed "${api_resource}" "${name}" "${namespace}"; then + echo "Skipping ${api_resource}/${name}: managed by Helm" + return 0 + fi + + if is_plugin_infra_managed "${api_resource}" "${name}" "${namespace}"; then + return 1 + fi + + echo "Skipping ${api_resource}/${name}: not managed by plugin-infra" + return 0 +} + +detect_olm_v1_crd() { + crd_exists "clusterextensions.olm.operatorframework.io" +} + +detect_olm_v1_clustercatalog_crd() { + crd_exists "clustercatalogs.olm.operatorframework.io" +} + +detect_olm_v0_subscription_crd() { + crd_exists "subscriptions.operators.coreos.com" +} + +detect_olm_v0_operatorgroup_crd() { + crd_exists "operatorgroups.operators.coreos.com" +} + +has_v0_operators_installed() { + if ! detect_olm_v0_subscription_crd; then + return 1 + fi + + if resource_exists "subscription/${SERVERLESS_OPERATOR_NAME}" -n openshift-serverless 2>/dev/null; then + return 0 + fi + + if resource_exists "subscription/${LOGIC_OPERATOR_NAME}" -n openshift-serverless-logic 2>/dev/null; then + return 0 + fi + + return 1 +} + +redhat_operators_catalog_exists() { + local catalogs err exit_code + + catalogs="$(kubectl get clustercatalog -l "${REDHAT_OPERATORS_CATALOG_LABEL}" -o name 2>&1)" + exit_code=$? + if [[ ${exit_code} -eq 0 && -n "${catalogs}" ]]; then + return 0 + fi + if [[ ${exit_code} -ne 0 ]]; then + if grep -qiE '(not found|NotFound)' <<<"${catalogs}"; then + : + else + echo "${catalogs}" >&2 + exit 1 + fi + fi + + catalogs="$(kubectl get clustercatalog openshift-redhat-operators -o name 2>&1)" + exit_code=$? + if [[ ${exit_code} -eq 0 && -n "${catalogs}" ]]; then + return 0 + fi + if [[ ${exit_code} -ne 0 ]]; then + if grep -qiE '(not found|NotFound)' <<<"${catalogs}"; then + return 1 + fi + echo "${catalogs}" >&2 + exit 1 + fi + + return 1 +} + +verify_redhat_operators_catalog() { + if redhat_operators_catalog_exists; then + return 0 + fi + + echo "OLM v1 requires a ClusterCatalog labeled ${REDHAT_OPERATORS_CATALOG_LABEL}." + echo "On OpenShift this catalog is platform-provided; it is not created by plugin-infra.sh." + exit 1 +} + +resolve_olm_version() { + if [[ "${olm_version}" == "v0" ]]; then + resolved_olm_version="v0" + echo "Using OLM v0 (forced via --olm-version)" + return + fi + + if [[ "${olm_version}" == "v1" ]]; then + if ! detect_olm_v1_crd; then + echo "OLM v1 requested but ClusterExtension CRD not found on this cluster" + exit 1 + fi + if ! detect_olm_v1_clustercatalog_crd; then + echo "OLM v1 requested but ClusterCatalog CRD not found on this cluster" + exit 1 + fi + verify_redhat_operators_catalog + resolved_olm_version="v1" + echo "Using OLM v1 (forced via --olm-version)" + return + fi + + if detect_olm_v1_crd && detect_olm_v1_clustercatalog_crd; then + if redhat_operators_catalog_exists; then + # Check if operators are already installed via v0 + if has_v0_operators_installed; then + resolved_olm_version="v0" + echo "Auto-detected OLM v0 (operators already installed via v0 Subscriptions)" + echo " Note: To migrate to OLM v1, first run 'plugin-infra.sh delete' to remove v0 installations" + else + resolved_olm_version="v1" + echo "Auto-detected OLM v1 (ClusterExtension and ClusterCatalog CRDs found)" + fi + else + resolved_olm_version="v0" + echo "Auto-detected OLM v0 (openshift-redhat-operators ClusterCatalog not found)" + fi + else + resolved_olm_version="v0" + echo "Auto-detected OLM v0 (OLM v1 CRDs not found)" + fi +} + apply_manifest() { local file="$1" local url="https://raw.githubusercontent.com/redhat-developer/rhdh-operator/${branch}/config/profile/rhdh/plugin-infra/${file}" - local script_dir - script_dir="$(dirname "$(realpath "$0")")" + local path="${script_dir}/${file}" - if [[ -f "${script_dir}/${file}" ]]; then + if [[ -f "${path}" ]]; then echo "Using local file: ${file}" - kubectl "$action" -f "${script_dir}/${file}" + kubectl "$action" -f "${path}" else echo "Local file not found. Fetching from URL: ${url}" curl -s "$url" | kubectl "$action" -f - fi } +apply_v1_operator_manifest() { + local file="$1" + local extension_name="$2" + + if should_skip_resource_mutation clusterextension "${extension_name}"; then + return 0 + fi + + apply_manifest "${file}" +} + +delete_plugin_infra_v0_operator() { + local namespace="$1" + local operatorgroup_name="$2" + local subscription_name="$3" + + if detect_olm_v0_subscription_crd; then + if ! should_skip_resource_mutation subscription "${subscription_name}" "${namespace}"; then + kubectl delete "subscription/${subscription_name}" -n "${namespace}" --ignore-not-found + fi + fi + + if detect_olm_v0_operatorgroup_crd; then + if ! should_skip_resource_mutation operatorgroup "${operatorgroup_name}" "${namespace}"; then + kubectl delete "operatorgroup/${operatorgroup_name}" -n "${namespace}" --ignore-not-found + fi + fi + + if ! should_skip_resource_mutation namespace "${namespace}"; then + kubectl delete "namespace/${namespace}" --ignore-not-found + fi +} + +wait_for_clusterextension() { + local name="$1" + echo "Waiting for ClusterExtension/${name} to be Installed..." + kubectl wait "clusterextension/${name}" --for=condition=Installed --timeout=300s +} + +wait_for_clusterextension_if_relevant() { + local name="$1" + + if ! resource_exists "clusterextension/${name}"; then + return 0 + fi + + if is_helm_managed clusterextension "${name}"; then + echo "ClusterExtension/${name} is managed by Helm; skipping wait" + return 0 + fi + + wait_for_clusterextension "${name}" +} + +wait_for_clusterextension_deleted() { + local name="$1" + local timeout="${2:-300}" + + if ! detect_olm_v1_crd; then + return 0 + fi + + if ! resource_exists "clusterextension/${name}"; then + return 0 + fi + + echo "Waiting for ClusterExtension/${name} to be removed..." + kubectl wait --for=delete "clusterextension/${name}" --timeout="${timeout}s" +} + +delete_plugin_infra_v1_operator() { + local extension_name="$1" + local namespace="$2" + local sa_name="$3" + local crb_name="$4" + + if detect_olm_v1_crd; then + if resource_exists "clusterextension/${extension_name}"; then + if should_skip_resource_mutation clusterextension "${extension_name}"; then + : + else + kubectl delete "clusterextension/${extension_name}" --ignore-not-found + wait_for_clusterextension_deleted "${extension_name}" + fi + fi + fi + + if ! should_skip_resource_mutation serviceaccount "${sa_name}" "${namespace}"; then + kubectl delete "serviceaccount/${sa_name}" -n "${namespace}" --ignore-not-found + fi + + if ! should_skip_resource_mutation clusterrolebinding "${crb_name}"; then + kubectl delete "clusterrolebinding/${crb_name}" --ignore-not-found + fi + + if ! should_skip_resource_mutation namespace "${namespace}"; then + kubectl delete "namespace/${namespace}" --ignore-not-found + fi +} + +delete_orchestrator_v1_operators() { + delete_plugin_infra_v1_operator \ + "${LOGIC_OPERATOR_NAME}" \ + "openshift-serverless-logic" \ + "serverless-logic-operator-installer" \ + "logic-operator-installer-binding" + delete_plugin_infra_v1_operator \ + "${SERVERLESS_OPERATOR_NAME}" \ + "openshift-serverless" \ + "serverless-operator-installer" \ + "serverless-operator-installer-binding" +} + +delete_orchestrator_v0_operators() { + delete_plugin_infra_v0_operator \ + "openshift-serverless-logic" \ + "openshift-serverless-logic" \ + "${LOGIC_OPERATOR_NAME}" + delete_plugin_infra_v0_operator \ + "openshift-serverless" \ + "serverless-operator-group" \ + "${SERVERLESS_OPERATOR_NAME}" +} + +resolve_olm_version + +if [[ "${resolved_olm_version}" == "v1" ]]; then + serverless_manifest="serverless-v1.yaml" + serverless_logic_manifest="serverless-logic-v1.yaml" +else + serverless_manifest="serverless.yaml" + serverless_logic_manifest="serverless-logic.yaml" +fi + # Execution if [[ "$action" == "apply" ]]; then - apply_manifest "serverless.yaml" + if [[ "${resolved_olm_version}" == "v1" ]]; then + apply_v1_operator_manifest "${serverless_manifest}" "${SERVERLESS_OPERATOR_NAME}" + wait_for_clusterextension_if_relevant "${SERVERLESS_OPERATOR_NAME}" + else + apply_manifest "${serverless_manifest}" + fi + echo "Waiting for CRDs to be established..." kubectl wait --for=condition=Established crd --all --timeout=60s apply_manifest "knative.yaml" - apply_manifest "serverless-logic.yaml" + + if [[ "${resolved_olm_version}" == "v1" ]]; then + apply_v1_operator_manifest "${serverless_logic_manifest}" "${LOGIC_OPERATOR_NAME}" + wait_for_clusterextension_if_relevant "${LOGIC_OPERATOR_NAME}" + else + apply_manifest "${serverless_logic_manifest}" + fi + if [[ "$cicd" == true ]]; then echo "CICD enabled. Executing CICD-specific logic..." apply_manifest "argocd.yaml" @@ -61,9 +423,9 @@ if [[ "$action" == "apply" ]]; then apply_manifest "pipeline.yaml" fi elif [[ "$action" == "delete" ]]; then - apply_manifest "serverless-logic.yaml" + delete_orchestrator_v1_operators apply_manifest "knative.yaml" - apply_manifest "serverless.yaml" + delete_orchestrator_v0_operators if [[ "$cicd" == true ]]; then apply_manifest "argocd.yaml" apply_manifest "argocd-cr.yaml" @@ -73,4 +435,3 @@ else echo "Action '$action' is not supported. Use 'apply' (default) or 'delete'." exit 1 fi - diff --git a/config/profile/rhdh/plugin-infra/serverless-logic-v1.yaml b/config/profile/rhdh/plugin-infra/serverless-logic-v1.yaml new file mode 100644 index 000000000..7e0540e5a --- /dev/null +++ b/config/profile/rhdh/plugin-infra/serverless-logic-v1.yaml @@ -0,0 +1,51 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: openshift-serverless-logic + labels: + rhdh.redhat.com/managed-by: plugin-infra +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: serverless-logic-operator-installer + namespace: openshift-serverless-logic + labels: + rhdh.redhat.com/managed-by: plugin-infra +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: logic-operator-installer-binding + labels: + rhdh.redhat.com/managed-by: plugin-infra +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-admin +subjects: + - kind: ServiceAccount + name: serverless-logic-operator-installer + namespace: openshift-serverless-logic +--- +apiVersion: olm.operatorframework.io/v1 +kind: ClusterExtension +metadata: + name: logic-operator + labels: + rhdh.redhat.com/managed-by: plugin-infra +spec: + namespace: openshift-serverless-logic + serviceAccount: + name: serverless-logic-operator-installer + source: + sourceType: Catalog + catalog: + packageName: logic-operator + channels: + - stable + version: "1.38.0" + selector: + matchLabels: + olm.operatorframework.io/metadata.name: openshift-redhat-operators + upgradeConstraintPolicy: CatalogProvided diff --git a/config/profile/rhdh/plugin-infra/serverless-logic.yaml b/config/profile/rhdh/plugin-infra/serverless-logic.yaml index c6e03683a..b1d78e9b3 100644 --- a/config/profile/rhdh/plugin-infra/serverless-logic.yaml +++ b/config/profile/rhdh/plugin-infra/serverless-logic.yaml @@ -2,12 +2,16 @@ apiVersion: v1 kind: Namespace metadata: name: openshift-serverless-logic + labels: + rhdh.redhat.com/managed-by: plugin-infra --- apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: openshift-serverless-logic namespace: openshift-serverless-logic + labels: + rhdh.redhat.com/managed-by: plugin-infra spec: --- apiVersion: operators.coreos.com/v1alpha1 @@ -15,6 +19,8 @@ kind: Subscription metadata: name: logic-operator namespace: openshift-serverless-logic + labels: + rhdh.redhat.com/managed-by: plugin-infra spec: channel: stable # channel of an operator package to subscribe to installPlanApproval: Automatic # whether the update should be installed automatically diff --git a/config/profile/rhdh/plugin-infra/serverless-v1.yaml b/config/profile/rhdh/plugin-infra/serverless-v1.yaml new file mode 100644 index 000000000..9233b0edb --- /dev/null +++ b/config/profile/rhdh/plugin-infra/serverless-v1.yaml @@ -0,0 +1,50 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: openshift-serverless + labels: + rhdh.redhat.com/managed-by: plugin-infra +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: serverless-operator-installer + namespace: openshift-serverless + labels: + rhdh.redhat.com/managed-by: plugin-infra +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: serverless-operator-installer-binding + labels: + rhdh.redhat.com/managed-by: plugin-infra +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-admin +subjects: + - kind: ServiceAccount + name: serverless-operator-installer + namespace: openshift-serverless +--- +apiVersion: olm.operatorframework.io/v1 +kind: ClusterExtension +metadata: + name: serverless-operator + labels: + rhdh.redhat.com/managed-by: plugin-infra +spec: + namespace: openshift-serverless + serviceAccount: + name: serverless-operator-installer + source: + sourceType: Catalog + catalog: + packageName: serverless-operator + channels: + - stable + selector: + matchLabels: + olm.operatorframework.io/metadata.name: openshift-redhat-operators + upgradeConstraintPolicy: CatalogProvided diff --git a/config/profile/rhdh/plugin-infra/serverless.yaml b/config/profile/rhdh/plugin-infra/serverless.yaml index fb49e4216..60e4eda2e 100644 --- a/config/profile/rhdh/plugin-infra/serverless.yaml +++ b/config/profile/rhdh/plugin-infra/serverless.yaml @@ -2,12 +2,16 @@ apiVersion: v1 kind: Namespace metadata: name: openshift-serverless + labels: + rhdh.redhat.com/managed-by: plugin-infra --- apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: serverless-operator-group namespace: openshift-serverless + labels: + rhdh.redhat.com/managed-by: plugin-infra spec: --- apiVersion: operators.coreos.com/v1alpha1 @@ -15,9 +19,11 @@ kind: Subscription metadata: name: serverless-operator namespace: openshift-serverless + labels: + rhdh.redhat.com/managed-by: plugin-infra spec: channel: stable installPlanApproval: Automatic name: serverless-operator source: redhat-operators - sourceNamespace: openshift-marketplace \ No newline at end of file + sourceNamespace: openshift-marketplace diff --git a/docs/developer.md b/docs/developer.md index c963e565d..ac6489075 100644 --- a/docs/developer.md +++ b/docs/developer.md @@ -124,9 +124,16 @@ make undeploy In a case if Profile contain plugin infrastructure manifests `/config/profile//plugin-infra` it can be deployed by: ```sh -make plugin-infra [PROFILE=] +make plugin-infra [PROFILE=] [OLM_VERSION=auto|v0|v1] ``` +To remove plugin infrastructure installed by the same script: +```sh +make plugin-infra-undeploy [PROFILE=] [OLM_VERSION=auto|v0|v1] +``` + +`OLM_VERSION` is forwarded to `plugin-infra.sh` as `--olm-version`. See [orchestrator guide](orchestrator.md#rhdh-helper-script) for details on OLM v0 vs v1 manifest selection. + **UnDeploy the controller from the cluster:** ```sh diff --git a/docs/orchestrator-cicd.md b/docs/orchestrator-cicd.md index 4bdbba86b..633638c73 100644 --- a/docs/orchestrator-cicd.md +++ b/docs/orchestrator-cicd.md @@ -11,7 +11,7 @@ There are three methods to install GitOps/Pipelines Operator ### Method 1: Install the Operators using Scripts Refer to the `RHDH helper script` section in [orchestrator guide](orchestrator.md) and set the `--with-cicd` flag to -true when running the script. +true when running the script. GitOps and Pipelines are installed via OLM v0 Subscriptions; only OpenShift Serverless and Serverless Logic follow the script's OLM version selection (`--olm-version` or auto-detect). ### Method 2: Install the Operators from Demo Charts diff --git a/docs/orchestrator.md b/docs/orchestrator.md index ad53288c2..1346ddde6 100644 --- a/docs/orchestrator.md +++ b/docs/orchestrator.md @@ -51,14 +51,30 @@ This script provides a quick way to install the OpenShift Serverless infrastruct You can specify the RHDH version in the URL (`/release-X.Y/`, e.g., `1.7` in this example) or use main. 2. Run the script: ```bash - bash plugin-infra.sh [--with-cicd] [delete] [--branch ] + bash plugin-infra.sh [--with-cicd] [delete] [--branch ] [--olm-version auto|v0|v1] ``` Flags: -* `--with-cicd` flag will also install the OpenShift Pipelines Operator (Tekton) and OpenShift GitOps Operator (ArgoCD) in addition to the required components for the Orchestrator plugin. To continue the configuration for CICD, please follow this [guide](orchestrator-cicd.md). -* `delete` will delete the installed components instead of installing them. +* `--with-cicd` flag will also install the OpenShift Pipelines Operator (Tekton) and OpenShift GitOps Operator (ArgoCD) in addition to the required components for the Orchestrator plugin. To continue the configuration for CICD, please follow this [guide](orchestrator-cicd.md). GitOps and Pipelines are still installed via OLM v0 Subscriptions even when Serverless and Serverless Logic use OLM v1. +* `delete` will delete the installed components instead of installing them. Delete removes OLM v1 ClusterExtensions first, then Knative CRs, then OLM v0 Subscriptions when present. Resources managed by Helm or not labeled by the script are skipped. * `--branch ` flag allows to specify the branch of the RHDH Operator repository where the configuration yaml files will be taken (ignored if you have local yaml files). If not specified, it defaults to the `main` branch. +* `--olm-version` selects the OLM API used for OpenShift Serverless and Serverless Logic (`auto`, `v0`, or `v1`; default `auto`). In `auto` mode the script uses OLM v1 when ClusterExtension and ClusterCatalog CRDs exist and a platform `ClusterCatalog` labeled `openshift-redhat-operators` is present; otherwise it uses OLM v0 Subscriptions. -The script is checking if the directory where plugin-infra.sh is located contains the corresponding configuration files, e.g., serverless.yaml, knative.yaml, serverless-logic.yaml... (see [plugin-infra directory](../config/profile/rhdh/plugin-infra) for the complete list). If the files are not found, it will download them from the specified branch of the RHDH Operator repository. +The script checks whether the directory where `plugin-infra.sh` is located contains the corresponding configuration files (see [plugin-infra directory](../config/profile/rhdh/plugin-infra) for the complete list). If the files are not found, it downloads them from the specified branch of the RHDH Operator repository. + +Manifest files for orchestrator operators: + +| OLM version | Serverless | Serverless Logic | +|-------------|------------|------------------| +| v0 | `serverless.yaml` | `serverless-logic.yaml` | +| v1 | `serverless-v1.yaml` | `serverless-logic-v1.yaml` | + +Both paths apply `knative.yaml` after the Serverless operator CRDs are available. OLM v1 manifests use `ClusterExtension` resources and require the platform Red Hat Operators `ClusterCatalog`; they are not created by this script. + +Example: force the legacy Subscription path on a cluster that also has OLM v1: + +```bash +bash plugin-infra.sh --olm-version v0 +``` #### RHDH Orchestrator Infra Helm Chart This method has similar usage and cautions as the RHDH Helper Utility.