app

package
v2.419.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package app defines the Kubernetes application model and Pulumi resource creation helpers.

It is used by the `area/apps` Pulumi program to:

  • load application configuration (HJSON decoded into protobuf messages),
  • convert protobuf messages into internal Go types, and
  • create Kubernetes resources (Deployment, Service, Ingress, etc.) for each application.

The functions in this package are intended to be deterministic given the same input configuration and are safe to use with Pulumi mocks in unit tests.

Index

Constants

This section is empty.

Variables

View Source
var ErrVersionMismatch = errors.New("version mismatch")

ErrVersionMismatch indicates that an application's deployed version does not match the configured version.

Note: this error is defined for callers to use as a sentinel; it is not necessarily produced by functions in this file.

Functions

func CreateApplication

func CreateApplication(ctx *pulumi.Context, app *App) error

CreateApplication creates all Kubernetes resources required for app in the target cluster.

Resources are created in a fixed order to ensure dependencies exist (for example, ServiceAccount before Deployment). Any error aborts the creation flow and is returned.

func ReadConfiguration

func ReadConfiguration(path string) (*v2.Kubernetes, error)

ReadConfiguration reads the Kubernetes applications configuration from path.

The file is expected to be HJSON matching the v2.Kubernetes protobuf schema.

func WriteConfiguration added in v2.264.0

func WriteConfiguration(path string, configuration *v2.Kubernetes) error

WriteConfiguration writes configuration to path in the repository's canonical HJSON form.

The underlying writer preserves the destination file mode and appends a trailing newline.

Types

type App

type App struct {
	// Resources are optional resource requests/limits to apply to the pod.
	Resources *Resources
	// ID is an optional identifier from configuration.
	ID string
	// Name is the Kubernetes application name (used for resource naming).
	Name string
	// Kind determines how the application is deployed (for example "internal" vs "external").
	Kind string
	// Namespace is the Kubernetes namespace to deploy into.
	Namespace string
	// Domain is the external hostname associated with the application.
	Domain string
	// Version is the application version string used for deployment (for example as an image tag).
	Version string
	// Secrets is a list of secret names referenced by this application.
	Secrets []string
	// EnvVars are environment variables to be injected into the application container.
	EnvVars []*EnvVar
}

App describes an application that will be deployed to Kubernetes.

It is derived from v2.Application and is used as the input to resource constructors within this package.

func ConvertApplication

func ConvertApplication(a *v2.Application) *App

ConvertApplication converts a protobuf v2.Application into the internal App model.

This conversion normalizes optional fields (for example env vars) into Go-friendly structures that are later used to create Kubernetes resources.

func (*App) HasResources

func (a *App) HasResources() bool

HasResources reports whether a has resource requirements configured.

func (*App) IsExternal

func (a *App) IsExternal() bool

IsExternal reports whether this application is not built/published by this repository.

func (*App) IsInternal

func (a *App) IsInternal() bool

IsInternal reports whether this application uses the repository's opinionated deployment model.

Internal applications are typically built/published by this repository and deployed using a conventional container image naming scheme.

type EnvVar added in v2.190.0

type EnvVar struct {
	Name  string
	Value string
}

EnvVar represents an environment variable to inject into the application container.

func (*EnvVar) IsSecret added in v2.190.0

func (e *EnvVar) IsSecret() bool

IsSecret reports whether the env var value refers to a secret.

Secret values are encoded using the "secret:" prefix and are resolved by this package into Kubernetes Secret references during resource creation.

type Range

type Range struct {
	Min string
	Max string
}

Range represents a min/max range expressed as Kubernetes quantity strings.

type Resources

type Resources struct {
	CPU     *Range
	Memory  *Range
	Storage *Range
}

Resources describes optional CPU/memory/storage ranges for an application's pod.

type ResourcesMap added in v2.160.0

type ResourcesMap map[string]*Resources

ResourcesMap got app.

func (ResourcesMap) Resources added in v2.160.0

func (r ResourcesMap) Resources(name string) *Resources

Resources by name if found, otherwise small.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL