diff --git a/operatorhub/README.md b/operatorhub/README.md new file mode 100644 index 0000000..6f45a9b --- /dev/null +++ b/operatorhub/README.md @@ -0,0 +1,11 @@ +# OperatorHub + +The below templates are used to deploy Operators from OperatorHub without having to interact with the WebUI. + +To do this you would create the following in order: + +1. [OperatorGroup](operatorgroup.yml) +1. [CatalogSourceConfig](catalogsourceconfig.yml) +1. [Subscription](subscription.yml) + +For more details, you can see the documention [here](https://docs.openshift.com/container-platform/4.1/applications/operators/olm-adding-operators-to-cluster.html#olm-installing-operator-from-operatorhub-using-cli_olm-adding-operators-to-a-cluster). diff --git a/operatorhub/catalogsourceconfig.yml b/operatorhub/catalogsourceconfig.yml new file mode 100644 index 0000000..417201c --- /dev/null +++ b/operatorhub/catalogsourceconfig.yml @@ -0,0 +1,25 @@ +--- +apiVersion: v1 +kind: Template +message: |- + The following CatalogSourceConfig has been created: ${NAME} +metadata: + name: catalogsourceconfig-template +objects: +- apiVersion: operators.coreos.com/v1 + kind: CatalogSourceConfig + metadata: + name: ${NAME} + spec: + packages: "${OPERATORS}" + targetNamespace: "${OPERATOR_NAMESPACE}" +parameters: +- name: NAME + required: true + description: Name of the CatalogSourceConfig to create +- name: OPERATOR_NAMESPACE + value: openshift-operators + description: Namespace where you want the operator to be available +- name: OPERATORS + required: true + description: a single or comma-seperated list of operators which you want to subscribe to diff --git a/operatorhub/operatorgroup.yml b/operatorhub/operatorgroup.yml new file mode 100644 index 0000000..5ebe42f --- /dev/null +++ b/operatorhub/operatorgroup.yml @@ -0,0 +1,22 @@ +--- +apiVersion: v1 +kind: Template +message: |- + The following OperatorGroup has been created: ${NAME} +metadata: + name: operatorgroup-template +objects: +- apiVersion: operators.coreos.com/v1 + kind: OperatorGroup + metadata: + name: ${NAME} + spec: + targetNamespaces: + - ${TARGET_NAMESPACE} +parameters: +- name: NAME + required: true + description: Name of the OperatorGroup to create +- name: TARGET_NAMESPACE + required: true + description: A namespace for the OperatorGroup to target diff --git a/operatorhub/subscription.yml b/operatorhub/subscription.yml new file mode 100644 index 0000000..4e79dbb --- /dev/null +++ b/operatorhub/subscription.yml @@ -0,0 +1,37 @@ +--- +apiVersion: v1 +kind: Template +message: |- + The following subscription has been created: ${NAME} +metadata: + name: subscription-template +objects: +- apiVersion: operators.coreos.com/v1alpha1 + kind: Subscription + metadata: + name: "${NAME}" + spec: + channel: "${CHANNEL}" + installPlanApproval: ${INSTALL_PLAN} + name: ${OPERATOR_NAME} + source: ${CATALOG_SOURCE_NAME} + sourceNamespace: ${OPERATOR_NAMESPACE} +parameters: +- name: NAME + required: true + description: Name of the subscription you would like to create +- name: OPERATOR_NAME + required: true + description: Name of the operator you would like to subscribe to +- name: OPERATOR_NAMESPACE + value: openshift-operators + description: Namespace where the operator is running +- name: CHANNEL + value: preview + description: Name of the channel that you are subscribing to +- name: INSTALL_PLAN + value: Automatic + description: Install plan that you would like to use (Automatic or Manual) +- name: CATALOG_SOURCE_NAME + required: true + description: Name of the catalog source item that was created