Skip to content

Commit

Permalink
Merge pull request #15 from mt-sre/mhull-mtsre-890-addon-package-docs
Browse files Browse the repository at this point in the history
Initial changes to addon-package docs
  • Loading branch information
maryfrances01 authored Jul 18, 2023
2 parents a3f50bb + 474c5bb commit 04afd07
Showing 1 changed file with 46 additions and 18 deletions.
64 changes: 46 additions & 18 deletions content/en/docs/creating-addons/top-level-operator/addon-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ title: Plug and Play Addon
linkTitle: Plug and Play Addon
---

## Package
## Package Operator

For each addon that has `packageOperator` defined in its `spec`, a
ClusterObjectTemplate[https://package-operator.run/docs/getting_started/api-reference/#clusterobjecttemplate].
The average user does not need to interact with the `ClusterObjectTemplate`; they will interact with the resultant
ClusterPackage[https://package-operator.run/docs/getting_started/api-reference/#clusterpackage] that is created.
Package Operator is a Kubernetes Operator for packaging and managing a collection of arbitrary Kubernetes objects.

The `ClusterPackage` manifest will look like this:
Each addon with a `packageOperator` defined in its `spec` will have a corresponding
[ClusterObjectTemplate](https://package-operator.run/docs/getting_started/api-reference/#clusterobjecttemplate).
The ClusterObjectTemplate is an API defined in Package
Operator, enabling users to create an object by templating a
manifest and injecting values retrieved from other arbitrary source objects.
However, regular users typically do not need to interact with the `ClusterObjectTemplate`.
Instead, they can interact with the generated
[ClusterPackage](https://package-operator.run/docs/getting_started/api-reference/#clusterpackage)
manifest.

**Example of a `ClusterPackage` manifest:**

```shell
apiVersion: package-operator.run/v1alpha1
Expand All @@ -32,15 +39,36 @@ spec:
targetNamespace: pko-test-ns-00-req-apy-dsy-pdy
```

The `deadMansSnitchUrl` and the `pagerDutyKey` come from the `configMap`s with the default names in the default
locations
documented in
the [addons deadMansSnitch](https://mt-sre.github.io/docs/creating-addons/monitoring/deadmanssnitch_integration/)
and
the [addons pagerDuty documentation](https://mt-sre.github.io/docs/creating-addons/monitoring/pagerduty_integration/)
respectively. *To have these values inject you must maintain the default naming scheme and location of these configMaps*
.

All the values in `.spec.config.addonsv1` can be injected into the objects contained in your packageImage. See the
[package operator documentation](https://package-operator.run/docs/guides/packaging-an-application/#go-templates) to see
how to do this.
* The `deadMansSnitchUrl` and `pagerDutyKey` are obtained
from the ConfigMaps using their default names and locations.
**IMPORTANT:** To successfully inject the `deadMansSnitchUrl` and `pagerDutyKey` values into the `ClusterPackage` manifest,
you must keep the default naming scheme and location of the corresponding ConfigMaps.
See the [addons deadMansSnitch](https://mt-sre.github.io/docs/creating-addons/monitoring/deadmanssnitch_integration/)
and [addons pagerDuty](https://mt-sre.github.io/docs/creating-addons/monitoring/pagerduty_integration/)
documentation for more information.

* Additionally, all the values present in `.spec.config.addonsv1`
can be injected into the objects within your packageImage.
See the
[package operator](https://package-operator.run/docs/guides/packaging-an-application/#go-templates)
documentation for more information.

## Tenants Onboarding Steps

Although you can generate the packageImage yourself using the
[package operator](https://package-operator.run/docs/guides/packaging-an-application/#build--validate) documentation,
we recommend you use the Managed Tenants Bundles (MTB) facilities.

The following steps are an example of generating the packageImage for the reference-addon package using the MTB flow:

1. In the MTB repository, create a `package` directory and add the `manifests.yaml` inside the `package` directory.
See the following
[merge request](https://gitlab.cee.redhat.com/service/managed-tenants-bundles/-/tree/main/addons/reference-addon/package)
for an example.

2. The MTB CI creates the packageImage and the Operator Lifecycle Manager (OLM) Index Image as part of the team's
[addon folder](https://gitlab.cee.redhat.com/service/managed-tenants-bundles/-/tree/main/addons/reference-addon).

3. The MTB CI creates a merge request to the
[managed-tenants repository](https://gitlab.cee.redhat.com/service/managed-tenants/-/blob/main/addons/reference-addon/addonimagesets/stage/reference-addon.v0.10.1.yaml#L24)
and adds a new AddonImageSet with the PackageImage and OLM Index images.

0 comments on commit 04afd07

Please sign in to comment.