Skip to content

Commit 0fcb93b

Browse files
pabel-rhopenshift-cherrypick-robot
authored andcommitted
Added content
1 parent d07858d commit 0fcb93b

7 files changed

+216
-2
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[id='con-Kubernetes-scaffolder-actions_{context}']
2+
= Kubernetes scaffolder actions in {product}
3+
4+
The Kubernetes custom plugin is preinstalled and disabled on a {product-short} instance by default. You can disable or enable the Kubernetes custom plugin, and change other parameters, by configuring the {product} Helm chart. You can install and use Kubernetes custom actions to create and manage Kubernetes resources.
5+
6+
include::modules/using-kubernetes-scaffolder-actions/proc-enable-kubernetes-scaffolder-actions-plugin.adoc[leveloffset=+1]
7+
8+
include::modules/using-kubernetes-scaffolder-actions/proc-using-kubernetes-scaffolder-actions-plugin.adoc[leveloffset=+1]
9+
10+
include::modules/using-kubernetes-scaffolder-actions/ref-creating-a-template-using-kubernetes-scaffolder-actions.adoc[leveloffset=+1]
11+
12+
include::modules/using-kubernetes-scaffolder-actions/ref-supported-kubernetes-scaffolder-actions.adoc[leveloffset=+2]

assemblies/dynamic-plugins/assembly-configuring-rhdh-plugins.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,7 @@ include::../assembly-bulk-importing-from-github.adoc[leveloffset=+1]
2828

2929
include::../assembly-using-servicenow.adoc[leveloffset=+1]
3030

31+
include::../assembly-using-kubernetes-scaffolder-actions.adoc[leveloffset=+1]
32+
3133
// Overriding Core Backend Service Configuration
3234
include::../modules/dynamic-plugins/con-overriding-core-backend-services.adoc[leveloffset=+1]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[id='proc-enable-kubernetes-scaffolder-actions-plugin_{context}']
2+
= Enabling Kubernetes scaffolder actions plugin in {product}
3+
4+
In {product}, the Kubernetes scaffolder actions are provided as a preinstalled plugin, which is disabled by default. You can enable the Kubernetes scaffolder plugin using the following procedure.
5+
6+
.Prerequisites
7+
8+
* {product} is installed and running.
9+
For more information about installing the {product-short}, see xref:{installing-on-ocp-book-url}#assembly-install-rhdh-ocp-helm[{installing-on-ocp-book-title} with the Helm chart].
10+
* You have created a project in the {product-short}.
11+
12+
.Procedure
13+
14+
To enable the Kubernetes scaffolder plugin, complete the following step:
15+
16+
* In your Helm chart, add a `package` with the Kubernetes plugin name and update the `disabled` field. For example:
17+
+
18+
--
19+
[source,yaml]
20+
----
21+
global:
22+
dynamic:
23+
includes:
24+
- dynamic-plugins.default.yaml
25+
plugins:
26+
- package: ./dynamic-plugins/dist/backstage-community-plugin-scaffolder-backend-module-servicenow-dynamic
27+
disabled: false
28+
----
29+
30+
[NOTE]
31+
====
32+
The default configuration for a plugin is extracted from the `dynamic-plugins.default.yaml` file, however, you can use a `pluginConfig` entry to override the default configuration.
33+
====
34+
--
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[id='proc-using-kubernetes-scaffolder-actions-plugin_{context}']
2+
= Using Kubernetes scaffolder actions plugin in {product}
3+
4+
In {product}, the Kubernetes scaffolder actions enable you to run template actions for Kubernetes.
5+
6+
.Procedure
7+
8+
* To use a Kubernetes scaffolder action in your custom template, add the following Kubernetes actions to your template:
9+
+
10+
11+
[source,yaml,subs="+attributes"]
12+
----
13+
action: kubernetes:create-namespace
14+
id: create-kubernetes-namespace
15+
name: Create kubernetes namespace
16+
input:
17+
namespace: {my-product-namespace}
18+
clusterRef: bar
19+
token: TOKEN
20+
skipTLSVerify: false
21+
caData: Zm9v
22+
labels: app.io/type=ns; app.io/managed-by=org;
23+
24+
----
25+
26+
[role="_additional-resources"]
27+
.Additional resource
28+
29+
* link:{customizing-book-url#configuring-templates}[Configuring templates].
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
[id='ref-creating-a-template-using-Kubernetes-scaffolder-actions_{context}']
2+
= Creating a template using Kubernetes scaffolder actions in {product}
3+
4+
You can create a template by defining a `Template` object as a YAML file.
5+
6+
The `Template` object describes the template and its metadata. It also contains required input variables and a list of actions that are executed by the scaffolding service.
7+
+
8+
9+
[source,yaml,subs="+attributes"]
10+
----
11+
apiVersion: scaffolder.backstage.io/v1beta3
12+
kind: Template
13+
metadata:
14+
name: create-kubernetes-namespace
15+
title: Create a kubernetes namespace
16+
description: Create a kubernetes namespace
17+
18+
spec:
19+
type: service
20+
parameters:
21+
- title: Information
22+
required: [namespace, token]
23+
properties:
24+
namespace:
25+
title: Namespace name
26+
type: string
27+
description: Name of the namespace to be created
28+
clusterRef:
29+
title: Cluster reference
30+
type: string
31+
description: Cluster resource entity reference from the catalog
32+
ui:field: EntityPicker
33+
ui:options:
34+
catalogFilter:
35+
kind: Resource
36+
url:
37+
title: Url
38+
type: string
39+
description: Url of the kubernetes API, will be used if clusterRef is not provided
40+
token:
41+
title: Token
42+
type: string
43+
description: Bearer token to authenticate with
44+
skipTLSVerify:
45+
title: Skip TLS verification
46+
type: boolean
47+
description: Skip TLS certificate verification, not recommended to use in production environment, default to false
48+
caData:
49+
title: CA data
50+
type: string
51+
description: Certificate Authority base64 encoded certificate
52+
labels:
53+
title: Labels
54+
type: string
55+
description: Labels to be applied to the namespace
56+
ui:widget: textarea
57+
ui:options:
58+
rows: 3
59+
ui:help: 'Hint: Separate multiple labels with a semicolon!'
60+
ui:placeholder: 'kubernetes.io/type=namespace; app.io/managed-by=org'
61+
62+
steps:
63+
- id: create-kubernetes-namespace
64+
name: Create kubernetes namespace
65+
action: kubernetes:create-namespace
66+
input:
67+
namespace: ${{ parameters.namespace }}
68+
clusterRef: ${{ parameters.clusterRef }}
69+
url: ${{ parameters.url }}
70+
token: ${{ parameters.token }}
71+
skipTLSVerify: ${{ parameters.skipTLSVerify }}
72+
caData: ${{ parameters.caData }}
73+
labels: ${{ parameters.labels }}
74+
75+
----
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
[id='ref-supported-Kubernetes-scaffolder-actions_{context}']
2+
= Supported Kubernetes scaffolder actions in {product}
3+
4+
In {product}, you can use custom Kubernetes actions in scaffolder templates.
5+
6+
== Custom Kubernetes scaffolder actions
7+
8+
Action: kubernetes:create-namespace::
9+
+
10+
11+
Creates a namespace for the Kubernetes cluster in the {product-short}.
12+
13+
[cols="15%,15%,15%,40%,15%", frame="all", options="header"]
14+
|===
15+
|Parameter name
16+
|Type
17+
|Requirement
18+
|Description
19+
|Example
20+
21+
|`namespace`
22+
|`string`
23+
|Required
24+
|Name of the Kubernetes namespace
25+
|`{my-product-namespace}`
26+
27+
|`clusterRef`
28+
|`string`
29+
|Optional if `url` is defined
30+
|Cluster resource entity reference from the catalog
31+
|`bar`
32+
33+
|`url`
34+
|`string`
35+
|Optional if `clusterRef` is defined
36+
|API url of the Kubernetes cluster
37+
| `https://api.foo.redhat.com:6443`
38+
39+
|`token`
40+
|`String`
41+
|Required
42+
|Kubernetes API bearer token used for authentication
43+
|
44+
45+
|`skipTLSVerify`
46+
|`boolean`
47+
|Optional
48+
|If true, certificate verification is skipped
49+
|false
50+
51+
|`caData`
52+
|`string`
53+
|Optional
54+
|Base64 encoded certificate data
55+
|
56+
57+
|`label`
58+
|`string`
59+
|Optional
60+
|Labels applied to the namespace
61+
|app.io/type=ns; app.io/managed-by=org;
62+
|===

modules/using-service-now/proc-enable-servicenow-custom-actions-plugin.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ For more information about installing the {product-short}, see xref:{installing-
1111

1212
.Procedure
1313

14-
. To activate the custom actions plugin, add a `package` with plugin name and update the `disabled` field in your Helm Chart as follows:
14+
. To activate the custom actions plugin, add a `package` with plugin name and update the `disabled` field in your Helm chart as follows:
1515
+
1616
--
1717
[source,yaml]
@@ -31,7 +31,7 @@ The default configuration for a plugin is extracted from the `dynamic-plugins.de
3131
====
3232
--
3333

34-
. Set the following variables in the Helm Chart to access the custom actions:
34+
. Set the following variables in the Helm chart to access the custom actions:
3535
+
3636
--
3737
[source,yaml]

0 commit comments

Comments
 (0)