1.4.5 • Published 7 days ago

@janus-idp/backstage-scaffolder-backend-module-kubernetes v1.4.5

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
7 days ago

Kubernetes actions for Backstage

This module provides Backstage template actions for Kubernetes.

The following actions are currently supported in this module:

  • Create a kubernetes namespace

Installation

Run the following command to install the action package in your Backstage project

yarn workspace backend add @janus-idp/backstage-scaffolder-backend-module-kubernetes

Installing the action on the legacy backend

  1. Register the Kubenretes actions by modifying the packages/backend/src/plugins/scaffolder.ts file from your project with the following changes:

    import { CatalogClient } from '@backstage/catalog-client';
    import { ScmIntegrations } from '@backstage/integration';
    import {
      createBuiltinActions,
      createRouter,
    } from '@backstage/plugin-scaffolder-backend';
    
    import { Router } from 'express';
    
    import { createKubernetesNamespaceAction } from '@janus-idp/backstage-scaffolder-backend-module-kubernetes';
    
    import type { PluginEnvironment } from '../types';
    
    export default async function createPlugin(
      env: PluginEnvironment,
    ): Promise<Router> {
      const catalogClient = new CatalogClient({
        discoveryApi: env.discovery,
      });
    
      const integrations = ScmIntegrations.fromConfig(env.config);
    
      const builtInActions = createBuiltinActions({
        integrations,
        catalogClient,
        config: env.config,
        reader: env.reader,
      });
    
      const actions = [
        ...builtInActions,
        createKubernetesNamespaceAction(catalogClient),
      ];
    
      return await createRouter({
        actions,
        logger: env.logger,
        config: env.config,
        database: env.database,
        reader: env.reader,
        catalogClient,
        identity: env.identity,
      });
    }
  2. Optional: If you are doing the previous step for the first time, you also have to install the @backstage/integration package

    yarn workspace backend add @backstage/integration

Installing the action on the new backend

Add the following to your packages/backend/src/index.ts file:

const backend = createBackend();

// Add the following line
backend.add(
  import('@janus-idp/backstage-scaffolder-backend-module-kubernetes/alpha'),
);

backend.start();

Configuration

Add the Kubernetes actions to your templates, see the example file in this repository for complete usage examples

action: kubernetes:create-namespace
id: create-kubernetes-namespace
name: Create kubernetes namespace
input:
  namespace: foo
  clusterRef: bar
  token: TOKEN
  skipTLSVerify: false
  caData: Zm9v
  labels: app.io/type=ns; app.io/managed-by=org;

Usage

Action: kubernetes:create-namespace

Input

Parameter NameTypeRequiredDescriptionExample
namespacestringYesKubernetes namespace namefoo
clusterRefstringNoCluster resource entity reference from the catalogbar
urlstringNoAPI url of the kubernetes clusterhttps://api.foo.redhat.com:6443
tokenstringNoKubernetes API bearer token used for authentication
skipTLSVerifybooleanNoIf true, certificate verification is skippedfalse
caDatastringNoBase64 encoded certificate data
labelstringNoLabels that will be applied to the namespaceapp.io/type=ns; app.io/managed-by=org;

Output

This action doesn't have any outputs.

1.4.5

7 days ago

1.4.4

7 days ago

1.4.3

9 days ago

1.4.2

9 days ago

1.4.1

14 days ago

1.4.0

24 days ago

1.3.10

1 month ago

1.3.11

1 month ago

1.3.9

1 month ago

1.3.8

1 month ago

1.3.7

1 month ago

1.3.6

2 months ago

1.3.5

2 months ago

1.3.4

2 months ago

1.3.3

2 months ago

1.3.2

3 months ago

1.3.1

3 months ago

1.3.0

3 months ago

1.2.7

4 months ago

1.2.6

4 months ago

1.2.5

5 months ago

1.2.4

5 months ago

1.2.0

6 months ago

1.1.1

8 months ago

1.1.0

9 months ago

1.2.3

5 months ago

1.2.2

6 months ago

1.0.4

10 months ago

1.2.1

6 months ago

1.1.2

7 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago