@Generated(value="jsii-pacmak/1.50.0 (build d1830a4)", date="2022-01-04T15:39:08.405Z") @Stability(value=Experimental) public interface KubernetesResourceProps extends software.amazon.jsii.JsiiSerializable
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 | Interface and Description |
|---|---|
static class |
KubernetesResourceProps.Builder
A builder for
KubernetesResourceProps |
static class |
KubernetesResourceProps.Jsii$Proxy
An implementation for
KubernetesResourceProps |
| Modifier and Type | Method and Description |
|---|---|
static KubernetesResourceProps.Builder |
builder() |
Cluster |
getCluster()
(experimental) The EKS cluster to apply this configuration to.
|
List<Object> |
getManifest()
(experimental) The resource manifest.
|
@Stability(value=Experimental) @NotNull Cluster getCluster()
[disable-awslint:ref-via-interface]
@Stability(value=Experimental) @NotNull List<Object> getManifest()
Consists of any number of child resources.
When the resource is created/updated, this manifest will be applied to the
cluster through kubectl apply and when the resource or the stack is
deleted, the manifest will be deleted through kubectl delete.
const manifest = {
apiVersion: 'v1',
kind: 'Pod',
metadata: { name: 'mypod' },
spec: {
containers: [ { name: 'hello', image: 'paulbouwer/hello-kubernetes:1.5', ports: [ { containerPort: 8080 } ] } ]
}
}
@Stability(value=Experimental) static KubernetesResourceProps.Builder builder()
KubernetesResourceProps.Builder of KubernetesResourcePropsCopyright © 2022. All rights reserved.