# Serverless

# Introduction

In this page, we’re going to install RedHat Serverless Operator from source.


:::warning
This “tutorial” is only tested by my self on ODK.

:::

# Setup Operator CatalogSource

## Create openshift-server

```bash
cat <<EOF | oc apply -f -
apiVersion: v1
kind: Namespace
metadata:
  name: openshift-serverless
EOF
```

## Create operator group

```bash
cat <<EOF | oc apply -f -
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: serverless
  namespace: openshift-serverless
EOF
```

## Create catalog source for each version

```bash
cat <<EOF | oc apply -f -
# CatalogSource for 1.26
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  # Replace the version with whatever version you want to install
  name: serverless-operator-v1-26-0
  namespace: openshift-marketplace
spec:
  displayName: Serverless Operator
  # Replace the version with whatever version you want to install
  image: registry.ci.openshift.org/knative/openshift-serverless-v1.26.0:serverless-index
  publisher: Red Hat
  sourceType: grpc
---
# CatalogSource for 1.27
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  # Replace the version with whatever version you want to install
  name: serverless-operator-v1-27-0
  namespace: openshift-marketplace
spec:
  displayName: Serverless Operator
  # Replace the version with whatever version you want to install
  image: registry.ci.openshift.org/knative/openshift-serverless-v1.27.0:serverless-index
  publisher: Red Hat
  sourceType: grpc
---
# CatalogSource for main (in development, unstable)
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  # Replace the version with whatever version you want to install
  name: serverless-operator-nightly
  namespace: openshift-marketplace
spec:
  displayName: Serverless Operator
  # Replace the version with whatever version you want to install
  image: registry.ci.openshift.org/knative/openshift-serverless-nightly:serverless-index
  publisher: Red Hat
  sourceType: grpc
EOF
```

# Installation

```bash
cat <<EOF | oc apply -f -
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: serverless-operator
  namespace: openshift-serverless
spec:
  channel: stable
  name: serverless-operator
  # Change the CatalogSource name
  source: serverless-operator-v1-27-0
  sourceNamespace: openshift-marketplace
  installPlanApproval: Automatic
EOF
```

To finish the installation (start 1m20s): 

[https://www.youtube.com/watch?v=h9F6ynUQHaU](https://www.youtube.com/watch?v=h9F6ynUQHaU)

## Test

You can test with this repo: <https://github.com/ungarscool1/nodejs-hello-world.git>

and select “serverless deployment” as resource type

# Upgrade

```bash
cat <<EOF | oc apply -f -
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: serverless-operator
  namespace: openshift-serverless
spec:
  channel: stable
  name: serverless-operator
  # Change the CatalogSource name
  source: serverless-operator-v1-28-0
  sourceNamespace: openshift-marketplace
  installPlanApproval: Automatic
EOF
```

# Downgrade


:::warning
We don’t provide downgrade procedure due to lack of compatibility

:::

Refer to this: <https://github.com/openshift-knative/serverless-operator/blob/main/docs/install-midstream.md#downgrade>

---

**Documents**

- [AS205126](https://docs.legodard.fr/s/bc661677-ac7d-4fe7-984e-e1f43ddf6287/doc/as205126-UD37o91h51)
- [Kubernetes](https://docs.legodard.fr/s/bc661677-ac7d-4fe7-984e-e1f43ddf6287/doc/kubernetes-AYsNjQV7SW)
- [Proxmox](https://docs.legodard.fr/s/bc661677-ac7d-4fe7-984e-e1f43ddf6287/doc/proxmox-TnNEgoRFwj)
- [DN42](https://docs.legodard.fr/s/bc661677-ac7d-4fe7-984e-e1f43ddf6287/doc/dn42-oTEE68Qn7n)
- [Openshift](https://docs.legodard.fr/s/bc661677-ac7d-4fe7-984e-e1f43ddf6287/doc/openshift-428FG3kMtg)
- [Openstack](https://docs.legodard.fr/s/bc661677-ac7d-4fe7-984e-e1f43ddf6287/doc/openstack-KJmz0J0klm)