cdk8s

package module
v1.10.78 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 6 Imported by: 12

README

cdk8s

Cloud Development Kit for Kubernetes

build npm version PyPI version Maven Central

cdk8s is a software development framework for defining Kubernetes applications using rich object-oriented APIs. It allows developers to leverage the full power of software in order to define abstract components called "constructs" which compose Kubernetes resources or other constructs into higher-level abstractions.

Note: This repository is the "core library" of cdk8s, with logic for synthesizing Kubernetes manifests using the constructs framework. It is published to NPM as cdk8s and should not be confused with the cdk8s command-line tool cdk8s-cli. For more general information about cdk8s, please see cdk8s.io, or visit the umbrella repository located at cdk8s-team/cdk8s.

Documentation

See cdk8s.io.

License

This project is distributed under the Apache License, Version 2.0.

This module is part of the cdk8s project.

Documentation

Overview

This is the core library of Cloud Development Kit (CDK) for Kubernetes (cdk8s). cdk8s apps synthesize into standard Kubernetes manifests which can be applied to any Kubernetes cluster.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApiObject_IsApiObject added in v1.10.30

func ApiObject_IsApiObject(o interface{}) *bool

Return whether the given object is an `ApiObject`.

We do attribute detection since we can't reliably use 'instanceof'.

func Chart_IsChart added in v1.5.55

func Chart_IsChart(x interface{}) *bool

Return whether the given object is a Chart.

We do attribute detection since we can't reliably use 'instanceof'.

func JsonPatch_Apply

func JsonPatch_Apply(document interface{}, ops ...JsonPatch) interface{}

Applies a set of JSON-Patch (RFC-6902) operations to `document` and returns the result.

Returns: The result document.

func Lazy_Any

func Lazy_Any(producer IAnyProducer) interface{}

func Names_ToDnsLabel

func Names_ToDnsLabel(scope constructs.Construct, options *NameOptions) *string

Generates a unique and stable name compatible DNS_LABEL from RFC-1123 from a path.

The generated name will:

  • contain at most 63 characters
  • contain only lowercase alphanumeric characters or ‘-’
  • start with an alphanumeric character
  • end with an alphanumeric character

The generated name will have the form:

<comp0>-<comp1>-..-<compN>-<short-hash>

Where <comp> are the path components (assuming they are is separated by "/").

Note that if the total length is longer than 63 characters, we will trim the first components since the last components usually encode more meaning.

func Names_ToLabelValue

func Names_ToLabelValue(scope constructs.Construct, options *NameOptions) *string

Generates a unique and stable name compatible label key name segment and label value from a path.

The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.

Valid label values must be 63 characters or less and must be empty or begin and end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.

The generated name will have the form:

<comp0><delim><comp1><delim>..<delim><compN><delim><short-hash>

Where <comp> are the path components (assuming they are is separated by "/").

Note that if the total length is longer than 63 characters, we will trim the first components since the last components usually encode more meaning.

func NewApiObjectMetadataDefinition_Override

func NewApiObjectMetadataDefinition_Override(a ApiObjectMetadataDefinition, options *ApiObjectMetadata)

func NewApiObject_Override

func NewApiObject_Override(a ApiObject, scope constructs.Construct, id *string, props *ApiObjectProps)

Defines an API object.

func NewApp_Override

func NewApp_Override(a App, props *AppProps)

Defines an app.

func NewChart_Override

func NewChart_Override(c Chart, scope constructs.Construct, id *string, props *ChartProps)

func NewCron_Override added in v1.7.15

func NewCron_Override(c Cron, cronOptions *CronOptions)

func NewDependencyGraph_Override

func NewDependencyGraph_Override(d DependencyGraph, node constructs.Node)

func NewDependencyVertex_Override

func NewDependencyVertex_Override(d DependencyVertex, value constructs.IConstruct)

func NewHelm_Override

func NewHelm_Override(h Helm, scope constructs.Construct, id *string, props *HelmProps)

func NewInclude_Override

func NewInclude_Override(i Include, scope constructs.Construct, id *string, props *IncludeProps)

func Testing_Synth

func Testing_Synth(chart Chart) *[]interface{}

Returns the Kubernetes manifest synthesized from this chart.

func Yaml_FormatObjects deprecated added in v1.2.0

func Yaml_FormatObjects(docs *[]interface{}) *string

Deprecated: use `stringify(doc[, doc, ...])`

func Yaml_Load

func Yaml_Load(urlOrFile *string) *[]interface{}

Downloads a set of YAML documents (k8s manifest for example) from a URL or a file and returns them as javascript objects.

Empty documents are filtered out.

Returns: an array of objects, each represents a document inside the YAML.

func Yaml_Save

func Yaml_Save(filePath *string, docs *[]interface{})

Saves a set of objects as a multi-document YAML file.

func Yaml_Stringify

func Yaml_Stringify(docs ...interface{}) *string

Stringify a document (or multiple documents) into YAML.

We convert undefined values to null, but ignore any documents that are undefined.

Returns: a YAML string. Multiple docs are separated by `---`.

func Yaml_Tmp

func Yaml_Tmp(docs *[]interface{}) *string

Saves a set of YAML documents into a temp file (in /tmp).

Returns: the path to the temporary file.

Types

type ApiObject

type ApiObject interface {
	constructs.Construct
	// The group portion of the API version (e.g. `authorization.k8s.io`).
	ApiGroup() *string
	// The object's API version (e.g. `authorization.k8s.io/v1`).
	ApiVersion() *string
	// The chart in which this object is defined.
	Chart() Chart
	// The object kind.
	Kind() *string
	// Metadata associated with this API object.
	Metadata() ApiObjectMetadataDefinition
	// The name of the API object.
	//
	// If a name is specified in `metadata.name` this will be the name returned.
	// Otherwise, a name will be generated by calling
	// `Chart.of(this).generatedObjectName(this)`, which by default uses the
	// construct path to generate a DNS-compatible name for the resource.
	Name() *string
	// Create a dependency between this ApiObject and other constructs.
	//
	// These can be other ApiObjects, Charts, or custom.
	AddDependency(dependencies ...constructs.IConstruct)
	// Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object.
	//
	// Example:
	//     kubePod.addJsonPatch(JsonPatch.replace('/spec/enableServiceLinks', true));
	//
	AddJsonPatch(ops ...JsonPatch)
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if there the construct is valid.
	// Deprecated: use `Node.addValidation()` to subscribe validation functions on this construct
	// instead of overriding this method.
	OnValidate() *[]*string
	// Renders the object to Kubernetes JSON.
	//
	// To disable sorting of dictionary keys in output object set the
	// `CDK8S_DISABLE_SORT` environment variable to any non-empty value.
	ToJson() interface{}
	// Returns a string representation of this construct.
	ToString() *string
}

func ApiObject_Of

func ApiObject_Of(c constructs.IConstruct) ApiObject

Returns the `ApiObject` named `Resource` which is a child of the given construct.

If `c` is an `ApiObject`, it is returned directly. Throws an exception if the construct does not have a child named `Default` _or_ if this child is not an `ApiObject`.

func NewApiObject

func NewApiObject(scope constructs.Construct, id *string, props *ApiObjectProps) ApiObject

Defines an API object.

type ApiObjectMetadata

type ApiObjectMetadata struct {
	// Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata.
	//
	// They are not queryable and should be
	// preserved when modifying objects.
	// See: http://kubernetes.io/docs/user-guide/annotations
	//
	Annotations *map[string]*string `field:"optional" json:"annotations" yaml:"annotations"`
	// Namespaced keys that tell Kubernetes to wait until specific conditions are met before it fully deletes resources marked for deletion.
	//
	// Must be empty before the object is deleted from the registry. Each entry is
	// an identifier for the responsible component that will remove the entry from
	// the list. If the deletionTimestamp of the object is non-nil, entries in
	// this list can only be removed. Finalizers may be processed and removed in
	// any order.  Order is NOT enforced because it introduces significant risk of
	// stuck finalizers. finalizers is a shared field, any actor with permission
	// can reorder it. If the finalizer list is processed in order, then this can
	// lead to a situation in which the component responsible for the first
	// finalizer in the list is waiting for a signal (field value, external
	// system, or other) produced by a component responsible for a finalizer later
	// in the list, resulting in a deadlock. Without enforced ordering finalizers
	// are free to order amongst themselves and are not vulnerable to ordering
	// changes in the list.
	// See: https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers/
	//
	Finalizers *[]*string `field:"optional" json:"finalizers" yaml:"finalizers"`
	// Map of string keys and values that can be used to organize and categorize (scope and select) objects.
	//
	// May match selectors of replication controllers and services.
	// See: http://kubernetes.io/docs/user-guide/labels
	//
	Labels *map[string]*string `field:"optional" json:"labels" yaml:"labels"`
	// The unique, namespace-global, name of this object inside the Kubernetes cluster.
	//
	// Normally, you shouldn't specify names for objects and let the CDK generate
	// a name for you that is application-unique. The names CDK generates are
	// composed from the construct path components, separated by dots and a suffix
	// that is based on a hash of the entire path, to ensure uniqueness.
	//
	// You can supply custom name allocation logic by overriding the
	// `chart.generateObjectName` method.
	//
	// If you use an explicit name here, bear in mind that this reduces the
	// composability of your construct because it won't be possible to include
	// more than one instance in any app. Therefore it is highly recommended to
	// leave this unspecified.
	Name *string `field:"optional" json:"name" yaml:"name"`
	// Namespace defines the space within each name must be unique.
	//
	// An empty namespace is equivalent to the "default" namespace, but "default" is the canonical representation.
	// Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty. Must be a DNS_LABEL. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/namespaces
	Namespace *string `field:"optional" json:"namespace" yaml:"namespace"`
	// List of objects depended by this object.
	//
	// If ALL objects in the list have
	// been deleted, this object will be garbage collected. If this object is
	// managed by a controller, then an entry in this list will point to this
	// controller, with the controller field set to true. There cannot be more
	// than one managing controller.
	//
	// Kubernetes sets the value of this field automatically for objects that are
	// dependents of other objects like ReplicaSets, DaemonSets, Deployments, Jobs
	// and CronJobs, and ReplicationControllers. You can also configure these
	// relationships manually by changing the value of this field. However, you
	// usually don't need to and can allow Kubernetes to automatically manage the
	// relationships.
	// See: https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/
	//
	OwnerReferences *[]*OwnerReference `field:"optional" json:"ownerReferences" yaml:"ownerReferences"`
}

Metadata associated with this object.

type ApiObjectMetadataDefinition

type ApiObjectMetadataDefinition interface {
	// The name of the API object.
	//
	// If a name is specified in `metadata.name` this will be the name returned.
	// Otherwise, a name will be generated by calling
	// `Chart.of(this).generatedObjectName(this)`, which by default uses the
	// construct path to generate a DNS-compatible name for the resource.
	Name() *string
	// The object's namespace.
	Namespace() *string
	// Adds an arbitrary key/value to the object metadata.
	Add(key *string, value interface{})
	// Add an annotation.
	AddAnnotation(key *string, value *string)
	// Add one or more finalizers.
	AddFinalizers(finalizers ...*string)
	// Add a label.
	AddLabel(key *string, value *string)
	// Add an owner.
	AddOwnerReference(owner *OwnerReference)
	// Returns: a value of a label or undefined.
	GetLabel(key *string) *string
	// Synthesizes a k8s ObjectMeta for this metadata set.
	ToJson() interface{}
}

Object metadata.

func NewApiObjectMetadataDefinition

func NewApiObjectMetadataDefinition(options *ApiObjectMetadata) ApiObjectMetadataDefinition

type ApiObjectProps

type ApiObjectProps struct {
	// API version.
	ApiVersion *string `field:"required" json:"apiVersion" yaml:"apiVersion"`
	// Resource kind.
	Kind *string `field:"required" json:"kind" yaml:"kind"`
	// Object metadata.
	//
	// If `name` is not specified, an app-unique name will be allocated by the
	// framework based on the path of the construct within thes construct tree.
	Metadata *ApiObjectMetadata `field:"optional" json:"metadata" yaml:"metadata"`
}

Options for defining API objects.

type App

type App interface {
	constructs.Construct
	// Returns all the charts in this app, sorted topologically.
	Charts() *[]Chart
	// The output directory into which manifests will be synthesized.
	Outdir() *string
	// The file extension to use for rendered YAML files.
	OutputFileExtension() *string
	// How to divide the YAML output into files.
	YamlOutputType() YamlOutputType
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if there the construct is valid.
	// Deprecated: use `Node.addValidation()` to subscribe validation functions on this construct
	// instead of overriding this method.
	OnValidate() *[]*string
	// Synthesizes all manifests to the output directory.
	Synth()
	// Synthesizes the app into a YAML string.
	//
	// Returns: A string with all YAML objects across all charts in this app.
	SynthYaml() *string
	// Returns a string representation of this construct.
	ToString() *string
}

Represents a cdk8s application.

func NewApp

func NewApp(props *AppProps) App

Defines an app.

func Testing_App

func Testing_App(props *AppProps) App

Returns an app for testing with the following properties: - Output directory is a temp dir.

type AppProps

type AppProps struct {
	// The directory to output Kubernetes manifests.
	//
	// If you synthesize your application using `cdk8s synth`, you must
	// also pass this value to the CLI using the `--output` option or
	// the `output` property in the `cdk8s.yaml` configuration file.
	// Otherwise, the CLI will not know about the output directory,
	// and synthesis will fail.
	//
	// This property is intended for internal and testing use.
	Outdir *string `field:"optional" json:"outdir" yaml:"outdir"`
	// The file extension to use for rendered YAML files.
	OutputFileExtension *string `field:"optional" json:"outputFileExtension" yaml:"outputFileExtension"`
	// When set to true, the output directory will contain a `construct-metadata.json` file that holds construct related metadata on every resource in the app.
	RecordConstructMetadata *bool `field:"optional" json:"recordConstructMetadata" yaml:"recordConstructMetadata"`
	// How to divide the YAML output into files.
	YamlOutputType YamlOutputType `field:"optional" json:"yamlOutputType" yaml:"yamlOutputType"`
}

type Chart

type Chart interface {
	constructs.Construct
	// Labels applied to all resources in this chart.
	//
	// This is an immutable copy.
	Labels() *map[string]*string
	// The default namespace for all objects in this chart.
	Namespace() *string
	// Create a dependency between this Chart and other constructs.
	//
	// These can be other ApiObjects, Charts, or custom.
	AddDependency(dependencies ...constructs.IConstruct)
	// Generates a app-unique name for an object given it's construct node path.
	//
	// Different resource types may have different constraints on names
	// (`metadata.name`). The previous version of the name generator was
	// compatible with DNS_SUBDOMAIN but not with DNS_LABEL.
	//
	// For example, `Deployment` names must comply with DNS_SUBDOMAIN while
	// `Service` names must comply with DNS_LABEL.
	//
	// Since there is no formal specification for this, the default name
	// generation scheme for kubernetes objects in cdk8s was changed to DNS_LABEL,
	// since it’s the common denominator for all kubernetes resources
	// (supposedly).
	//
	// You can override this method if you wish to customize object names at the
	// chart level.
	GenerateObjectName(apiObject ApiObject) *string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if there the construct is valid.
	// Deprecated: use `Node.addValidation()` to subscribe validation functions on this construct
	// instead of overriding this method.
	OnValidate() *[]*string
	// Renders this chart to a set of Kubernetes JSON resources.
	//
	// Returns: array of resource manifests.
	ToJson() *[]interface{}
	// Returns a string representation of this construct.
	ToString() *string
}

func Chart_Of

func Chart_Of(c constructs.IConstruct) Chart

Finds the chart in which a node is defined.

func NewChart

func NewChart(scope constructs.Construct, id *string, props *ChartProps) Chart

func Testing_Chart

func Testing_Chart() Chart

Returns: a Chart that can be used for tests.

type ChartProps

type ChartProps struct {
	// The autogenerated resource name by default is suffixed with a stable hash of the construct path.
	//
	// Setting this property to true drops the hash suffix.
	DisableResourceNameHashes *bool `field:"optional" json:"disableResourceNameHashes" yaml:"disableResourceNameHashes"`
	// Labels to apply to all resources in this chart.
	Labels *map[string]*string `field:"optional" json:"labels" yaml:"labels"`
	// The default namespace for all objects defined in this chart (directly or indirectly).
	//
	// This namespace will only apply to objects that don't have a
	// `namespace` explicitly defined for them.
	Namespace *string `field:"optional" json:"namespace" yaml:"namespace"`
}

type Cron added in v1.7.15

type Cron interface {
	// Retrieve the expression for this schedule.
	ExpressionString() *string
}

Represents a cron schedule.

func Cron_Annually added in v1.7.15

func Cron_Annually() Cron

Create a cron schedule which runs first day of January every year.

func Cron_Daily added in v1.7.15

func Cron_Daily() Cron

Create a cron schedule which runs every day at midnight.

func Cron_EveryMinute added in v1.7.15

func Cron_EveryMinute() Cron

Create a cron schedule which runs every minute.

func Cron_Hourly added in v1.7.15

func Cron_Hourly() Cron

Create a cron schedule which runs every hour.

func Cron_Monthly added in v1.7.15

func Cron_Monthly() Cron

Create a cron schedule which runs first day of every month.

func Cron_Schedule added in v1.7.15

func Cron_Schedule(options *CronOptions) Cron

Create a custom cron schedule from a set of cron fields.

func Cron_Weekly added in v1.7.15

func Cron_Weekly() Cron

Create a cron schedule which runs every week on Sunday.

func NewCron added in v1.7.15

func NewCron(cronOptions *CronOptions) Cron

type CronOptions added in v1.7.0

type CronOptions struct {
	// The day of the month to run this rule at.
	Day *string `field:"optional" json:"day" yaml:"day"`
	// The hour to run this rule at.
	Hour *string `field:"optional" json:"hour" yaml:"hour"`
	// The minute to run this rule at.
	Minute *string `field:"optional" json:"minute" yaml:"minute"`
	// The month to run this rule at.
	Month *string `field:"optional" json:"month" yaml:"month"`
	// The day of the week to run this rule at.
	WeekDay *string `field:"optional" json:"weekDay" yaml:"weekDay"`
}

Options to configure a cron expression.

All fields are strings so you can use complex expressions. Absence of a field implies '*'.

type DependencyGraph

type DependencyGraph interface {
	// Returns the root of the graph.
	//
	// Note that this vertex will always have `null` as its `.value` since it is an artifical root
	// that binds all the connected spaces of the graph.
	Root() DependencyVertex
	// See: Vertex.topology()
	//
	Topology() *[]constructs.IConstruct
}

Represents the dependency graph for a given Node.

This graph includes the dependency relationships between all nodes in the node (construct) sub-tree who's root is this Node.

Note that this means that lonely nodes (no dependencies and no dependants) are also included in this graph as childless children of the root node of the graph.

The graph does not include cross-scope dependencies. That is, if a child on the current scope depends on a node from a different scope, that relationship is not represented in this graph.

func NewDependencyGraph

func NewDependencyGraph(node constructs.Node) DependencyGraph

type DependencyVertex

type DependencyVertex interface {
	// Returns the parents of the vertex (i.e dependants).
	Inbound() *[]DependencyVertex
	// Returns the children of the vertex (i.e dependencies).
	Outbound() *[]DependencyVertex
	// Returns the IConstruct this graph vertex represents.
	//
	// `null` in case this is the root of the graph.
	Value() constructs.IConstruct
	// Adds a vertex as a dependency of the current node.
	//
	// Also updates the parents of `dep`, so that it contains this node as a parent.
	//
	// This operation will fail in case it creates a cycle in the graph.
	AddChild(dep DependencyVertex)
	// Returns a topologically sorted array of the constructs in the sub-graph.
	Topology() *[]constructs.IConstruct
}

Represents a vertex in the graph.

The value of each vertex is an `IConstruct` that is accessible via the `.value` getter.

func NewDependencyVertex

func NewDependencyVertex(value constructs.IConstruct) DependencyVertex

type Duration

type Duration interface {
	// Return the total number of days in this Duration.
	//
	// Returns: the value of this `Duration` expressed in Days.
	ToDays(opts *TimeConversionOptions) *float64
	// Return the total number of hours in this Duration.
	//
	// Returns: the value of this `Duration` expressed in Hours.
	ToHours(opts *TimeConversionOptions) *float64
	// Turn this duration into a human-readable string.
	ToHumanString() *string
	// Return an ISO 8601 representation of this period.
	//
	// Returns: a string starting with 'PT' describing the period.
	// See: https://www.iso.org/fr/standard/70907.html
	//
	ToIsoString() *string
	// Return the total number of milliseconds in this Duration.
	//
	// Returns: the value of this `Duration` expressed in Milliseconds.
	ToMilliseconds(opts *TimeConversionOptions) *float64
	// Return the total number of minutes in this Duration.
	//
	// Returns: the value of this `Duration` expressed in Minutes.
	ToMinutes(opts *TimeConversionOptions) *float64
	// Return the total number of seconds in this Duration.
	//
	// Returns: the value of this `Duration` expressed in Seconds.
	ToSeconds(opts *TimeConversionOptions) *float64
	// Return unit of Duration.
	UnitLabel() *string
}

Represents a length of time.

The amount can be specified either as a literal value (e.g: `10`) which cannot be negative.

func Duration_Days

func Duration_Days(amount *float64) Duration

Create a Duration representing an amount of days.

Returns: a new `Duration` representing `amount` Days.

func Duration_Hours

func Duration_Hours(amount *float64) Duration

Create a Duration representing an amount of hours.

Returns: a new `Duration` representing `amount` Hours.

func Duration_Millis

func Duration_Millis(amount *float64) Duration

Create a Duration representing an amount of milliseconds.

Returns: a new `Duration` representing `amount` ms.

func Duration_Minutes

func Duration_Minutes(amount *float64) Duration

Create a Duration representing an amount of minutes.

Returns: a new `Duration` representing `amount` Minutes.

func Duration_Parse

func Duration_Parse(duration *string) Duration

Parse a period formatted according to the ISO 8601 standard.

Returns: the parsed `Duration`. See: https://www.iso.org/fr/standard/70907.html

func Duration_Seconds

func Duration_Seconds(amount *float64) Duration

Create a Duration representing an amount of seconds.

Returns: a new `Duration` representing `amount` Seconds.

type GroupVersionKind

type GroupVersionKind struct {
	// The object's API version (e.g. `authorization.k8s.io/v1`).
	ApiVersion *string `field:"required" json:"apiVersion" yaml:"apiVersion"`
	// The object kind.
	Kind *string `field:"required" json:"kind" yaml:"kind"`
}

type Helm

type Helm interface {
	Include
	// Returns all the included API objects.
	ApiObjects() *[]ApiObject
	// The helm release name.
	ReleaseName() *string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if there the construct is valid.
	// Deprecated: use `Node.addValidation()` to subscribe validation functions on this construct
	// instead of overriding this method.
	OnValidate() *[]*string
	// Returns a string representation of this construct.
	ToString() *string
}

Represents a Helm deployment.

Use this construct to import an existing Helm chart and incorporate it into your constructs.

func NewHelm

func NewHelm(scope constructs.Construct, id *string, props *HelmProps) Helm

type HelmProps

type HelmProps struct {
	// The chart name to use. It can be a chart from a helm repository or a local directory.
	//
	// This name is passed to `helm template` and has all the relevant semantics.
	//
	// Example:
	//   "bitnami/redis"
	//
	Chart *string `field:"required" json:"chart" yaml:"chart"`
	// The local helm executable to use in order to create the manifest the chart.
	HelmExecutable *string `field:"optional" json:"helmExecutable" yaml:"helmExecutable"`
	// Additional flags to add to the `helm` execution.
	HelmFlags *[]*string `field:"optional" json:"helmFlags" yaml:"helmFlags"`
	// Scope all resources in to a given namespace.
	Namespace *string `field:"optional" json:"namespace" yaml:"namespace"`
	// The release name.
	// See: https://helm.sh/docs/intro/using_helm/#three-big-concepts
	//
	ReleaseName *string `field:"optional" json:"releaseName" yaml:"releaseName"`
	// Chart repository url where to locate the requested chart.
	Repo *string `field:"optional" json:"repo" yaml:"repo"`
	// Values to pass to the chart.
	Values *map[string]interface{} `field:"optional" json:"values" yaml:"values"`
	// Version constraint for the chart version to use.
	//
	// This constraint can be a specific tag (e.g. 1.1.1)
	// or it may reference a valid range (e.g. ^2.0.0).
	// If this is not specified, the latest version is used
	//
	// This name is passed to `helm template --version` and has all the relevant semantics.
	//
	// Example:
	//   "^2.0.0"
	//
	Version *string `field:"optional" json:"version" yaml:"version"`
}

Options for `Helm`.

type IAnyProducer

type IAnyProducer interface {
	Produce() interface{}
}

type Include

type Include interface {
	constructs.Construct
	// Returns all the included API objects.
	ApiObjects() *[]ApiObject
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if there the construct is valid.
	// Deprecated: use `Node.addValidation()` to subscribe validation functions on this construct
	// instead of overriding this method.
	OnValidate() *[]*string
	// Returns a string representation of this construct.
	ToString() *string
}

Reads a YAML manifest from a file or a URL and defines all resources as API objects within the defined scope.

The names (`metadata.name`) of imported resources will be preserved as-is from the manifest.

func NewInclude

func NewInclude(scope constructs.Construct, id *string, props *IncludeProps) Include

type IncludeProps

type IncludeProps struct {
	// Local file path or URL which includes a Kubernetes YAML manifest.
	//
	// Example:
	//   mymanifest.yaml
	//
	Url *string `field:"required" json:"url" yaml:"url"`
}

type JsonPatch

type JsonPatch interface {
}

Utility for applying RFC-6902 JSON-Patch to a document.

Use the the `JsonPatch.apply(doc, ...ops)` function to apply a set of operations to a JSON document and return the result.

Operations can be created using the factory methods `JsonPatch.add()`, `JsonPatch.remove()`, etc.

Example:

const output = JsonPatch.apply(input,
 JsonPatch.replace('/world/hi/there', 'goodbye'),
 JsonPatch.add('/world/foo/', 'boom'),
 JsonPatch.remove('/hello'));

func JsonPatch_Add

func JsonPatch_Add(path *string, value interface{}) JsonPatch

Adds a value to an object or inserts it into an array.

In the case of an array, the value is inserted before the given index. The - character can be used instead of an index to insert at the end of an array.

Example:

JsonPatch.add('/biscuits/1', { "name": "Ginger Nut" })

func JsonPatch_Copy

func JsonPatch_Copy(from *string, path *string) JsonPatch

Copies a value from one location to another within the JSON document.

Both from and path are JSON Pointers.

Example:

JsonPatch.copy('/biscuits/0', '/best_biscuit')

func JsonPatch_Move

func JsonPatch_Move(from *string, path *string) JsonPatch

Moves a value from one location to the other.

Both from and path are JSON Pointers.

Example:

JsonPatch.move('/biscuits', '/cookies')

func JsonPatch_Remove

func JsonPatch_Remove(path *string) JsonPatch

Removes a value from an object or array.

Example:

JsonPatch.remove('/biscuits/0')

func JsonPatch_Replace

func JsonPatch_Replace(path *string, value interface{}) JsonPatch

Replaces a value.

Equivalent to a “remove” followed by an “add”.

Example:

JsonPatch.replace('/biscuits/0/name', 'Chocolate Digestive')

func JsonPatch_Test

func JsonPatch_Test(path *string, value interface{}) JsonPatch

Tests that the specified value is set in the document.

If the test fails, then the patch as a whole should not apply.

Example:

JsonPatch.test('/best_biscuit/name', 'Choco Leibniz')

type Lazy

type Lazy interface {
	Produce() interface{}
}

type NameOptions

type NameOptions struct {
	// Delimiter to use between components.
	Delimiter *string `field:"optional" json:"delimiter" yaml:"delimiter"`
	// Extra components to include in the name.
	Extra *[]*string `field:"optional" json:"extra" yaml:"extra"`
	// Include a short hash as last part of the name.
	IncludeHash *bool `field:"optional" json:"includeHash" yaml:"includeHash"`
	// Maximum allowed length for the name.
	MaxLen *float64 `field:"optional" json:"maxLen" yaml:"maxLen"`
}

Options for name generation.

type Names

type Names interface {
}

Utilities for generating unique and stable names.

type OwnerReference added in v1.1.0

type OwnerReference struct {
	// API version of the referent.
	ApiVersion *string `field:"required" json:"apiVersion" yaml:"apiVersion"`
	// Kind of the referent.
	// See: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
	//
	Kind *string `field:"required" json:"kind" yaml:"kind"`
	// Name of the referent.
	// See: http://kubernetes.io/docs/user-guide/identifiers#names
	//
	Name *string `field:"required" json:"name" yaml:"name"`
	// UID of the referent.
	// See: http://kubernetes.io/docs/user-guide/identifiers#uids
	//
	Uid *string `field:"required" json:"uid" yaml:"uid"`
	// If true, AND if the owner has the "foregroundDeletion" finalizer, then the owner cannot be deleted from the key-value store until this reference is removed.
	//
	// Defaults to false. To set this field, a user needs "delete"
	// permission of the owner, otherwise 422 (Unprocessable Entity) will be
	// returned.
	BlockOwnerDeletion *bool `field:"optional" json:"blockOwnerDeletion" yaml:"blockOwnerDeletion"`
	// If true, this reference points to the managing controller.
	Controller *bool `field:"optional" json:"controller" yaml:"controller"`
}

OwnerReference contains enough information to let you identify an owning object.

An owning object must be in the same namespace as the dependent, or be cluster-scoped, so there is no namespace field.

type Size

type Size interface {
	// Return this storage as a total number of gibibytes.
	ToGibibytes(opts *SizeConversionOptions) *float64
	// Return this storage as a total number of kibibytes.
	ToKibibytes(opts *SizeConversionOptions) *float64
	// Return this storage as a total number of mebibytes.
	ToMebibytes(opts *SizeConversionOptions) *float64
	// Return this storage as a total number of pebibytes.
	ToPebibytes(opts *SizeConversionOptions) *float64
	// Return this storage as a total number of tebibytes.
	ToTebibytes(opts *SizeConversionOptions) *float64
}

Represents the amount of digital storage.

The amount can be specified either as a literal value (e.g: `10`) which cannot be negative.

When the amount is passed as a token, unit conversion is not possible.

func Size_Gibibytes

func Size_Gibibytes(amount *float64) Size

Create a Storage representing an amount gibibytes.

1 GiB = 1024 MiB.

func Size_Kibibytes

func Size_Kibibytes(amount *float64) Size

Create a Storage representing an amount kibibytes.

1 KiB = 1024 bytes.

func Size_Mebibytes

func Size_Mebibytes(amount *float64) Size

Create a Storage representing an amount mebibytes.

1 MiB = 1024 KiB.

func Size_Pebibyte

func Size_Pebibyte(amount *float64) Size

Create a Storage representing an amount pebibytes.

1 PiB = 1024 TiB.

func Size_Tebibytes

func Size_Tebibytes(amount *float64) Size

Create a Storage representing an amount tebibytes.

1 TiB = 1024 GiB.

type SizeConversionOptions

type SizeConversionOptions struct {
	// How conversions should behave when it encounters a non-integer result.
	Rounding SizeRoundingBehavior `field:"optional" json:"rounding" yaml:"rounding"`
}

Options for how to convert time to a different unit.

type SizeRoundingBehavior

type SizeRoundingBehavior string

Rounding behaviour when converting between units of `Size`.

const (
	// Fail the conversion if the result is not an integer.
	SizeRoundingBehavior_FAIL SizeRoundingBehavior = "FAIL"
	// If the result is not an integer, round it to the closest integer less than the result.
	SizeRoundingBehavior_FLOOR SizeRoundingBehavior = "FLOOR"
	// Don't round.
	//
	// Return even if the result is a fraction.
	SizeRoundingBehavior_NONE SizeRoundingBehavior = "NONE"
)

type Testing

type Testing interface {
}

Testing utilities for cdk8s applications.

type TimeConversionOptions

type TimeConversionOptions struct {
	// If `true`, conversions into a larger time unit (e.g. `Seconds` to `Minutes`) will fail if the result is not an integer.
	Integral *bool `field:"optional" json:"integral" yaml:"integral"`
}

Options for how to convert time to a different unit.

type Yaml

type Yaml interface {
}

YAML utilities.

type YamlOutputType

type YamlOutputType string

The method to divide YAML output into files.

const (
	// All resources are output into a single YAML file.
	YamlOutputType_FILE_PER_APP YamlOutputType = "FILE_PER_APP"
	// Resources are split into seperate files by chart.
	YamlOutputType_FILE_PER_CHART YamlOutputType = "FILE_PER_CHART"
	// Each resource is output to its own file.
	YamlOutputType_FILE_PER_RESOURCE YamlOutputType = "FILE_PER_RESOURCE"
	// Each chart in its own folder and each resource in its own file.
	YamlOutputType_FOLDER_PER_CHART_FILE_PER_RESOURCE YamlOutputType = "FOLDER_PER_CHART_FILE_PER_RESOURCE"
)

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

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