npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kpt/backstage-plugin-cad-backend

v0.1.0

Published

Welcome to the Configuration as Data backend plugin!

Downloads

22

Readme

Configuration as Data Backend Plugin

Welcome to the Configuration as Data backend plugin!

Installation

Adding the plugin

Navigate to packages/backend of your Backstage app, and install the @kpt/backstage-plugin-cad-backend package.

# From your Backstage root directory
yarn add --cwd packages/backend @kpt/backstage-plugin-cad-backend

Next, you'll need to add the plugin to the router in your backend package. You can do this by creating a file called packages/backend/src/plugins/cad.ts

import { createRouter } from '@kpt/backstage-plugin-cad-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';

export default async function createPlugin(
  env: PluginEnvironment,
): Promise<Router> {
  return await createRouter({
    config: env.config,
    logger: env.logger,
  });
}

With the cad.ts router setup in place, add the router to packages/backend/src/index.ts:

import cad from './plugins/cad';
// ...

async function main() {
  // ...
  const cadEnv = useHotMemoize(module, () => createEnv('cad'));

  // ...
  apiRouter.use('/config-as-data', await cad(cadEnv));

Configuration

The following configuration will need to be added to app-config.yaml:

configAsData:
  # The namespace where Porch managed resources live.
  resourcesNamespace: default

  # Determines the GitOps delivery tool to use.
  gitOpsDeliveryTool: config-sync

  clusterLocatorMethod:
    # Determines how the client will locate the Kubernetes cluster.
    type: current-context

    # Determines how the client will authenticate with the Kubernetes cluster.
    authProvider: current-context

    # Optional. Determines the OIDC token provider to use when using the 'oidc' auth provider.
    oidcTokenProvider: okta

    # Optional. The service account token to be used when using the 'service-account' auth provider.
    serviceAccountToken: ${CAD_SERVICE_ACCOUNT_TOKEN}

resourcesNamespace defines the namespace where Porch managed resources live

gitOpsDeliveryTool determines what tool to use for GitOps

Valid values: | Values | Description | | ------ | ----------- | | none | Use no GitOps delivery tool | | config-sync | Use Config Sync. Config Sync must be installed on the cluster. |

clusterLocatorMethod determines where to receive the cluster configuration from

clusterLocatorMethod.type determines how the cluster will be located

Valid values: | Values | Description | | ------ | ----------- | | current-context | Connect to the cluster as defined by the kubeconfig current context | | in-cluster | Connect to the same cluster that Backstage is running in |

clusterLocatorMethod.authProvider determines how the client will authenticate with the cluster.

Valid values: | Values | Description | | ------ | ----------- | | current-context | Authenticate to the cluster with the user in the kubeconfig current context | | google | Authenticate to the cluster using the user's access token token from the Google auth provider | | oidc | Authenticate to the cluster using OIDC (OpenID Connect) | | service-account | Authenticate to the cluster using a Kubernetes service account token |

clusterLocatorMethod.oidcTokenProvider determines which configured Backstage auth provider to use to authenticate to the cluster with. This field is required with the oidc auth provider.

Valid values: | Values | Description | | ------ | ----------- | | google | Authenticate to the cluster with the Google auth provider | | okta | Authenticate to the cluster with the Okta auth provider |

clusterLocatorMethod.serviceAccountToken defines the service account token to be used with the service-account auth provider. You can get the service account token with the following command:

kubectl -n <NAMESPACE> get secret $(kubectl -n <NAMESPACE> get sa <SERVICE_ACCOUNT_NAME> -o=json \
  | jq -r '.secrets[0].name') -o=json \
  | jq -r '.data["token"]' \
  | base64 --decode