cdk8s (Java) ¶
Constructs ¶
ApiObject ¶
Initializers ¶
import org.cdk8s.ApiObject;
ApiObject.Builder.create(Construct scope, java.lang.String id)
.apiVersion(java.lang.String)
.kind(java.lang.String)
// .metadata(ApiObjectMetadata)
.build();
scope
Required ¶
the construct scope.
id
Required ¶
- Type:
java.lang.String
namespace.
apiVersion
Required ¶
- Type:
java.lang.String
API version.
kind
Required ¶
- Type:
java.lang.String
Resource kind.
metadata
Optional ¶
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.
Methods ¶
addDependency
¶
public addDependency(IConstruct dependencies)
dependencies
Required ¶
the dependencies to add.
addJsonPatch
¶
public addJsonPatch(JsonPatch ops)
ops
Required ¶
- Type:
org.cdk8s.JsonPatch
The JSON-Patch operations to apply.
toJson
¶
public toJson()
Static Functions ¶
isApiObject
¶
import org.cdk8s.ApiObject;
ApiObject.isApiObject(java.lang.Object o)
o
Required ¶
- Type:
java.lang.Object
The object to check.
of
¶
import org.cdk8s.ApiObject;
ApiObject.of(IConstruct c)
c
Required ¶
The higher-level construct.
Properties ¶
apiGroup
Required ¶
public java.lang.String getApiGroup();
- Type:
java.lang.String
The group portion of the API version (e.g. authorization.k8s.io
).
apiVersion
Required ¶
public java.lang.String getApiVersion();
- Type:
java.lang.String
The object’s API version (e.g. authorization.k8s.io/v1
).
chart
Required ¶
public Chart getChart();
- Type:
org.cdk8s.Chart
The chart in which this object is defined.
kind
Required ¶
public java.lang.String getKind();
- Type:
java.lang.String
The object kind.
metadata
Required ¶
public ApiObjectMetadataDefinition getMetadata();
Metadata associated with this API object.
name
Required ¶
public java.lang.String getName();
- Type:
java.lang.String
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.
App ¶
Represents a cdk8s application.
Initializers ¶
import org.cdk8s.App;
App.Builder.create()
// .outdir(java.lang.String)
// .outputFileExtension(java.lang.String)
// .recordConstructMetadata(java.lang.Boolean)
// .yamlOutputType(YamlOutputType)
.build();
outdir
Optional ¶
- Type:
java.lang.String
- Default: CDK8S_OUTDIR if defined, otherwise “dist”
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.
outputFileExtension
Optional ¶
- Type:
java.lang.String
- Default: .k8s.yaml
The file extension to use for rendered YAML files.
recordConstructMetadata
Optional ¶
- Type:
java.lang.Boolean
- Default: false
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.
yamlOutputType
Optional ¶
- Type:
org.cdk8s.YamlOutputType
- Default: YamlOutputType.FILE_PER_CHART
How to divide the YAML output into files.
Methods ¶
synth
¶
public synth()
synthYaml
¶
public synthYaml()
Properties ¶
charts
Required ¶
public java.util.List<Chart> getCharts();
- Type: java.util.List<
org.cdk8s.Chart
>
Returns all the charts in this app, sorted topologically.
outdir
Required ¶
public java.lang.String getOutdir();
- Type:
java.lang.String
The output directory into which manifests will be synthesized.
outputFileExtension
Required ¶
public java.lang.String getOutputFileExtension();
- Type:
java.lang.String
- Default: .k8s.yaml
The file extension to use for rendered YAML files.
yamlOutputType
Required ¶
public YamlOutputType getYamlOutputType();
- Type:
org.cdk8s.YamlOutputType
- Default: YamlOutputType.FILE_PER_CHART
How to divide the YAML output into files.
Chart ¶
Initializers ¶
import org.cdk8s.Chart;
Chart.Builder.create(Construct scope, java.lang.String id)
// .disableResourceNameHashes(java.lang.Boolean)
// .labels(java.util.Map<java.lang.String, java.lang.String>)
// .namespace(java.lang.String)
.build();
scope
Required ¶
id
Required ¶
- Type:
java.lang.String
disableResourceNameHashes
Optional ¶
- Type:
java.lang.Boolean
- Default: false
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.
labels
Optional ¶
- Type: java.util.Map
java.lang.String> - Default: no common labels
Labels to apply to all resources in this chart.
namespace
Optional ¶
- Type:
java.lang.String
- Default: no namespace is synthesized (usually this implies “default”)
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.
Methods ¶
addDependency
¶
public addDependency(IConstruct dependencies)
dependencies
Required ¶
the dependencies to add.
generateObjectName
¶
public generateObjectName(ApiObject apiObject)
apiObject
Required ¶
- Type:
org.cdk8s.ApiObject
The API object to generate a name for.
toJson
¶
public toJson()
Static Functions ¶
isChart
¶
import org.cdk8s.Chart;
Chart.isChart(java.lang.Object x)
x
Required ¶
- Type:
java.lang.Object
of
¶
import org.cdk8s.Chart;
Chart.of(IConstruct c)
c
Required ¶
a construct node.
Properties ¶
labels
Required ¶
public java.util.Map<java.lang.String, java.lang.String> getLabels();
- Type: java.util.Map
java.lang.String>
Labels applied to all resources in this chart.
This is an immutable copy.
namespace
Optional ¶
public java.lang.String getNamespace();
- Type:
java.lang.String
The default namespace for all objects in this chart.
Helm ¶
Represents a Helm deployment.
Use this construct to import an existing Helm chart and incorporate it into your constructs.
Initializers ¶
import org.cdk8s.Helm;
Helm.Builder.create(Construct scope, java.lang.String id)
.chart(java.lang.String)
// .helmExecutable(java.lang.String)
// .helmFlags(java.util.List<java.lang.String>)
// .namespace(java.lang.String)
// .releaseName(java.lang.String)
// .repo(java.lang.String)
// .values(java.util.Map<java.lang.String, java.lang.Object>)
// .version(java.lang.String)
.build();
scope
Required ¶
id
Required ¶
- Type:
java.lang.String
chart
Required ¶
- Type:
java.lang.String
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.
helmExecutable
Optional ¶
- Type:
java.lang.String
- Default: “helm”
The local helm executable to use in order to create the manifest the chart.
helmFlags
Optional ¶
- Type: java.util.List<
java.lang.String
> - Default: []
Additional flags to add to the helm
execution.
namespace
Optional ¶
- Type:
java.lang.String
Scope all resources in to a given namespace.
releaseName
Optional ¶
- Type:
java.lang.String
- Default: if unspecified, a name will be allocated based on the construct path
The release name.
https://helm.sh/docs/intro/using_helm/#three-big-concepts
repo
Optional ¶
- Type:
java.lang.String
Chart repository url where to locate the requested chart.
values
Optional ¶
- Type: java.util.Map
java.lang.Object> - Default: If no values are specified, chart will use the defaults.
Values to pass to the chart.
version
Optional ¶
- Type:
java.lang.String
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.
Properties ¶
releaseName
Required ¶
public java.lang.String getReleaseName();
- Type:
java.lang.String
The helm release name.
Include ¶
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.
Initializers ¶
import org.cdk8s.Include;
Include.Builder.create(Construct scope, java.lang.String id)
.url(java.lang.String)
.build();
scope
Required ¶
id
Required ¶
- Type:
java.lang.String
url
Required ¶
- Type:
java.lang.String
Local file path or URL which includes a Kubernetes YAML manifest.
Properties ¶
apiObjects
Required ¶
public java.util.List<ApiObject> getApiObjects();
- Type: java.util.List<
org.cdk8s.ApiObject
>
Returns all the included API objects.
Structs ¶
ApiObjectMetadata ¶
Metadata associated with this object.
Initializer ¶
import org.cdk8s.ApiObjectMetadata;
ApiObjectMetadata.builder()
// .annotations(java.util.Map<java.lang.String, java.lang.String>)
// .finalizers(java.util.List<java.lang.String>)
// .labels(java.util.Map<java.lang.String, java.lang.String>)
// .name(java.lang.String)
// .namespace(java.lang.String)
// .ownerReferences(java.util.List<OwnerReference>)
.build();
annotations
Optional ¶
public java.util.Map<java.lang.String, java.lang.String> getAnnotations();
- Type: java.util.Map
java.lang.String> - Default: No annotations.
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.
http://kubernetes.io/docs/user-guide/annotations
finalizers
Optional ¶
public java.util.List<java.lang.String> getFinalizers();
- Type: java.util.List<
java.lang.String
> - Default: No finalizers.
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.
https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers/
labels
Optional ¶
public java.util.Map<java.lang.String, java.lang.String> getLabels();
- Type: java.util.Map
java.lang.String> - Default: No labels.
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.
http://kubernetes.io/docs/user-guide/labels
name
Optional ¶
public java.lang.String getName();
- Type:
java.lang.String
- Default: an app-unique name generated by the chart
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.
namespace
Optional ¶
public java.lang.String getNamespace();
- Type:
java.lang.String
- Default: undefined (will be assigned to the ‘default’ namespace)
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
ownerReferences
Optional ¶
public java.util.List<OwnerReference> getOwnerReferences();
- Type: java.util.List<
org.cdk8s.OwnerReference
> - Default: automatically set by Kubernetes
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.
https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/
ApiObjectProps ¶
Options for defining API objects.
Initializer ¶
import org.cdk8s.ApiObjectProps;
ApiObjectProps.builder()
.apiVersion(java.lang.String)
.kind(java.lang.String)
// .metadata(ApiObjectMetadata)
.build();
apiVersion
Required ¶
public java.lang.String getApiVersion();
- Type:
java.lang.String
API version.
kind
Required ¶
public java.lang.String getKind();
- Type:
java.lang.String
Resource kind.
metadata
Optional ¶
public ApiObjectMetadata getMetadata();
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.
AppProps ¶
Initializer ¶
import org.cdk8s.AppProps;
AppProps.builder()
// .outdir(java.lang.String)
// .outputFileExtension(java.lang.String)
// .recordConstructMetadata(java.lang.Boolean)
// .yamlOutputType(YamlOutputType)
.build();
outdir
Optional ¶
public java.lang.String getOutdir();
- Type:
java.lang.String
- Default: CDK8S_OUTDIR if defined, otherwise “dist”
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.
outputFileExtension
Optional ¶
public java.lang.String getOutputFileExtension();
- Type:
java.lang.String
- Default: .k8s.yaml
The file extension to use for rendered YAML files.
recordConstructMetadata
Optional ¶
public java.lang.Boolean getRecordConstructMetadata();
- Type:
java.lang.Boolean
- Default: false
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.
yamlOutputType
Optional ¶
public YamlOutputType getYamlOutputType();
- Type:
org.cdk8s.YamlOutputType
- Default: YamlOutputType.FILE_PER_CHART
How to divide the YAML output into files.
ChartProps ¶
Initializer ¶
import org.cdk8s.ChartProps;
ChartProps.builder()
// .disableResourceNameHashes(java.lang.Boolean)
// .labels(java.util.Map<java.lang.String, java.lang.String>)
// .namespace(java.lang.String)
.build();
disableResourceNameHashes
Optional ¶
public java.lang.Boolean getDisableResourceNameHashes();
- Type:
java.lang.Boolean
- Default: false
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.
labels
Optional ¶
public java.util.Map<java.lang.String, java.lang.String> getLabels();
- Type: java.util.Map
java.lang.String> - Default: no common labels
Labels to apply to all resources in this chart.
namespace
Optional ¶
public java.lang.String getNamespace();
- Type:
java.lang.String
- Default: no namespace is synthesized (usually this implies “default”)
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.
CronOptions ¶
Options to configure a cron expression.
All fields are strings so you can use complex expressions. Absence of a field implies ‘*’
Initializer ¶
import org.cdk8s.CronOptions;
CronOptions.builder()
// .day(java.lang.String)
// .hour(java.lang.String)
// .minute(java.lang.String)
// .month(java.lang.String)
// .weekDay(java.lang.String)
.build();
day
Optional ¶
public java.lang.String getDay();
- Type:
java.lang.String
- Default: Every day of the month
The day of the month to run this rule at.
hour
Optional ¶
public java.lang.String getHour();
- Type:
java.lang.String
- Default: Every hour
The hour to run this rule at.
minute
Optional ¶
public java.lang.String getMinute();
- Type:
java.lang.String
- Default: Every minute
The minute to run this rule at.
month
Optional ¶
public java.lang.String getMonth();
- Type:
java.lang.String
- Default: Every month
The month to run this rule at.
weekDay
Optional ¶
public java.lang.String getWeekDay();
- Type:
java.lang.String
- Default: Any day of the week
The day of the week to run this rule at.
GroupVersionKind ¶
Initializer ¶
import org.cdk8s.GroupVersionKind;
GroupVersionKind.builder()
.apiVersion(java.lang.String)
.kind(java.lang.String)
.build();
apiVersion
Required ¶
public java.lang.String getApiVersion();
- Type:
java.lang.String
The object’s API version (e.g. authorization.k8s.io/v1
).
kind
Required ¶
public java.lang.String getKind();
- Type:
java.lang.String
The object kind.
HelmProps ¶
Options for Helm
.
Initializer ¶
import org.cdk8s.HelmProps;
HelmProps.builder()
.chart(java.lang.String)
// .helmExecutable(java.lang.String)
// .helmFlags(java.util.List<java.lang.String>)
// .namespace(java.lang.String)
// .releaseName(java.lang.String)
// .repo(java.lang.String)
// .values(java.util.Map<java.lang.String, java.lang.Object>)
// .version(java.lang.String)
.build();
chart
Required ¶
public java.lang.String getChart();
- Type:
java.lang.String
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.
helmExecutable
Optional ¶
public java.lang.String getHelmExecutable();
- Type:
java.lang.String
- Default: “helm”
The local helm executable to use in order to create the manifest the chart.
helmFlags
Optional ¶
public java.util.List<java.lang.String> getHelmFlags();
- Type: java.util.List<
java.lang.String
> - Default: []
Additional flags to add to the helm
execution.
namespace
Optional ¶
public java.lang.String getNamespace();
- Type:
java.lang.String
Scope all resources in to a given namespace.
releaseName
Optional ¶
public java.lang.String getReleaseName();
- Type:
java.lang.String
- Default: if unspecified, a name will be allocated based on the construct path
The release name.
https://helm.sh/docs/intro/using_helm/#three-big-concepts
repo
Optional ¶
public java.lang.String getRepo();
- Type:
java.lang.String
Chart repository url where to locate the requested chart.
values
Optional ¶
public java.util.Map<java.lang.String, java.lang.Object> getValues();
- Type: java.util.Map
java.lang.Object> - Default: If no values are specified, chart will use the defaults.
Values to pass to the chart.
version
Optional ¶
public java.lang.String getVersion();
- Type:
java.lang.String
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.
IncludeProps ¶
Initializer ¶
import org.cdk8s.IncludeProps;
IncludeProps.builder()
.url(java.lang.String)
.build();
url
Required ¶
public java.lang.String getUrl();
- Type:
java.lang.String
Local file path or URL which includes a Kubernetes YAML manifest.
NameOptions ¶
Options for name generation.
Initializer ¶
import org.cdk8s.NameOptions;
NameOptions.builder()
// .delimiter(java.lang.String)
// .extra(java.util.List<java.lang.String>)
// .includeHash(java.lang.Boolean)
// .maxLen(java.lang.Number)
.build();
delimiter
Optional ¶
public java.lang.String getDelimiter();
- Type:
java.lang.String
- Default: “-“
Delimiter to use between components.
extra
Optional ¶
public java.util.List<java.lang.String> getExtra();
- Type: java.util.List<
java.lang.String
> - Default: [] use the construct path components
Extra components to include in the name.
includeHash
Optional ¶
public java.lang.Boolean getIncludeHash();
- Type:
java.lang.Boolean
- Default: true
Include a short hash as last part of the name.
maxLen
Optional ¶
public java.lang.Number getMaxLen();
- Type:
java.lang.Number
- Default: 63
Maximum allowed length for the name.
OwnerReference ¶
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.
Initializer ¶
import org.cdk8s.OwnerReference;
OwnerReference.builder()
.apiVersion(java.lang.String)
.kind(java.lang.String)
.name(java.lang.String)
.uid(java.lang.String)
// .blockOwnerDeletion(java.lang.Boolean)
// .controller(java.lang.Boolean)
.build();
apiVersion
Required ¶
public java.lang.String getApiVersion();
- Type:
java.lang.String
API version of the referent.
kind
Required ¶
public java.lang.String getKind();
- Type:
java.lang.String
Kind of the referent.
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
name
Required ¶
public java.lang.String getName();
- Type:
java.lang.String
Name of the referent.
http://kubernetes.io/docs/user-guide/identifiers#names
uid
Required ¶
public java.lang.String getUid();
- Type:
java.lang.String
UID of the referent.
http://kubernetes.io/docs/user-guide/identifiers#uids
blockOwnerDeletion
Optional ¶
public java.lang.Boolean getBlockOwnerDeletion();
- Type:
java.lang.Boolean
- Default: false. To set this field, a user needs “delete” permission of the owner, otherwise 422 (Unprocessable Entity) will be returned.
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.
controller
Optional ¶
public java.lang.Boolean getController();
- Type:
java.lang.Boolean
If true, this reference points to the managing controller.
SizeConversionOptions ¶
Options for how to convert time to a different unit.
Initializer ¶
import org.cdk8s.SizeConversionOptions;
SizeConversionOptions.builder()
// .rounding(SizeRoundingBehavior)
.build();
rounding
Optional ¶
public SizeRoundingBehavior getRounding();
- Type:
org.cdk8s.SizeRoundingBehavior
- Default: SizeRoundingBehavior.FAIL
How conversions should behave when it encounters a non-integer result.
TimeConversionOptions ¶
Options for how to convert time to a different unit.
Initializer ¶
import org.cdk8s.TimeConversionOptions;
TimeConversionOptions.builder()
// .integral(java.lang.Boolean)
.build();
integral
Optional ¶
public java.lang.Boolean getIntegral();
- Type:
java.lang.Boolean
- Default: true
If true
, conversions into a larger time unit (e.g. Seconds
to Minutes
) will fail if the result is not an integer.
Classes ¶
ApiObjectMetadataDefinition ¶
Object metadata.
Initializers ¶
import org.cdk8s.ApiObjectMetadataDefinition;
ApiObjectMetadataDefinition.Builder.create()
// .annotations(java.util.Map<java.lang.String, java.lang.String>)
// .finalizers(java.util.List<java.lang.String>)
// .labels(java.util.Map<java.lang.String, java.lang.String>)
// .name(java.lang.String)
// .namespace(java.lang.String)
// .ownerReferences(java.util.List<OwnerReference>)
.build();
annotations
Optional ¶
- Type: java.util.Map
java.lang.String> - Default: No annotations.
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.
http://kubernetes.io/docs/user-guide/annotations
finalizers
Optional ¶
- Type: java.util.List<
java.lang.String
> - Default: No finalizers.
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.
https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers/
labels
Optional ¶
- Type: java.util.Map
java.lang.String> - Default: No labels.
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.
http://kubernetes.io/docs/user-guide/labels
name
Optional ¶
- Type:
java.lang.String
- Default: an app-unique name generated by the chart
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.
namespace
Optional ¶
- Type:
java.lang.String
- Default: undefined (will be assigned to the ‘default’ namespace)
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
ownerReferences
Optional ¶
- Type: java.util.List<
org.cdk8s.OwnerReference
> - Default: automatically set by Kubernetes
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.
https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/
Methods ¶
add
¶
public add(java.lang.String key, java.lang.Object value)
key
Required ¶
- Type:
java.lang.String
Metadata key.
value
Required ¶
- Type:
java.lang.Object
Metadata value.
addAnnotation
¶
public addAnnotation(java.lang.String key, java.lang.String value)
key
Required ¶
- Type:
java.lang.String
The key.
value
Required ¶
- Type:
java.lang.String
The value.
addFinalizers
¶
public addFinalizers(java.lang.String finalizers)
finalizers
Required ¶
- Type:
java.lang.String
the finalizers.
addLabel
¶
public addLabel(java.lang.String key, java.lang.String value)
key
Required ¶
- Type:
java.lang.String
The key.
value
Required ¶
- Type:
java.lang.String
The value.
addOwnerReference
¶
public addOwnerReference(OwnerReference owner)
owner
Required ¶
- Type:
org.cdk8s.OwnerReference
the owner.
getLabel
¶
public getLabel(java.lang.String key)
key
Required ¶
- Type:
java.lang.String
the label.
toJson
¶
public toJson()
Properties ¶
name
Optional ¶
public java.lang.String getName();
- Type:
java.lang.String
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.
namespace
Optional ¶
public java.lang.String getNamespace();
- Type:
java.lang.String
The object’s namespace.
Cron ¶
Represents a cron schedule.
Initializers ¶
import org.cdk8s.Cron;
Cron.Builder.create()
// .day(java.lang.String)
// .hour(java.lang.String)
// .minute(java.lang.String)
// .month(java.lang.String)
// .weekDay(java.lang.String)
.build();
day
Optional ¶
- Type:
java.lang.String
- Default: Every day of the month
The day of the month to run this rule at.
hour
Optional ¶
- Type:
java.lang.String
- Default: Every hour
The hour to run this rule at.
minute
Optional ¶
- Type:
java.lang.String
- Default: Every minute
The minute to run this rule at.
month
Optional ¶
- Type:
java.lang.String
- Default: Every month
The month to run this rule at.
weekDay
Optional ¶
- Type:
java.lang.String
- Default: Any day of the week
The day of the week to run this rule at.
Static Functions ¶
annually
¶
import org.cdk8s.Cron;
Cron.annually()
daily
¶
import org.cdk8s.Cron;
Cron.daily()
everyMinute
¶
import org.cdk8s.Cron;
Cron.everyMinute()
hourly
¶
import org.cdk8s.Cron;
Cron.hourly()
monthly
¶
import org.cdk8s.Cron;
Cron.monthly()
schedule
¶
import org.cdk8s.Cron;
Cron.schedule(CronOptions options)
options
Required ¶
- Type:
org.cdk8s.CronOptions
weekly
¶
import org.cdk8s.Cron;
Cron.weekly()
Properties ¶
expressionString
Required ¶
public java.lang.String getExpressionString();
- Type:
java.lang.String
Retrieve the expression for this schedule.
DependencyGraph ¶
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.
Initializers ¶
import org.cdk8s.DependencyGraph;
new DependencyGraph(Node node);
node
Required ¶
- Type:
software.constructs.Node
Methods ¶
topology
¶
public topology()
Properties ¶
root
Required ¶
public DependencyVertex getRoot();
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.
DependencyVertex ¶
Represents a vertex in the graph.
The value of each vertex is an IConstruct
that is accessible via the .value
getter.
Initializers ¶
import org.cdk8s.DependencyVertex;
new DependencyVertex();
new DependencyVertex(IConstruct value);
value
Optional ¶
Methods ¶
addChild
¶
public addChild(DependencyVertex dep)
dep
Required ¶
The dependency.
topology
¶
public topology()
Properties ¶
inbound
Required ¶
public java.util.List<DependencyVertex> getInbound();
- Type: java.util.List<
org.cdk8s.DependencyVertex
>
Returns the parents of the vertex (i.e dependants).
outbound
Required ¶
public java.util.List<DependencyVertex> getOutbound();
- Type: java.util.List<
org.cdk8s.DependencyVertex
>
Returns the children of the vertex (i.e dependencies).
value
Optional ¶
public IConstruct getValue();
Returns the IConstruct this graph vertex represents.
null
in case this is the root of the graph.
Duration ¶
Represents a length of time.
The amount can be specified either as a literal value (e.g: 10
) which
cannot be negative.
Methods ¶
toDays
¶
public toDays()
public toDays(TimeConversionOptions opts)
opts
Optional ¶
toHours
¶
public toHours()
public toHours(TimeConversionOptions opts)
opts
Optional ¶
toHumanString
¶
public toHumanString()
toIsoString
¶
public toIsoString()
toMilliseconds
¶
public toMilliseconds()
public toMilliseconds(TimeConversionOptions opts)
opts
Optional ¶
toMinutes
¶
public toMinutes()
public toMinutes(TimeConversionOptions opts)
opts
Optional ¶
toSeconds
¶
public toSeconds()
public toSeconds(TimeConversionOptions opts)
opts
Optional ¶
unitLabel
¶
public unitLabel()
Static Functions ¶
days
¶
import org.cdk8s.Duration;
Duration.days(java.lang.Number amount)
amount
Required ¶
- Type:
java.lang.Number
the amount of Days the Duration
will represent.
hours
¶
import org.cdk8s.Duration;
Duration.hours(java.lang.Number amount)
amount
Required ¶
- Type:
java.lang.Number
the amount of Hours the Duration
will represent.
millis
¶
import org.cdk8s.Duration;
Duration.millis(java.lang.Number amount)
amount
Required ¶
- Type:
java.lang.Number
the amount of Milliseconds the Duration
will represent.
minutes
¶
import org.cdk8s.Duration;
Duration.minutes(java.lang.Number amount)
amount
Required ¶
- Type:
java.lang.Number
the amount of Minutes the Duration
will represent.
parse
¶
import org.cdk8s.Duration;
Duration.parse(java.lang.String duration)
duration
Required ¶
- Type:
java.lang.String
an ISO-formtted duration to be parsed.
seconds
¶
import org.cdk8s.Duration;
Duration.seconds(java.lang.Number amount)
amount
Required ¶
- Type:
java.lang.Number
the amount of Seconds the Duration
will represent.
JsonPatch ¶
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.
Static Functions ¶
add
¶
import org.cdk8s.JsonPatch;
JsonPatch.add(java.lang.String path, java.lang.Object value)
path
Required ¶
- Type:
java.lang.String
value
Required ¶
- Type:
java.lang.Object
apply
¶
import org.cdk8s.JsonPatch;
JsonPatch.apply(java.lang.Object document, JsonPatch ops)
document
Required ¶
- Type:
java.lang.Object
The document to patch.
ops
Required ¶
- Type:
org.cdk8s.JsonPatch
The operations to apply.
copy
¶
import org.cdk8s.JsonPatch;
JsonPatch.copy(java.lang.String from, java.lang.String path)
from
Required ¶
- Type:
java.lang.String
path
Required ¶
- Type:
java.lang.String
move
¶
import org.cdk8s.JsonPatch;
JsonPatch.move(java.lang.String from, java.lang.String path)
from
Required ¶
- Type:
java.lang.String
path
Required ¶
- Type:
java.lang.String
remove
¶
import org.cdk8s.JsonPatch;
JsonPatch.remove(java.lang.String path)
path
Required ¶
- Type:
java.lang.String
replace
¶
import org.cdk8s.JsonPatch;
JsonPatch.replace(java.lang.String path, java.lang.Object value)
path
Required ¶
- Type:
java.lang.String
value
Required ¶
- Type:
java.lang.Object
test
¶
import org.cdk8s.JsonPatch;
JsonPatch.test(java.lang.String path, java.lang.Object value)
path
Required ¶
- Type:
java.lang.String
value
Required ¶
- Type:
java.lang.Object
Lazy ¶
Methods ¶
produce
¶
public produce()
Static Functions ¶
any
¶
import org.cdk8s.Lazy;
Lazy.any(IAnyProducer producer)
producer
Required ¶
- Type:
org.cdk8s.IAnyProducer
Names ¶
Utilities for generating unique and stable names.
Static Functions ¶
toDnsLabel
¶
import org.cdk8s.Names;
Names.toDnsLabel(Construct scope)
Names.toDnsLabel(Construct scope, NameOptions options)
scope
Required ¶
The construct for which to render the DNS label.
options
Optional ¶
- Type:
org.cdk8s.NameOptions
Name options.
toLabelValue
¶
import org.cdk8s.Names;
Names.toLabelValue(Construct scope)
Names.toLabelValue(Construct scope, NameOptions options)
scope
Required ¶
The construct for which to render the DNS label.
options
Optional ¶
- Type:
org.cdk8s.NameOptions
Name options.
Size ¶
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.
Methods ¶
toGibibytes
¶
public toGibibytes()
public toGibibytes(SizeConversionOptions opts)
opts
Optional ¶
toKibibytes
¶
public toKibibytes()
public toKibibytes(SizeConversionOptions opts)
opts
Optional ¶
toMebibytes
¶
public toMebibytes()
public toMebibytes(SizeConversionOptions opts)
opts
Optional ¶
toPebibytes
¶
public toPebibytes()
public toPebibytes(SizeConversionOptions opts)
opts
Optional ¶
toTebibytes
¶
public toTebibytes()
public toTebibytes(SizeConversionOptions opts)
opts
Optional ¶
Static Functions ¶
gibibytes
¶
import org.cdk8s.Size;
Size.gibibytes(java.lang.Number amount)
amount
Required ¶
- Type:
java.lang.Number
kibibytes
¶
import org.cdk8s.Size;
Size.kibibytes(java.lang.Number amount)
amount
Required ¶
- Type:
java.lang.Number
mebibytes
¶
import org.cdk8s.Size;
Size.mebibytes(java.lang.Number amount)
amount
Required ¶
- Type:
java.lang.Number
pebibyte
¶
import org.cdk8s.Size;
Size.pebibyte(java.lang.Number amount)
amount
Required ¶
- Type:
java.lang.Number
tebibytes
¶
import org.cdk8s.Size;
Size.tebibytes(java.lang.Number amount)
amount
Required ¶
- Type:
java.lang.Number
Testing ¶
Testing utilities for cdk8s applications.
Static Functions ¶
app
¶
import org.cdk8s.Testing;
Testing.app()
Testing.app(AppProps props)
props
Optional ¶
- Type:
org.cdk8s.AppProps
chart
¶
import org.cdk8s.Testing;
Testing.chart()
synth
¶
import org.cdk8s.Testing;
Testing.synth(Chart chart)
chart
Required ¶
- Type:
org.cdk8s.Chart
Yaml ¶
YAML utilities.
Static Functions ¶
~~formatObjects
~~ ¶
import org.cdk8s.Yaml;
Yaml.formatObjects(java.util.List<java.lang.Object> docs)
docs
Required ¶
- Type: java.util.List<
java.lang.Object
>
load
¶
import org.cdk8s.Yaml;
Yaml.load(java.lang.String urlOrFile)
urlOrFile
Required ¶
- Type:
java.lang.String
a URL of a file path to load from.
save
¶
import org.cdk8s.Yaml;
Yaml.save(java.lang.String filePath, java.util.List<java.lang.Object> docs)
filePath
Required ¶
- Type:
java.lang.String
The output path.
docs
Required ¶
- Type: java.util.List<
java.lang.Object
>
The set of objects.
stringify
¶
import org.cdk8s.Yaml;
Yaml.stringify(java.lang.Object docs)
docs
Required ¶
- Type:
java.lang.Object
A set of objects to convert to YAML.
tmp
¶
import org.cdk8s.Yaml;
Yaml.tmp(java.util.List<java.lang.Object> docs)
docs
Required ¶
- Type: java.util.List<
java.lang.Object
>
the set of documents to save.
Protocols ¶
IAnyProducer ¶
- Implemented By:
org.cdk8s.IAnyProducer
Methods ¶
produce
¶
public produce()
Enums ¶
SizeRoundingBehavior ¶
Rounding behaviour when converting between units of Size
.
FAIL
¶
Fail the conversion if the result is not an integer.
FLOOR
¶
If the result is not an integer, round it to the closest integer less than the result.
NONE
¶
Don’t round.
Return even if the result is a fraction.
YamlOutputType ¶
The method to divide YAML output into files.
FILE_PER_APP
¶
All resources are output into a single YAML file.
FILE_PER_CHART
¶
Resources are split into seperate files by chart.
FILE_PER_RESOURCE
¶
Each resource is output to its own file.
FOLDER_PER_CHART_FILE_PER_RESOURCE
¶
Each chart in its own folder and each resource in its own file.