This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@bestsellerit/backstage-plugin-gkeusage
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

Backstage GKE Usage plugin

Quality Gate Status npm

Welcome to the gkeusage backend plugin! This plugin will show you the cost and resource usage of your application within GKE

GKE USage

Getting started

Enabled GKE usage metering

Documentation on how to enable GKE usage metering can be found here

Create GPC service account

Create a GPC service account with BigQuery Data Viewer and BigQuery Job User permissions to your service project. Documentation can be found it here

Enabling frontend

cd package/app
yarn add @bestsellerit/backstage-plugin-gkeusage
// packages/app/src/plugins.ts
export { plugin as gkeusage } from '@bestsellerit/backstage-plugin-gkeusage';
// packages/app/src/components/catalog/EntityPage.tsx
import { EntityGKEUsageContent } from '@bestsellerit/backstage-plugin-gkeusage';

const serviceEntityPage = (
  <EntityPageLayout>
    // ...
    <EntityLayout.Route path="/gkeusage" title="GKE Usage">
      <EntityGKEUsageContent />
    </EntityLayout.Route>
  </EntityPageLayout>
)

Enabling backend

cd packages/backend
yarn add @bestsellerit/backstage-plugin-gkeusage-backend

Create a new file named packages/backend/src/plugins/gkeusage.ts, and add the following to it

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

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

And finally, wire this into the overall backend router. Edit packages/backend/src/index.ts

import gkeusage from './plugins/gkeusage';
// ...
async function main() {
  // ...
  const gkeusageEnv = useHotMemoize(module, () => createEnv('gkeusage'));
  apiRouter.use('/gkeusage', await gkeusage(gkeusageEnv));

Configuration

The plugin requires configuration in the Backstage app-config.yaml to connect googles bigquery API.

gkeUsage:
  billingTable: billingProjectId.billingDataSetId.billingTableId
  google_application_credentials: 
    $env: GOOGLE_APPLICATION_CREDENTIALS

Adding annotations and values to your component file.

apiVersion: backstage.io/v1alpha1
kind: System
metadata:
  name: sample-system
  description: "A sample system"
  annotations:
    gkeusage/dataset: projectID.Dataset
    gkeusage/namespace: default
    gkeusage/label: 'app:app-name'

Contributing

Everyone is welcome to contribute to this repository. Feel free to rase issues or to submit Pull Requests.

Readme

Keywords

none

Package Sidebar

Install

npm i @bestsellerit/backstage-plugin-gkeusage

Weekly Downloads

2

Version

0.3.0

License

Apache-2.0

Unpacked Size

38.5 kB

Total Files

15

Last publish

Collaborators

  • bs-engineeringservices
  • orkarstoft
  • lassegaardsholt
  • gaardsholt
  • pbrondum
  • andrei-predoiu