KubernetesPatch
- class aws_cdk.aws_eks_v2_alpha.KubernetesPatch(scope, id, *, apply_patch, cluster, resource_name, restore_patch, patch_type=None, removal_policy=None, resource_namespace=None)
Bases:
Construct(experimental) A CloudFormation resource which applies/restores a JSON patch into a Kubernetes resource.
- See:
https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/
- Stability:
experimental
- ExampleMetadata:
infused
Example:
# cluster: eks.Cluster eks.KubernetesPatch(self, "hello-kub-deployment-label", cluster=cluster, resource_name="deployment/hello-kubernetes", apply_patch={"spec": {"replicas": 5}}, restore_patch={"spec": {"replicas": 3}} )
- Parameters:
scope (
Construct)id (
str)apply_patch (
Mapping[str,Any]) – (experimental) The JSON object to pass tokubectl patchwhen the resource is created/updated.cluster (
ICluster) – (experimental) The cluster to apply the patch to. [disable-awslint:ref-via-interface]resource_name (
str) – (experimental) The full name of the resource to patch (e.g.deployment/coredns).restore_patch (
Mapping[str,Any]) – (experimental) The JSON object to pass tokubectl patchwhen the resource is removed.patch_type (
Optional[PatchType]) – (experimental) The patch type to pass tokubectl patch. The default type used bykubectl patchis “strategic”. Default: PatchType.STRATEGICremoval_policy (
Optional[RemovalPolicy]) – (experimental) The removal policy applied to the custom resource that manages the Kubernetes patch. The removal policy controls what happens to the resource if it stops being managed by CloudFormation. This can happen in one of three situations: - The resource is removed from the template, so CloudFormation stops managing it - A change to the resource is made that requires it to be replaced, so CloudFormation stops managing it - The stack is deleted, so CloudFormation stops managing all resources in it Default: RemovalPolicy.DESTROYresource_namespace (
Optional[str]) – (experimental) The kubernetes API namespace. Default: “default”
- Stability:
experimental
Methods
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- node
The tree node.
Static Methods
- classmethod is_construct(x)
Checks if
xis a construct.Use this method instead of
instanceofto properly detectConstructinstances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructslibrary on disk are seen as independent, completely different libraries. As a consequence, the classConstructin each copy of theconstructslibrary is seen as a different class, and an instance of one class will not test asinstanceofthe other class.npm installwill not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructslibrary can be accidentally installed, andinstanceofwill behave unpredictably. It is safest to avoid usinginstanceof, and using this type-testing method instead.- Parameters:
x (
Any) – Any object.- Return type:
bool- Returns:
true if
xis an object created from a class which extendsConstruct.