|
| 1 | +--- |
| 2 | +title: "Plugin Lifecycle Management" |
| 3 | +linkTitle: "Plugin LCM" |
| 4 | +weight: 5 |
| 5 | +description: > |
| 6 | + Software lifecycle management done the Greenhouse way |
| 7 | +--- |
| 8 | + |
| 9 | +## What is Plugin Lifecycle Management (LCM)? |
| 10 | + |
| 11 | +When we are talking about Plugin LCM we refer to the active maintenance phase of software provided as Greenhouse Plugins. This includes tasks as: |
| 12 | + |
| 13 | +- Bug fixing |
| 14 | +- Feature shipping |
| 15 | +- Dependency updates |
| 16 | +- Version upgrades |
| 17 | +- and more... |
| 18 | + |
| 19 | +The following features are offered via Greenhouse: |
| 20 | + |
| 21 | +| Feature | Status | |
| 22 | +|---------------------------|:-----------:| |
| 23 | +| Automatic Updates | 🟩 | |
| 24 | +| Automatic Rollback on Failing Updates | 🟩 | |
| 25 | +| Version Constraining/Pinning | 🟨 | |
| 26 | +| Staged Rollout | 🟨 | |
| 27 | + |
| 28 | +## Involved actors |
| 29 | + |
| 30 | +### Plugin Developers |
| 31 | + |
| 32 | +These are the people providing the Plugins that can be used with Greenhouse. These Plugins are offered via (Cluster-)Plugindefinitions. |
| 33 | +Plugin developers ensure that PluginDefinition versions follow strict [SemVer](https://semver.org/). |
| 34 | + |
| 35 | +They control |
| 36 | + |
| 37 | +- The code of the Plugin including the Helm chart and possible frontend code. |
| 38 | +- Default PluginDefinition |
| 39 | +- Default Catalog(s) |
| 40 | +- The repository the PluginDefinitions and Catalogs live in |
| 41 | + |
| 42 | +### Plugin Consumers |
| 43 | + |
| 44 | +People configuring Plugins in their Organizations. |
| 45 | + |
| 46 | +They control the actual resources deployed to their Greenhouse Organization: |
| 47 | + |
| 48 | +- Custom Catalogs |
| 49 | +- PluginDefinitions |
| 50 | +- PluginPresets (& Plugins) |
| 51 | + |
| 52 | +### Ivolved Resources |
| 53 | + |
| 54 | +#### [Catalogs](./../../reference/api/index.html#greenhouse.sap/v1alpha1.Catalog) |
| 55 | + |
| 56 | +Catalogs enable Greenhouse Organizations to import the PluginDefinitions they want to use. Leveraging the underlying [flux](https://fluxcd.io/) machinery, a Catalog item targets a `kustomization.yaml` living in a git repository. |
| 57 | + |
| 58 | +This might be either |
| 59 | + |
| 60 | +- the default kustomization provided by Plugin developers |
| 61 | +- or a custom kustomization suited to the needs of your Organization |
| 62 | + |
| 63 | +The Catalog resource allows you to target the `kustomization.yaml` via `branch`, `tag` or `commit` in the `.Spec.Source.Git.Ref` field. |
| 64 | + |
| 65 | +#### [PluginDefinitions](./../../reference/api/index.htmlgreenhouse.sap/v1alpha1.PluginDefinition) |
| 66 | + |
| 67 | +PluginDefinitions bundle backend and frontend packages with configuration. Backends are shipped as [Helm charts](https://helm.sh/) and frontends as [React components](https://react.dev/reference/react/Component). |
| 68 | + |
| 69 | +All PluginDefinitions are versioned (`.Spec.Version`) with [SemVer](https://semver.org/). |
| 70 | + |
| 71 | +#### [PluginPresets](./../../reference/api/index.htmlgreenhouse.sap/v1alpha1.PluginPresets) |
| 72 | + |
| 73 | +PluginPresets allow you to configure a set of Plugins to be deployed to a set of Clusters referencing a PluginDefinition. |
| 74 | + |
| 75 | +🟨 In development: |
| 76 | +PluginPresets allow to pin or constrain deployed versions via the `.Spec.PluginDefinitionReference.Version` field with [semantic version constraints](https://jubianchi.github.io/semver-check/). |
| 77 | + |
| 78 | +### Features |
| 79 | + |
| 80 | +#### Automatic Updates |
| 81 | + |
| 82 | +**All** updates and upgrades (`major`, `minor` and `patch`) made to a PluginDefinition are shipped to all referencing Plugin(Presets) by default via the Greenhouse controller if no version constraint is set. |
| 83 | + |
| 84 | +Greenhouse per default follows a fix forward update strategy. |
| 85 | + |
| 86 | +We strongly encourage Plugin Consumers to always keep their Plugin versions up to date. All Greenhouse provided processes aim at easing upgrades or provide auto upgrade strategies. |
| 87 | + |
| 88 | +#### Automatic Rollback on Failure |
| 89 | + |
| 90 | +The underlying flux machinery's [`.spec.upgrade.remediation` is set to `rollback`](https://fluxcd.io/flux/components/helm/helmreleases/#upgrade-remediation). This will keep the Plugins running even if updates or upgrades fail. |
| 91 | + |
| 92 | +#### Version Pinning and Constraints |
| 93 | + |
| 94 | +Until the `Plugin.Spec.PluginDefinitionReference.Version` field and its automation is fully implemented, we suggest to use custom Catalogs to maintain versioned PluginDefinitions in your Organization. You can do so by |
| 95 | + |
| 96 | +- pinning versions of PluginDefinitions |
| 97 | +- pinning version of a Catalog |
| 98 | + |
| 99 | +versioned in a git repository. |
| 100 | + |
| 101 | +##### Pinning PluginDefinition versions |
| 102 | + |
| 103 | +Maintain a `kustomization.yaml` file targeting specific PluginDefinitions as resources, via git `commits`, `tags` or `branches`. |
| 104 | +E.g.: |
| 105 | + |
| 106 | +```yaml |
| 107 | +resources: |
| 108 | +# reference by branch |
| 109 | +- https://raw.githubusercontent.com/cloudoperators/greenhouse-extensions/refs/heads/main/cert-manager/plugindefinition.yaml |
| 110 | +# reference by commit |
| 111 | +- https://raw.githubusercontent.com/cloudoperators/greenhouse-extensions/6c41128df8d9ff72c63aee7e3d3122468490ea21/ingress-nginx/plugindefinition.yaml |
| 112 | +# reference by tag |
| 113 | +- https://raw.githubusercontent.com/cloudoperators/greenhouse-extensions/refs/tags/v0.0.2/kube-monitoring/plugindefinition.yaml |
| 114 | +``` |
| 115 | +
|
| 116 | +Point your Catalog to this `kustomization.yaml` and **alias** the PluginDefinition `name`: |
| 117 | + |
| 118 | +```yaml |
| 119 | +apiVersion: greenhouse.sap/v1alpha1 |
| 120 | +kind: Catalog |
| 121 | +metadata: |
| 122 | + name: my-custom-catalog |
| 123 | + namespace: {{ .Release.Namespace }} |
| 124 | +spec: |
| 125 | + source: |
| 126 | + git: |
| 127 | + url: https://<url-to-repo-with-kustomization> |
| 128 | + ref: |
| 129 | + branch: main |
| 130 | + path: path/to/kustomization |
| 131 | + overrides: |
| 132 | + - name: cert-manager |
| 133 | + alias: cert-manager-custom |
| 134 | + - name: ingress-nginx |
| 135 | + alias: ingress-nginx-custom |
| 136 | + - name: kube-monitoring |
| 137 | + alias: kube-monitoring-custom |
| 138 | +
|
| 139 | +``` |
| 140 | + |
| 141 | +!Note: |
| 142 | +> There is currently some restrictions in targeting raw data on Github Enterprise installations with flux. Maintain the `kustomization.yaml` together with the targeted PluginDefinitions in one repository targeted by the Catalog instead. |
| 143 | + |
| 144 | +##### Pinning Catalogs |
| 145 | + |
| 146 | +Point your Catalog to an existing `kustomization.yaml` and optionally alias the PluginDefintion `name`: |
| 147 | + |
| 148 | +```yaml |
| 149 | +apiVersion: greenhouse.sap/v1alpha1 |
| 150 | +kind: Catalog |
| 151 | +metadata: |
| 152 | + name: greenhouse-extensions-pinned |
| 153 | + namespace: {{ .Release.Namespace }} |
| 154 | +spec: |
| 155 | + source: |
| 156 | + git: |
| 157 | + url: https://github.com/cloudoperators/greenhouse-extensions |
| 158 | + ref: |
| 159 | + sha: <COMMIT_SHA> |
| 160 | + overrides: |
| 161 | + - name: alerts |
| 162 | + alias: alerts-pinned |
| 163 | + - name: audit-logs |
| 164 | + alias: audit-logs-pinned |
| 165 | + ... |
| 166 | +
|
| 167 | +``` |
| 168 | + |
| 169 | +#### Staged rollouts |
| 170 | + |
| 171 | +Until Greenhouse has an inhouse solution for staging rollouts, we suggest you use [renovate](https://github.com/renovatebot/renovate) configuration in combination to `git tags` to stage rollouts of PluginDefinition versions. |
| 172 | + |
| 173 | +The following steps are needed: |
| 174 | + |
| 175 | +1. Plugin developers need to `git tag` their PluginDefinitions and/or Catalogs. |
| 176 | +2. Have renovate open PRs to update the resources in your `kustomization.yaml` or in your `catalog.yaml`. |
| 177 | + |
| 178 | + E.g. |
| 179 | + |
| 180 | + <!-- TODO: Actually test this config! --> |
| 181 | + ```json |
| 182 | + "customManagers": [ |
| 183 | + { |
| 184 | + "customType": "regex", |
| 185 | + "description": "Bump kube-monitoring version in kustomize", |
| 186 | + "managerFilePatterns": [ |
| 187 | + "/(^|/)kustomization\\.ya?ml$/" |
| 188 | + ], |
| 189 | + "matchStrings": [ |
| 190 | + "https://raw.githubusercontent.com/cloudoperators/greenhouse-extensions/refs/tags/(?<currentValue>.*?)/kube-monitoring/plugindefinition.yaml" |
| 191 | + ], |
| 192 | + "datasource": "git-tags", |
| 193 | + "depNameTemplate": "cloudoperators/kube-monitoring" |
| 194 | + } |
| 195 | + ] |
| 196 | + ``` |
| 197 | + |
| 198 | +3. Maintain different `kustomization.yaml` or `catalog.yaml` for your stages. |
| 199 | + |
| 200 | + ```md |
| 201 | + catalogs/ |
| 202 | + ├── bronze/ |
| 203 | + │ └── kustomization.yaml |
| 204 | + ├── silver/ |
| 205 | + │ └── kustomization.yaml |
| 206 | + └── gold/ |
| 207 | + └── kustomization.yaml |
| 208 | +
|
| 209 | + ``` |
| 210 | + |
| 211 | +<!-- Need to actually test a valid automerge with --> |
| 212 | +4. Set renovate PRs to `automerge` and configure a `schedule` for the different stages. With no manual interaction (e.g. blocking PRs) you will roll through your stages based on your schedule. |
0 commit comments