Skip to content

Commit

Permalink
Add docs and sample generated bundle
Browse files Browse the repository at this point in the history
Add a generated bundle for kubernetes platform.

Add docs on the bundle generation tool and on bundle geration for
kubernetes.

Signed-off-by: Nikhil Thomas <[email protected]>
  • Loading branch information
nikhil-thomas committed Sep 1, 2021
1 parent 9429adc commit 32edae6
Show file tree
Hide file tree
Showing 40 changed files with 284 additions and 1,510 deletions.
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,31 @@ on any Kubernetes Cluster.
$ kubectl apply -f https://raw.githubusercontent.com/tektoncd/operator/main/config/crs/kubernetes/config/all/operator_v1alpha1_config_cr.yaml
```

# References
# Detailed Documentation

- [Development Guide](docs/README.md)
- [Testing Guide](test/README.md)
[Concepts and Guides](docs/README.md)

### Read the docs
# Development Guide

[Development Guide](docs/README.md)

# Running E2E tests

[Testing Guide](test/README.md)

# Release Guide

[How to make a TektonCD/Operator Release](tekton/README.md)

# Gerating OperatorHub Bundle(s)

[OperatorHub Bundles](operatorhub/README.md)

# Roadmap

[Roadmap](./ROADMAP.md)

# Read the docs

| Version | Docs |
| ------- | ---- |
Expand Down
3 changes: 2 additions & 1 deletion config/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ resources:
- role_binding.yaml
- operator.yaml
- webhook.yaml
- webhook-service.yaml
- webhook-service.yaml
- scorecard
2 changes: 0 additions & 2 deletions config/base/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ metadata:
version: "devel"
operator.tekton.dev/release: "devel"
spec: {}
- name: METRICS_DOMAIN
value: tekton.dev/operator
11 changes: 11 additions & 0 deletions config/base/scorecard/bases/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
# Required for bundle generation to work.
# TODO: add scorecard tests plugins.
# eg: https://github.com/operator-framework/operator-sdk/tree/master/testdata/go/v3/memcached-operator/config/scorecard
apiVersion: scorecard.operatorframework.io/v1alpha3
kind: Configuration
metadata:
name: config
stages:
- parallel: true
tests: []
2 changes: 2 additions & 0 deletions config/base/scorecard/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- bases/config.yaml
2 changes: 0 additions & 2 deletions config/base/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ metadata:
version: "devel"
operator.tekton.dev/release: "devel"
spec: {}
- name: METRICS_DOMAIN
value: tekton.dev/operator
2 changes: 2 additions & 0 deletions config/kubernetes/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ spec:
value: ko://github.com/tektoncd/operator/cmd/kubernetes/proxy-webhook
- name: IMAGE_JOB_PRUNER_TKN
value: gcr.io/tekton-releases/dogfooding/tkn@sha256:f69a02ef099d8915e9e4ea1b74e43b7a9309fc97cf23cb457ebf191e73491677
- name: METRICS_DOMAIN
value: tekton.dev/operator
2 changes: 2 additions & 0 deletions config/kubernetes/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ spec:
value: tekton-operator-webhook
- name: WEBHOOK_SECRET_NAME
value: tekton-operator-webhook-certs
- name: METRICS_DOMAIN
value: tekton.dev/operator
ports:
- name: https-webhook
containerPort: 8443
2 changes: 2 additions & 0 deletions config/openshift/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ spec:
value: ko://github.com/tektoncd/operator/cmd/openshift/proxy-webhook
- name: IMAGE_JOB_PRUNER_TKN
value: gcr.io/tekton-releases/dogfooding/tkn@sha256:f69a02ef099d8915e9e4ea1b74e43b7a9309fc97cf23cb457ebf191e73491677
- name: METRICS_DOMAIN
value: tekton.dev/operator
# - name: IMAGE_ADDONS_PARAM_TKN_IMAGE
# value: gcr.io/tekton-releases/dogfooding/tkn@sha256:f69a02ef099d8915e9e4ea1b74e43b7a9309fc97cf23cb457ebf191e73491677
2 changes: 2 additions & 0 deletions config/openshift/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ spec:
value: tekton-operator-webhook
- name: WEBHOOK_SECRET_NAME
value: tekton-operator-webhook-certs
- name: METRICS_DOMAIN
value: tekton.dev/operator
ports:
- name: https-webhook
containerPort: 8443
65 changes: 62 additions & 3 deletions operatorhub/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,68 @@
# Generating Bundles (release artifact) for OperatorHub

1. From project root run:
We can use [bundle.py](./tools/bundle.py) tool to generate operator bundles. The tool takes in
a list of Kubernetes resource definitions (Deployment, Role, Rolebinding, ConfigMaps ...) and
some metadata (bundle description, release channels, bundle icon graphic... ) and outputs operator bundle.

## Quick Links

1. [Generating Operator Bundle for Kubernetes](./kubernetes/README.md)
1. [Generating Operator Bundle for OpenShift](./openshift/README.md)

## Concepts

### Bundle Generation "Strategies"

The bundle generation strategy specifies how the tool accumulates input (list of kubernetes resources).
Two strategies are supported:

1. **release-manifest**: input files are collected from a pre-existing release.yaml file. This release.yaml
could be from an already existing github release or from the result of `ko resolve cofig`.

2. **local:** All input files are gathered in realtime from local repository extensive usage of `kustomize`.

### Update Strategies

An update strategy defines the update relations of the current bundle with the previous releases (bundles).
The bundle generation tool supports 2 update strategies.

1. **semver**: OLM will upgrade opertor to a bundle with higher semver version, in the current subscription channel
2. **replaces**: OLM will follow explict `spec.replaces: <previous version>` filed specification

more details: [semver-mode, replaces mode](https://k8s-operatorhub.github.io/community-operators/packaging-operator/)


## Conventions

The tool expects the following directory structure and a config.yaml for each platform.

```bash
export BUNDLE_ARGS="--workspace=operatorhub/kubernetes --operator-release-version=1.1.1 --channels=a,b --default-channel=a --fetch-strategy-local --upgrade-strategy-semver"
make bundle
kubernetes
├── config.yaml
├── manifests
│ ├── bases
│ │ └── tektoncd-operator.clusterserviceversion.template.yaml
│ ├── fetch-strategy-local
│ │ └── kustomization.yaml
│ └── fetch-strategy-release-manifest
│ └── kustomization.yaml
```

## CLI flags

[bundle.py cli flags](./tools/bundle-too-cli-flags.md)

## Specifying Image Overrides using config.yaml

[bunele generation config.yaml](./tools/CONFIG-DEFINITION.md)

## Operator LifeCycle Manager Concepts

- [Operator Bundle](https://operator-sdk.netlify.app/docs/olm-integration/quickstart-bundle/)
- [ClusterServiceVersion CRD](https://olm.operatorframework.io/docs/concepts/crds/clusterserviceversion/)

# References

2. [Operator Lifecycle Manager (OLM) Documentation](https://olm.operatorframework.io/docs/)
3. [Operator SDK OLM Integration Documentation](https://operator-sdk.netlify.app/docs/olm-integration/)
4. [OperatorHub (Community Operators) Documentation](https://k8s-operatorhub.github.io/community-operators/packaging-operator/)
34 changes: 34 additions & 0 deletions operatorhub/kubernetes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# How to generate Operator Bundles for OpenShift

For Kubernetes Platform ([operatorhub.io](https://operatorhub.io)) release we generate the
bundle for using `release-manifest` strategy.

## Steps to generate bundles from an existing release.yaml

**Note:** The input release.yaml could be a github release or the result of `ko resolve config`

1. Make sure that we have the release manifest file ready
eg:
```bash
curl -L -o tektoncd-operaotr-0.49.0 https://github.com/tektoncd/operator/releases/download/v0.49.0/release.notags.yaml
```

2. From the project root (tektoncd/operator) run

```bash
export BUNDLE_ARGS='--workspace operatorhub/kubernetes --operator-release-version 0.49.0 --channels alpha --default-channel alpha --fetch-strategy-release-manifest --release-manifest tektoncd-operaotr-0.49.0 --upgrade-strategy-semver'
make operator-bundle
```

**CLI flags explained**

Flag | Description
--------------------------------------------- | -----------
`--workspace operatorhub/kubernetes` | the working directory where the operator bundle should be assembled
`--operator-release-version 0.49.0` | version of the release (version of bundle)
`--channels alpha` | target release channel(s) (eg: stabe,preview)
`--default-channel alpha` | set default channel of the operator
`--fetch-strategy-release-manifest` | gather input kubernetes resources from a list of yaml manifests instead of using local files
`--release-manifest tektoncd-operaotr-0.49.0` | specify release manifest file
`--upgrade-strategy-semver` | specify update strategy (use `replaces` or `semver`)
````
6 changes: 3 additions & 3 deletions operatorhub/kubernetes/release-artifacts/bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=tektoncd-operator
LABEL operators.operatorframework.io.bundle.channels.v1=a,b
LABEL operators.operatorframework.io.bundle.channel.default.v1=a
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.7.1+git
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.10.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=unknown

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
creationTimestamp: null
labels:
operator.tekton.dev/release: devel
version: devel
version: v0.49.0
name: tektonconfigs.operator.tekton.dev
spec:
group: operator.tekton.dev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
creationTimestamp: null
labels:
operator.tekton.dev/release: devel
version: devel
version: v0.49.0
name: tektondashboards.operator.tekton.dev
spec:
group: operator.tekton.dev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
creationTimestamp: null
labels:
operator.tekton.dev/release: devel
version: devel
version: v0.49.0
name: tektonpipelines.operator.tekton.dev
spec:
group: operator.tekton.dev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
creationTimestamp: null
labels:
operator.tekton.dev/release: devel
version: devel
version: v0.49.0
name: tektonresults.operator.tekton.dev
spec:
group: operator.tekton.dev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
creationTimestamp: null
labels:
operator.tekton.dev/release: devel
version: devel
version: v0.49.0
name: tektontriggers.operator.tekton.dev
spec:
group: operator.tekton.dev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ data:
DEFAULT_TARGET_NAMESPACE: tekton-pipelines
kind: ConfigMap
metadata:
annotations: {}
labels:
operator.tekton.dev/release: devel
name: tekton-config-defaults
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
app: tekton-operator
name: tekton-operator-webhook
operator.tekton.dev/release: devel
version: devel
version: v0.49.0
name: tekton-operator-webhook
spec:
ports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@ metadata:
certified: 'false'
description: Tekton Pipelines is a Kubernetes-Native CI/CD solution for building
CI/CD pipelines.
operators.operatorframework.io/builder: operator-sdk-v1.7.1+git
operators.operatorframework.io/builder: operator-sdk-v1.10.0
operators.operatorframework.io/project_layout: unknown
repository: https://github.com/tektoncd/operator
support: The Tetkon Authors
name: tektoncd-operator.v1.1.1
name: tektoncd-operator.v0.49.0
namespace: placeholder
spec:
apiservicedefinitions: {}
customresourcedefinitions:
owned:
- kind: TektonAddon
name: tektonaddons.operator.tekton.dev
version: v1alpha1
- description: 'TektonConfig installs Tekton Pipelines, Tekton Triggers and Tekton
Dashboard on a cluster. The operator installs
Expand Down Expand Up @@ -642,6 +645,10 @@ spec:
spec:
containers:
- env:
- name: IMAGE_PIPELINES_PROXY
value: gcr.io/tekton-releases/github.com/tektoncd/operator/cmd/kubernetes/proxy-webhook@sha256:561dc8867bb94007208806178d24efff59a290f4082b6e72a0406d8532060c18
- name: IMAGE_JOB_PRUNER_TKN
value: gcr.io/tekton-releases/dogfooding/tkn@sha256:f69a02ef099d8915e9e4ea1b74e43b7a9309fc97cf23cb457ebf191e73491677
- name: SYSTEM_NAMESPACE
valueFrom:
fieldRef:
Expand All @@ -652,12 +659,17 @@ spec:
fieldPath: metadata.name
- name: OPERATOR_NAME
value: tekton-operator
- name: IMAGE_PIPELINES_PROXY
value: ko://github.com/tektoncd/operator/cmd/kubernetes/webhook:develEnv
- name: IMAGE_JOB_PRUNER_TKN
value: gcr.io/tekton-releases/dogfooding/tkn@sha256:f69a02ef099d8915e9e4ea1b74e43b7a9309fc97cf23cb457ebf191e73491677DEVEL
image: ko://github.com/tektoncd/operator/cmd/kubernetes/operator:develContainer
imagePullPolicy: Always
- name: AUTOINSTALL_COMPONENTS
valueFrom:
configMapKeyRef:
key: AUTOINSTALL_COMPONENTS
name: tekton-config-defaults
- name: DEFAULT_TARGET_NAMESPACE
valueFrom:
configMapKeyRef:
key: DEFAULT_TARGET_NAMESPACE
name: tekton-config-defaults
image: gcr.io/tekton-releases/github.com/tektoncd/operator/cmd/kubernetes/operator@sha256:bd055c27d897f327ddb4e846782fccfda3b1d3d2397d5c764d8038547acde391
name: tekton-operator
resources: {}
serviceAccountName: tekton-operator
Expand Down Expand Up @@ -686,8 +698,8 @@ spec:
value: tekton-operator-webhook
- name: WEBHOOK_SECRET_NAME
value: tekton-operator-webhook-certs
image: ko://github.com/tektoncd/operator/cmd/kubernetes/webhook
name: tekton-operator-webhook
image: gcr.io/tekton-releases/github.com/tektoncd/operator/cmd/kubernetes/webhook@sha256:25374b5e15738301b1173e7397248aa46419e164a99d2d8a1343204f02e0e75d
name: webhook
ports:
- containerPort: 8443
name: https-webhook
Expand Down Expand Up @@ -724,16 +736,7 @@ spec:
maturity: alpha
provider:
name: The Tekton Authors
relatedImages:
- image: ko://github.com/tektoncd/operator/cmd/kubernetes/operator:develContainer
name: TEKTON_OPERATOR
- image: ko://github.com/tektoncd/operator/cmd/kubernetes/webhook:develEnv
name: IMAGE_PIPELINES_PROXY
- image: gcr.io/tekton-releases/dogfooding/tkn@sha256:f69a02ef099d8915e9e4ea1b74e43b7a9309fc97cf23cb457ebf191e73491677DEVEL
name: IMAGE_JOB_PRUNER_TKN
- image: ko://github.com/tektoncd/operator/cmd/kubernetes/webhook
name: TEKTON_OPERATOR_WEBHOOK
version: 1.1.1
version: 0.49.0
webhookdefinitions:
- admissionReviewVersions:
- v1beta1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ annotations:
operators.operatorframework.io.bundle.manifests.v1: manifests/
operators.operatorframework.io.bundle.metadata.v1: metadata/
operators.operatorframework.io.bundle.package.v1: tektoncd-operator
operators.operatorframework.io.bundle.channels.v1: a,b
operators.operatorframework.io.bundle.channel.default.v1: a
operators.operatorframework.io.metrics.builder: operator-sdk-v1.7.1+git
operators.operatorframework.io.bundle.channels.v1: alpha
operators.operatorframework.io.bundle.channel.default.v1: alpha
operators.operatorframework.io.metrics.builder: operator-sdk-v1.10.0
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: unknown

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: scorecard.operatorframework.io/v1alpha3
kind: Configuration
metadata:
name: config
stages:
- parallel: true
tests: []
3 changes: 3 additions & 0 deletions operatorhub/openshift/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# How to generate Operator Bundles for OpenShift

`TBD`
Loading

0 comments on commit 32edae6

Please sign in to comment.