KubernetesPatch
- class aws_cdk.aws_eks.KubernetesPatch(scope, id, *, apply_patch, cluster, resource_name, restore_patch, patch_type=None, resource_namespace=None)
Bases:
ConstructA 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/
- 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]) – The JSON object to pass tokubectl patchwhen the resource is created/updated.cluster (
ICluster) – The cluster to apply the patch to. [disable-awslint:ref-via-interface]resource_name (
str) – The full name of the resource to patch (e.g.deployment/coredns).restore_patch (
Mapping[str,Any]) – The JSON object to pass tokubectl patchwhen the resource is removed.patch_type (
Optional[PatchType]) – The patch type to pass tokubectl patch. The default type used bykubectl patchis “strategic”. Default: PatchType.STRATEGICresource_namespace (
Optional[str]) – The kubernetes API namespace. Default: “default”
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.