Skip to main content

Overview

PennLabsChart is the foundational chart class that extends CDK8s’s Chart construct. It automatically configures standard Kubernetes labels and metadata for Penn Labs applications.

Class Definition

export class PennLabsChart extends Chart {
  constructor(scope: Construct, name?: string, props?: ChartProps)
}

Constructor Parameters

scope
Construct
required
The parent construct (typically an App instance)
name
string
default:"pennlabs"
The name of the chart
props
ChartProps
Chart configuration properties
namespace
string
Kubernetes namespace for the chart resources
labels
Record<string, string>
Additional labels to merge with default labels

Automatic Labels

PennLabsChart automatically applies the following labels to all resources:
  • app.kubernetes.io/part-of: Set from RELEASE_NAME environment variable (defaults to “undefined_release”)
  • app.kubernetes.io/version: Set from required GIT_SHA environment variable
  • app.kubernetes.io/managed-by: Always set to “kittyhawk”

Environment Variables

GIT_SHA
string
required
Git commit SHA for versioning. Required - the chart will exit if not provided.
RELEASE_NAME
string
default:"undefined_release"
Name of the release for the app.kubernetes.io/part-of label

Usage Example

import { App } from 'cdk8s';
import { PennLabsChart } from './chart';

const app = new App();

const chart = new PennLabsChart(app, 'my-app', {
  namespace: 'production',
  labels: {
    'team': 'platform',
    'environment': 'prod'
  }
});

Source Reference

Defined in src/chart.ts:4

Build docs developers (and LLMs) love