@Generated(value="jsii-pacmak/1.50.0 (build d1830a4)", date="2022-01-04T15:39:08.404Z") @Stability(value=Experimental) public class KubernetesResource extends Construct
Alternatively, you can use cluster.addResource(resource[, resource, ...])
to define resources on this cluster.
Applies/deletes the resources using kubectl in sync with the resource.
Example:
Cluster cluster;
Map<String, String> appLabel = Map.of("app", "hello-kubernetes");
Map<String, Object> deployment = Map.of(
"apiVersion", "apps/v1",
"kind", "Deployment",
"metadata", Map.of("name", "hello-kubernetes"),
"spec", Map.of(
"replicas", 3,
"selector", Map.of("matchLabels", appLabel),
"template", Map.of(
"metadata", Map.of("labels", appLabel),
"spec", Map.of(
"containers", List.of(Map.of(
"name", "hello-kubernetes",
"image", "paulbouwer/hello-kubernetes:1.5",
"ports", List.of(Map.of("containerPort", 8080))))))));
Map<String, Object> service = Map.of(
"apiVersion", "v1",
"kind", "Service",
"metadata", Map.of("name", "hello-kubernetes"),
"spec", Map.of(
"type", "LoadBalancer",
"ports", List.of(Map.of("port", 80, "targetPort", 8080)),
"selector", appLabel));
// option 1: use a construct
// option 1: use a construct
KubernetesResource.Builder.create(this, "hello-kub")
.cluster(cluster)
.manifest(List.of(deployment, service))
.build();
// or, option2: use `addResource`
cluster.addResource("hello-kub", service, deployment);
| Modifier and Type | Class and Description |
|---|---|
static class |
KubernetesResource.Builder
(experimental) A fluent builder for
KubernetesResource. |
software.amazon.jsii.JsiiObject.InitializationModeIConstruct.Jsii$Default, IConstruct.Jsii$Proxy| Modifier and Type | Field and Description |
|---|---|
static String |
RESOURCE_TYPE
(experimental) The CloudFormation reosurce type.
|
| Modifier | Constructor and Description |
|---|---|
|
KubernetesResource(Construct scope,
String id,
KubernetesResourceProps props) |
protected |
KubernetesResource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
KubernetesResource(software.amazon.jsii.JsiiObjectRef objRef) |
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validatejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet@Stability(value=Experimental) public static final String RESOURCE_TYPE
protected KubernetesResource(software.amazon.jsii.JsiiObjectRef objRef)
protected KubernetesResource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Experimental)
public KubernetesResource(@NotNull
Construct scope,
@NotNull
String id,
@NotNull
KubernetesResourceProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.Copyright © 2022. All rights reserved.