Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operator Bundle Format #416

Merged
merged 1 commit into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
deploy
bundle
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.13 as builder
FROM golang:1.16 as builder

WORKDIR /workspace
COPY go.mod go.mod
Expand Down
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This Operator can be installed on any Kubernetes cluster running the [Operator L

**Create the `CatalogSource`**:
```sh
$ kubectl create -n openshift-marketplace -f ./deploy/quay-operator.catalogsource.yaml
$ kubectl create -n openshift-marketplace -f ./bundle/quay-operator.catalogsource.yaml
```

**Wait a few seconds for the package to become available**:
Expand All @@ -33,12 +33,12 @@ $ kubectl get packagemanifest --all-namespaces | grep quay
NOTE: By default, the `targetNamespaces` field is specified to target the _quay-enterprise_ namespace. Update this value if the namespace the operator is deployed within differs.

```sh
$ kubectl create -n <your-namespace> -f ./deploy/quay-operator.operatorgroup.yaml
$ kubectl create -n <your-namespace> -f ./bundle/quay-operator.operatorgroup.yaml
```

**Create the `Subscription` to install the Operator**:
```sh
$ kubectl create -n <your-namespace> -f ./deploy/quay-operator.subscription.yaml
$ kubectl create -n <your-namespace> -f ./bundle/quay-operator.subscription.yaml
```

### Using the Operator
Expand Down Expand Up @@ -91,7 +91,7 @@ Pull requests and bug reports are always welcome!

**Create the `QuayRegistry` CRD**:
```sh
$ kubectl create -f ./config/crd/bases/
$ kubectl create -f ./bundle/upstream/manifests/*.crd.yaml
```

**Run the controller**:
Expand All @@ -113,20 +113,27 @@ $ docker build -t <some-registry>/<namespace>/quay-operator:dev .
$ docker push <some-registry>/<namespace>/quay-operator:dev
```

2. Replace the `image` field in `deploy/manifests/quay-operator/0.0.1/quay-operator.clusterserviceversion.yaml` with the image above.
2. Replace the `image` field in `bundle/upstream/manifests/quay-operator.clusterserviceversion.yaml` with the image above.

3. Build and push the Quay Operator `CatalogSource` container:
3. Build and push an [Operator bundle](https://github.com/operator-framework/operator-registry/blob/master/docs/design/operator-bundle.md):

```sh
$ cd deploy
$ docker build -t <some-registry>/<namespace>/quay-operator-catalog:dev .
$ docker push <some-registry>/<namespace>/quay-operator-catalog:dev
$ docker build -t <some-registry>/<namespace>/quay-operator-bundle:dev -f ./bundle/Dockerfile ./bundle
$ docker push <some-registry>/<namespace>/quay-operator-bundle:dev
```

4. Replace the `spec.image` field in `deploy/quay-operator.catalogsource.yaml` with the image above.
4. Build and push an Operator index image using [`opm`](https://github.com/operator-framework/operator-registry/blob/master/docs/design/opm-tooling.md#opm):

```sh
$ cd bundle/upstream
$ opm index add --bundles <some-registry>/<namespace>/quay-operator-bundle:dev --tag <some-registry>/<namespace>/quay-operator-index:dev
$ docker push <some-registry>/<namespace>/quay-operator-index:dev
```

4. Replace the `spec.image` field in `bundle/quay-operator.catalogsource.yaml` with the image above.

5. Create the custom `CatalogSource`:

```sh
$ kubectl create -n openshift-marketplace -f ./deploy/quay-operator.catalogsource.yaml
$ kubectl create -n openshift-marketplace -f ./bundle/quay-operator.catalogsource.yaml
```
11 changes: 11 additions & 0 deletions bundle/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM scratch

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=quay-operator-tng
LABEL operators.operatorframework.io.bundle.channels.v1=dev
LABEL operators.operatorframework.io.bundle.channel.default.v1=dev

ADD manifests /manifests
ADD metadata/annotations.yaml /metadata/annotations.yaml
7 changes: 7 additions & 0 deletions bundle/quay-operator.catalogsource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
name: quay-operator-tng
spec:
sourceType: grpc
image: quay.io/projectquay/quay-operator-index
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ metadata:
annotations:
capabilities: Full Lifecycle
categories: Integration & Delivery
containerImage: quay.io/projectquay/quay-operator@sha256:c4d8de1b394eaf83a50f46882a4b0c3c6be966b08d8a2ab2e5f3cd6ff7bfbd2f
containerImage: quay.io/alecmerdler/quay-operator@sha256:338fd69768edebc1e4fe027b76d897281b1d95324d39e8afad6c790e38ecc4eb
createdAt: 2020-08-24 00:00:00
description: Opinionated deployment of Quay on Kubernetes.
quay-version: 0.0.1
quay-version: 3.5.0
repository: https://github.com/quay/quay-operator
tectonic-visibility: ocs
alm-examples: |-
Expand All @@ -34,7 +34,7 @@ metadata:
]
operators.operatorframework.io/internal-objects: |-
["quayecosystems.redhatcop.redhat.io"]
name: quay-operator.v0.0.1
name: quay-operator.v2.0.0
namespace: placeholder
spec:
customresourcedefinitions:
Expand Down Expand Up @@ -124,7 +124,7 @@ spec:
spec:
containers:
- name: quay-operator
image: quay.io/projectquay/quay-operator@sha256:c4d8de1b394eaf83a50f46882a4b0c3c6be966b08d8a2ab2e5f3cd6ff7bfbd2f
image: quay.io/alecmerdler/quay-operator@sha256:338fd69768edebc1e4fe027b76d897281b1d95324d39e8afad6c790e38ecc4eb
command:
- /workspace/manager
- '--namespace=$(WATCH_NAMESPACE)'
Expand Down Expand Up @@ -619,4 +619,4 @@ spec:
matchLabels:
alm-owner-quay-operator: quay-operator
operated-by: quay-operator
version: 0.0.1
version: 2.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,37 @@ spec:
status:
description: QuayRegistryStatus defines the observed state of QuayRegistry.
properties:
conditions:
description: Conditions represent the conditions that a QuayRegistry
can have.
items:
description: 'Condition is a single condition of a QuayRegistry. Conditions
should follow the "abnormal-true" principle in order to only bring
the attention of users to "broken" states. Example: a condition
of `type: "Ready", status: "True"`` is less useful and should be
omitted whereas `type: "NotReady", status: "True"` is more useful
when trying to monitor when something is wrong.'
properties:
lastTransitionTime:
format: date-time
type: string
lastUpdateTime:
format: date-time
type: string
message:
type: string
reason:
type: string
status:
type: string
type:
type: string
type: object
type: array
configEditorCredentialsSecret:
description: ConfigEditorCredentialsSecret is the Kubernetes `Secret`
containing the config editor password.
type: string
configEditorEndpoint:
description: ConfigEditorEndpoint is the external access point for a
web-based reconfiguration interface for the Quay registry instance.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
annotations:
operators.operatorframework.io.bundle.channel.default.v1: quay-v3.4
operators.operatorframework.io.bundle.channels.v1: quay-v3.4
operators.operatorframework.io.bundle.channel.default.v1: dev
operators.operatorframework.io.bundle.channels.v1: dev
operators.operatorframework.io.bundle.manifests.v1: manifests/
operators.operatorframework.io.bundle.mediatype.v1: registry+v1
operators.operatorframework.io.bundle.metadata.v1: metadata/
operators.operatorframework.io.bundle.package.v1: quay-operator
operators.operatorframework.io.bundle.package.v1: quay-operator-tng
12 changes: 0 additions & 12 deletions deploy/Dockerfile

This file was deleted.

Loading