|
| 1 | +:_mod-docs-content-type: CONCEPT |
| 2 | + |
| 3 | +[id="dynamic-plugins-dependencies_{context}"] |
| 4 | += Dynamic plugins dependency management |
| 5 | +Dynamic plugins configured for the {backstage} custom resource (CR) may require certain Kubernetes resources to be configured to make the plugin work. These resources are referred to as `plugin dependencies`. In {product} ({product-very-short}), you can automatically create these resources when the {backstage} CR is applied to the cluster. |
| 6 | + |
| 7 | +== Cluster level plugin dependencies configuration |
| 8 | +You can configure plugin dependencies by including the required Kubernetes resources in the `/config/profile/{PROFILE}/plugin-deps` directory. You must add the required resources as Kubernetes manifests in YAML format in the `plugin-deps` directory. |
| 9 | + |
| 10 | +Example showing how to add `example-dep1.yaml` and `example-dep2.yaml` as plugin dependencies: |
| 11 | +[source,terminal,subs="+quotes"] |
| 12 | +---- |
| 13 | +config/ |
| 14 | + profile/ |
| 15 | + rhdh/ |
| 16 | + kustomization.yaml |
| 17 | + plugin-deps/ |
| 18 | + example-dep1.yaml |
| 19 | + example-dep2.yaml |
| 20 | +---- |
| 21 | + |
| 22 | +[NOTE] |
| 23 | +==== |
| 24 | +* If a resource manifest does not specify a namespace, it will be created in the namespace of the {backstage} CR. |
| 25 | +* Resources may contain *{{backstage-name}}* and *{{backstage-ns}}* placeholders, which will be replaced with the name and namespace of the {backstage} CR, respectively. |
| 26 | +==== |
| 27 | + |
| 28 | +The `kustomization.yaml` file must contain the following lines: |
| 29 | +[source,yaml,subs="+quotes"] |
| 30 | +---- |
| 31 | +configMapGenerator: |
| 32 | + - files: |
| 33 | + - plugin-deps/example-dep1.yaml |
| 34 | + - plugin-deps/example-dep2.yaml |
| 35 | + name: plugin-deps |
| 36 | +---- |
| 37 | + |
| 38 | +== Plugin dependencies infrastructure |
| 39 | +To install infrastructural resources that are required by plugin dependencies, for example, other operators or custom resources (CR), you can include these in the `/config/profile/{PROFILE}/plugin-infra` directory. |
| 40 | + |
| 41 | +To create these infrastructural resources (along with the operator deployment), use the `make plugin-infra` command. |
| 42 | + |
| 43 | +[NOTE] |
| 44 | +==== |
| 45 | +On a production cluster, use this command with caution as it might reconfigure cluster-scoped resources. |
| 46 | +==== |
| 47 | + |
| 48 | +== Plugin configuration |
| 49 | +You must reference the plugin dependenciesin the `dependencies` field of the plugin configuration when the {backstage} CR is applied. |
| 50 | + |
| 51 | +The Operator creates the resources described in the files located in the `plugin-deps` directory. |
| 52 | + |
| 53 | +You can reference plugin dependencies in the `dynamic-plugins` ConfigMap which can either be part of the default profile configuration for all {backstage} custom resources or part of the ConfigMap referenced in the {backstage} CR. In {product}, you can include plugin dependencies in the dynamic plugin configuration. |
| 54 | + |
| 55 | +Each `dependencies.ref` value can either match the full file name or serve as a prefix for the file name. The operator will create the resources described in the files contained in the `plugin-deps` that start with the specified `ref` value or exactly match it |
| 56 | + |
| 57 | +Example showing how to add `example-dep` plugin dependency: |
| 58 | +[source,yaml,subs="+quotes"] |
| 59 | +---- |
| 60 | +apiVersion: v1 |
| 61 | +kind: ConfigMap |
| 62 | +metadata: |
| 63 | + name: default-dynamic-plugins |
| 64 | +data: |
| 65 | + dynamic-plugins.yaml: | |
| 66 | + includes: |
| 67 | + - dynamic-plugins.default.yaml |
| 68 | + plugins: |
| 69 | + - disabled: false |
| 70 | + package: "path-or-url-to-example-plugin" |
| 71 | + dependencies: |
| 72 | + - ref: example-dep |
| 73 | +---- |
0 commit comments