Interface KubernetesManifestProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable, KubernetesManifestOptions
All Known Implementing Classes:
KubernetesManifestProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-24T02:42:37.917Z") @Stability(Stable) public interface KubernetesManifestProps extends software.amazon.jsii.JsiiSerializable, KubernetesManifestOptions
Properties for KubernetesManifest.

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
 KubernetesManifest.Builder.create(this, "hello-kub")
         .cluster(cluster)
         .manifest(List.of(deployment, service))
         .build();
 // or, option2: use `addManifest`
 cluster.addManifest("hello-kub", service, deployment);
 
  • Method Details

    • getCluster

      @Stability(Stable) @NotNull ICluster getCluster()
      The EKS cluster to apply this manifest to.

      [disable-awslint:ref-via-interface]

    • getManifest

      @Stability(Stable) @NotNull List<Map<String,Object>> getManifest()
      The manifest to apply.

      Consists of any number of child resources.

      When the resources are created/updated, this manifest will be applied to the cluster through kubectl apply and when the resources or the stack is deleted, the resources in the manifest will be deleted through kubectl delete.

      Example:

       List.of(Map.of(
               "apiVersion", "v1",
               "kind", "Pod",
               "metadata", Map.of("name", "mypod"),
               "spec", Map.of(
                       "containers", List.of(Map.of("name", "hello", "image", "paulbouwer/hello-kubernetes:1.5", "ports", List.of(Map.of("containerPort", 8080)))))));
       
    • getOverwrite

      @Stability(Stable) @Nullable default Boolean getOverwrite()
      Overwrite any existing resources.

      If this is set, we will use kubectl apply instead of kubectl create when the resource is created. Otherwise, if there is already a resource in the cluster with the same name, the operation will fail.

      Default: false

    • builder

      @Stability(Stable) static KubernetesManifestProps.Builder builder()
      Returns:
      a KubernetesManifestProps.Builder of KubernetesManifestProps