Chapter 10. Kubernetes custom actions in Red Hat Developer Hub
With Kubernetes custom actions, you can create and manage Kubernetes resources.
The Kubernetes custom actions plugin is preinstalled and disabled on a Developer Hub instance by default. You can disable or enable the Kubernetes custom actions plugin, and change other parameters, by configuring the Red Hat Developer Hub Helm chart.
Kubernetes scaffolder actions and Kubernetes custom actions refer to the same concept throughout this documentation.
10.1. Enabling Kubernetes custom actions plugin in Red Hat Developer Hub Copy linkLink copied to clipboard!
In Red Hat Developer Hub, 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.
Prerequisites
- You have installed Red Hat Developer Hub with the Helm chart.
Procedure
To enable the Kubernetes custom actions plugin, complete the following step:
In your Helm chart, add a
package
with the Kubernetes custom action plugin name and update thedisabled
field. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe default configuration for a plugin is extracted from the
dynamic-plugins.default.yaml
file, however, you can use apluginConfig
entry to override the default configuration.
10.2. Using Kubernetes custom actions plugin in Red Hat Developer Hub Copy linkLink copied to clipboard!
In Red Hat Developer Hub, the Kubernetes custom actions enable you to run template actions for Kubernetes.
Procedure
To use a Kubernetes custom action in your custom template, add the following Kubernetes actions to your template:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.3. Creating a template using Kubernetes custom actions in Red Hat Developer Hub Copy linkLink copied to clipboard!
You can create a template by defining a Template
object as a YAML file.
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.
+
10.3.1. Supported Kubernetes custom actions in Red Hat Developer Hub Copy linkLink copied to clipboard!
In Red Hat Developer Hub, you can use custom Kubernetes actions in scaffolder templates.
Custom Kubernetes scaffolder actions
- Action: kubernetes:create-namespace
- Creates a namespace for the Kubernetes cluster in the Developer Hub.
Parameter name | Type | Requirement | Description | Example |
---|---|---|---|---|
|
| Required | Name of the Kubernetes namespace |
|
|
|
Required only if | Cluster resource entity reference from the catalog |
|
|
|
Required only if | API url of the Kubernetes cluster | |
|
| Required | Kubernetes API bearer token used for authentication | |
|
| Optional | If true, certificate verification is skipped | false |
|
| Optional | Base64 encoded certificate data | |
|
| Optional | Labels applied to the namespace | app.io/type=ns; app.io/managed-by=org; |