Skip to content

Commit

Permalink
SDCICD-1337: custom task to generate an olm bundle
Browse files Browse the repository at this point in the history
Add a new custom task to generate the OLM bundle from the provided input
directory. This generates the on-disk representation of an operator (a
bundle) including the CSV, CRDs, manifests, additional metadata and the
Dockerfile to be built. Once built, it can be submitted to a catalog and
deployed to a cluster.

```
operator-sdk generate bundle \
    --overwrite \
    --version 4.16.265-f15333d \
    --input-dir deploy/ \
    --package osd-example-operator-bundle
```

This is different from the traditional flow of an operator where the
bundle metadata and manifests are stored somewhere to be built from or
actively generated on new versions. SRE-P operators do not actively
version their operators or maintain an upgrade graph so this allows
dynamically generating a bundle at build time based on the current state
of the repository.

Signed-off-by: Brady Pratt <[email protected]>
  • Loading branch information
jbpratt committed Jul 22, 2024
1 parent 3118a13 commit 1e0536f
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
16 changes: 16 additions & 0 deletions task/operator-sdk-generate-bundle/0.1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# operator-sdk-generate-bundle task

Generate an OLM bundle using the operator-sdk

## Parameters
|name|description|default value|required|
|---|---|---|---|
|input-dir|Directory to read cluster-ready operator manifests from|deploy|false|
|channels|Comma-separated list of channels the bundle belongs to|alpha|false|
|version|Semantic version of the operator in the generated bundle||true|
|package-name|Bundle's package name||true|

## Workspaces
|name|description|optional|
|---|---|---|
|source|Workspace with the source code|false|
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: operator-sdk-generate-bundle
spec:
description: Generate an OLM bundle using the operator-sdk
params:
- name: input-dir
description: Directory to read cluster-ready operator manifests from
default: deploy
- name: channels
description: Comma-separated list of channels the bundle belongs to
default: alpha
- name: version
description: Semantic version of the operator in the generated bundle
- name: package-name
description: Bundle's package name
workspaces:
- name: source
description: Workspace with the source code
steps:
- name: operator-sdk-generate-bundle
image: "registry.redhat.io/openshift4/ose-operator-sdk-rhel9:v4.16"
workingDir: $(workspaces.source.path)/source
args:
- generate
- bundle
- --overwrite
- --channels
- $(params.channels)
- --input-dir
- $(params.input-dir)
- --version
- $(params.version)
- --package
- $(params.package-name)
6 changes: 6 additions & 0 deletions task/operator-sdk-generate-bundle/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
approvers:
- jbpratt
- gurnben
reviewers:
- jbpratt
- gurnben

0 comments on commit 1e0536f

Please sign in to comment.