Serverless

Introduction

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

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

Setup Operator CatalogSource

Create openshift-server

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

Create operator group

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

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

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):

YouTube

Test

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

and select “serverless deployment” as resource type

Upgrade

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

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