Skip to content

RHIDP-6504: Modularize modules/dynamic-plugins/proc-topology-configure #1065

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
20 changes: 20 additions & 0 deletions assemblies/assembly-managing-labels-annotations-topology.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
:_mod-docs-content-type: ASSEMBLY
[id="assembly-managing-labels-annotations-topology"]
= Managing labels and annotations for Topology plugins
:context: assembly-managing-labels-annotations-topology

include::modules/dynamic-plugins/proc-linking-to-source-code-editor-or-source.adoc[leveloffset=+1]

include::modules/dynamic-plugins/proc-entity-annotation-or-label.adoc[leveloffset=+1]

include::modules/dynamic-plugins/proc-namespace-annotation.adoc[leveloffset=+1]

include::modules/dynamic-plugins/proc-label-selector-query-annotation.adoc[leveloffset=+1]

include::modules/dynamic-plugins/proc-icon-displayed-in-the-node.adoc[leveloffset=+1]

include::modules/dynamic-plugins/proc-app-grouping.adoc[leveloffset=+1]

include::modules/dynamic-plugins/proc-node-connector.adoc[leveloffset=+1]

For more information about the labels and annotations, see _Guidelines for labels and annotations for OpenShift applications_.
14 changes: 14 additions & 0 deletions assemblies/assembly-topology-plugin-configure.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
:_mod-docs-content-type: ASSEMBLY
[id="assembly-topology-plugin-configure"]
= Configuring the Topology plugin
:context: assembly-topology-plugin-configure

include::modules/dynamic-plugins/proc-viewing-openshift-routes.adoc[leveloffset=+1]

include::modules/dynamic-plugins/proc-viewing-pod-logs.adoc[leveloffset=+1]

include::modules/dynamic-plugins/proc-viewing-tekton-pipelineruns.adoc[leveloffset=+1]

include::modules/dynamic-plugins/proc-viewing-virtual-machines.adoc[leveloffset=+1]

include::modules/dynamic-plugins/proc-enabling-the-source-code-editor.adoc[leveloffset=+1]
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ include::../../artifacts/rhdh-plugins-reference/nexus-repository-manager/nexus-r
include::../../artifacts/rhdh-plugins-reference/tekton/tekton-plugin-admin.adoc[leveloffset=+1]

// Topology
== Installing and configuring the Topology plugin
== Installing the Topology plugin
include::../modules/dynamic-plugins/proc-topology-install.adoc[leveloffset=+2]
include::../modules/dynamic-plugins/proc-topology-configure.adoc[leveloffset=+2]

include::../assembly-topology-plugin-configure.adoc[leveloffset=+1]

include::../assembly-managing-labels-annotations-topology.adoc[leveloffset=+1]

include::../assembly-bulk-importing-from-github.adoc[leveloffset=+1]

Expand Down
11 changes: 11 additions & 0 deletions modules/dynamic-plugins/proc-app-grouping.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[id="proc-app-grouping"]

= App grouping

To display workload resources such as deployments or pods in a visual group, add the following label:

[source,yaml]
----
labels:
app.kubernetes.io/part-of: <GROUP_NAME>
----
34 changes: 34 additions & 0 deletions modules/dynamic-plugins/proc-enabling-the-source-code-editor.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[id="proc-enabling-the-source-code-editor_{context}"]
= Enabling the source code editor

To enable the source code editor, you must grant read access to the CheClusters resource in the `ClusterRole` as shown in the following example code:

[source,yaml]
----
...
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: backstage-read-only
rules:
...
- apiGroups:
- org.eclipse.che
resources:
- checlusters
verbs:
- get
- list
----

To use the source code editor, you must add the following configuration to the `kubernetes.customResources` property in your `{my-app-config-file}` file:

[source,yaml]
----
kubernetes:
...
customResources:
- group: 'org.eclipse.che'
apiVersion: 'v2'
plural: 'checlusters'
----
24 changes: 24 additions & 0 deletions modules/dynamic-plugins/proc-entity-annotation-or-label.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[id="proc-entity-annotation-or-label"]

= Entity annotation/label

For RHDH to detect that an entity has Kubernetes components, add the following annotation to the entity's `catalog-info.yaml`:

[source,yaml]
----
annotations:
backstage.io/kubernetes-id: <BACKSTAGE_ENTITY_NAME>
----

The following label is added to the resources so that the Kubernetes plugin gets the Kubernetes resources from the requested entity, add the following label to the resources:

[source,yaml]
----
labels:
backstage.io/kubernetes-id: <BACKSTAGE_ENTITY_NAME>`
----

[NOTE]
====
When using the label selector, the mentioned labels must be present on the resource.
====
52 changes: 52 additions & 0 deletions modules/dynamic-plugins/proc-icon-displayed-in-the-node.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[id="proc-icon-displayed-in-the-node"]

= Icon displayed in the node

To display a runtime icon in the topology nodes, add the following label to workload resources, such as Deployments:

[source,yaml]
----
labels:
app.openshift.io/runtime: <RUNTIME_NAME>
----
Alternatively, you can include the following label to display the runtime icon:

[source,yaml]
----
labels:
app.kubernetes.io/name: <RUNTIME_NAME>
----

Supported values of `<RUNTIME_NAME>` include:

* django
* dotnet
* drupal
* go-gopher
* golang
* grails
* jboss
* jruby
* js
* nginx
* nodejs
* openjdk
* perl
* phalcon
* php
* python
* quarkus
* rails
* redis
* rh-spring-boot
* rust
* java
* rh-openjdk
* ruby
* spring
* spring-boot

[NOTE]
====
Other values result in icons not being rendered for the node.
====
31 changes: 31 additions & 0 deletions modules/dynamic-plugins/proc-label-selector-query-annotation.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[id="proc-label-selector-query-annotation"]

= Label selector query annotation

You can write your own custom label, which RHDH uses to find the Kubernetes resources. The label selector takes precedence over the ID annotations:

[source,yaml]
----
annotations:
backstage.io/kubernetes-label-selector: 'app=my-app,component=front-end'
----

If you have multiple entities while Red Hat Dev Spaces is configured and want multiple entities to support the edit code decorator that redirects to the Red Hat Dev Spaces instance, you can add the backstage.io/kubernetes-label-selector annotation to the catalog-info.yaml file for each entity.

[source,yaml]
----
annotations:
backstage.io/kubernetes-label-selector: 'component in (<BACKSTAGE_ENTITY_NAME>,che)'
----

If you are using the previous label selector, you must add the following labels to your resources so that the Kubernetes plugin gets the Kubernetes resources from the requested entity:

[source,yaml]
----
labels:
component: che # add this label to your che cluster instance
labels:
component: <BACKSTAGE_ENTITY_NAME> # add this label to the other resources associated with your entity
----

You can also write your own custom query for the label selector with unique labels to differentiate your entities. However, you need to ensure that you add those labels to the resources associated with your entities including your CheCluster instance.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[id="proc-linking-to-source-code-editor-or-source"]

= Linking to the source code editor or the source

Add the following annotations to workload resources, such as Deployments to navigate to the Git repository of the associated application using the source code editor:

[source,yaml]
----
annotations:
app.openshift.io/vcs-uri: <GIT_REPO_URL>
----

Add the following annotation to navigate to a specific branch:

[source,yaml]
----
annotations:
app.openshift.io/vcs-ref: <GIT_REPO_BRANCH>
----

[NOTE]
====
If Red Hat OpenShift Dev Spaces is installed and configured and git URL annotations are also added to the workload YAML file, then clicking on the edit code decorator redirects you to the Red Hat OpenShift Dev Spaces instance.
====

[NOTE]
====
When you deploy your application using the OCP Git import flows, then you do not need to add the labels as import flows do that. Otherwise, you need to add the labels manually to the workload YAML file.
====

//The labels are not similar to `backstage.io/edit-url` annotations as it points to the catalog entity metadata source file and is applied to RHDH catalog entity metadata YAML file, but not Kubernetes resources.

You can also add the `app.openshift.io/edit-url` annotation with the edit URL that you want to access using the decorator.
15 changes: 15 additions & 0 deletions modules/dynamic-plugins/proc-namespace-annotation.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[id="proc-namespace-annotation"]

= Namespace annotation

To identify the Kubernetes resources using the defined namespace, add the `backstage.io/kubernetes-namespace` annotation:

[source,yaml]
----
annotations:
backstage.io/kubernetes-namespace: <RESOURCE_NS>
----

The Red Hat OpenShift Dev Spaces instance is not accessible using the source code editor if the `backstage.io/kubernetes-namespace` annotation is added to the `catalog-info.yaml` file.

To retrieve the instance URL, you require the CheCluster custom resource (CR). As the CheCluster CR is created in the openshift-devspaces namespace, the instance URL is not retrieved if the namespace annotation value is not openshift-devspaces.
11 changes: 11 additions & 0 deletions modules/dynamic-plugins/proc-node-connector.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[id="proc-node-connector"]

= Node connector

To display the workload resources such as deployments or pods with a visual connector, add the following annotation:

[source,yaml]
----
annotations:
app.openshift.io/connects-to: '[{"apiVersion": <RESOURCE_APIVERSION>,"kind": <RESOURCE_KIND>,"name": <RESOURCE_NAME>}]'
----
Loading