Skip to content

Commit 0d0cd37

Browse files
[release-1.5] RHIDP-5423: Content for Kubernetes scaffolder actions (#983)
* Added content * Changing the name * Incorporated Lindsey's and Dominika's comments * Updated table descriptions * Minor changes * Changed token and CAdata to secrets * minor change * Minor changes * Added TP --------- Co-authored-by: Priyanka Abel <[email protected]>
1 parent d07858d commit 0d0cd37

7 files changed

+224
-2
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[id='con-Kubernetes-custom-actions_{context}']
2+
= Kubernetes custom actions in {product}
3+
4+
include::{docdir}/artifacts/snip-technology-preview.adoc[]
5+
6+
With Kubernetes custom actions, you can create and manage Kubernetes resources.
7+
8+
The Kubernetes custom actions plugin is preinstalled and disabled on a {product-short} instance by default. You can disable or enable the Kubernetes custom actions plugin, and change other parameters, by configuring the {product} Helm chart.
9+
10+
[NOTE]
11+
====
12+
Kubernetes scaffolder actions and Kubernetes custom actions refer to the same concept throughout this documentation.
13+
====
14+
15+
16+
include::modules/using-kubernetes-custom-actions/proc-enable-kubernetes-custom-actions-plugin.adoc[leveloffset=+1]
17+
18+
include::modules/using-kubernetes-custom-actions/proc-using-kubernetes-custom-actions-plugin.adoc[leveloffset=+1]
19+
20+
include::modules/using-kubernetes-custom-actions/ref-creating-a-template-using-kubernetes-custom-actions.adoc[leveloffset=+1]
21+
22+
include::modules/using-kubernetes-custom-actions/ref-supported-kubernetes-custom-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-custom-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: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[id='proc-enable-kubernetes-custom-actions-plugin_{context}']
2+
= Enabling Kubernetes custom actions plugin in {product}
3+
4+
In {product}, the Kubernetes custom actions are provided as a preinstalled plugin, which is disabled by default. You can enable the Kubernetes custom actions plugin by updating the `disabled` key value in your Helm chart.
5+
6+
.Prerequisites
7+
8+
* You have installed {product} with the Helm chart.
9+
10+
.Procedure
11+
12+
To enable the Kubernetes custom actions plugin, complete the following step:
13+
14+
* In your Helm chart, add a `package` with the Kubernetes custom action plugin name and update the `disabled` field. For example:
15+
+
16+
--
17+
[source,yaml]
18+
----
19+
global:
20+
dynamic:
21+
includes:
22+
- dynamic-plugins.default.yaml
23+
plugins:
24+
- package: ./dynamic-plugins/dist/backstage-community-plugin-scaffolder-backend-module-kubernetes-dynamic
25+
disabled: false
26+
----
27+
28+
[NOTE]
29+
====
30+
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.
31+
====
32+
--
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[id='proc-using-kubernetes-custom-actions-plugin_{context}']
2+
= Using Kubernetes custom actions plugin in {product}
3+
4+
In {product}, the Kubernetes custom actions enable you to run template actions for Kubernetes.
5+
6+
.Procedure
7+
8+
* To use a Kubernetes custom 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: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
[id='ref-creating-a-template-using-Kubernetes-custom-actions_{context}']
2+
= Creating a template using Kubernetes custom 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+
ui:field: Secret
44+
description: Bearer token to authenticate with
45+
skipTLSVerify:
46+
title: Skip TLS verification
47+
type: boolean
48+
description: Skip TLS certificate verification, not recommended to use in production environment, default to false
49+
caData:
50+
title: CA data
51+
type: string
52+
ui:field: Secret
53+
description: Certificate Authority base64 encoded certificate
54+
labels:
55+
title: Labels
56+
type: string
57+
description: Labels to be applied to the namespace
58+
ui:widget: textarea
59+
ui:options:
60+
rows: 3
61+
ui:help: 'Hint: Separate multiple labels with a semicolon!'
62+
ui:placeholder: 'kubernetes.io/type=namespace; app.io/managed-by=org'
63+
64+
steps:
65+
- id: create-kubernetes-namespace
66+
name: Create kubernetes namespace
67+
action: kubernetes:create-namespace
68+
input:
69+
namespace: ${{ parameters.namespace }}
70+
clusterRef: ${{ parameters.clusterRef }}
71+
url: ${{ parameters.url }}
72+
token: ${{ secrets.token }}
73+
skipTLSVerify: ${{ parameters.skipTLSVerify }}
74+
caData: ${{ secrets.caData }}
75+
labels: ${{ parameters.labels }}
76+
77+
----
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[id='ref-supported-Kubernetes-custom-actions_{context}']
2+
= Supported Kubernetes custom 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+
Creates a namespace for the Kubernetes cluster in the {product-short}.
10+
11+
[cols="15%,15%,15%,40%,15%", frame="all", options="header"]
12+
|===
13+
|Parameter name
14+
|Type
15+
|Requirement
16+
|Description
17+
|Example
18+
19+
|`namespace`
20+
|`string`
21+
|Required
22+
|Name of the Kubernetes namespace
23+
|`{my-product-namespace}`
24+
25+
|`clusterRef`
26+
|`string`
27+
|Required only if `url` is not defined. You cannot specify both `url` and `clusterRef`.
28+
|Cluster resource entity reference from the catalog
29+
|`bar`
30+
31+
|`url`
32+
|`string`
33+
|Required only if `clusterRef` is not defined. You cannot specify both `url` and `clusterRef`.
34+
|API url of the Kubernetes cluster
35+
|`https://api.foo.redhat.com:6443`
36+
37+
|`token`
38+
|`String`
39+
|Required
40+
|Kubernetes API bearer token used for authentication
41+
|
42+
43+
|`skipTLSVerify`
44+
|`boolean`
45+
|Optional
46+
|If true, certificate verification is skipped
47+
|false
48+
49+
|`caData`
50+
|`string`
51+
|Optional
52+
|Base64 encoded certificate data
53+
|
54+
55+
|`label`
56+
|`string`
57+
|Optional
58+
|Labels applied to the namespace
59+
|app.io/type=ns; app.io/managed-by=org;
60+
|===

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)