Class: AWSCDK::EKSv2::KubernetesPatchProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ek_sv2/kubernetes_patch_props.rb

Overview

Properties for KubernetesPatch.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(apply_patch:, cluster:, resource_name:, restore_patch:, patch_type: nil, removal_policy: nil, resource_namespace: nil) ⇒ KubernetesPatchProps

Returns a new instance of KubernetesPatchProps.

Parameters:

  • apply_patch (Hash{String => Object})

    The JSON object to pass to kubectl patch when the resource is created/updated.

  • cluster (AWSCDK::EKSv2::ICluster)

    The cluster to apply the patch to.

  • resource_name (String)

    The full name of the resource to patch (e.g. deployment/coredns).

  • restore_patch (Hash{String => Object})

    The JSON object to pass to kubectl patch when the resource is removed.

  • patch_type (AWSCDK::EKSv2::PatchType, nil) (defaults to: nil)

    The patch type to pass to kubectl patch.

  • removal_policy (AWSCDK::RemovalPolicy, nil) (defaults to: nil)

    The removal policy applied to the custom resource that manages the Kubernetes patch.

  • resource_namespace (String, nil) (defaults to: nil)

    The kubernetes API namespace.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'ek_sv2/kubernetes_patch_props.rb', line 14

def initialize(apply_patch:, cluster:, resource_name:, restore_patch:, patch_type: nil, removal_policy: nil, resource_namespace: nil)
  @apply_patch = apply_patch
  Jsii::Type.check_type(@apply_patch, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "applyPatch")
  @cluster = cluster
  Jsii::Type.check_type(@cluster, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLklDbHVzdGVyIn0=")), "cluster")
  @resource_name = resource_name
  Jsii::Type.check_type(@resource_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "resourceName")
  @restore_patch = restore_patch
  Jsii::Type.check_type(@restore_patch, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "restorePatch")
  @patch_type = patch_type
  Jsii::Type.check_type(@patch_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLlBhdGNoVHlwZSJ9")), "patchType") unless @patch_type.nil?
  @removal_policy = removal_policy
  Jsii::Type.check_type(@removal_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "removalPolicy") unless @removal_policy.nil?
  @resource_namespace = resource_namespace
  Jsii::Type.check_type(@resource_namespace, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "resourceNamespace") unless @resource_namespace.nil?
end

Instance Attribute Details

#apply_patchHash{String => Object} (readonly)

The JSON object to pass to kubectl patch when the resource is created/updated.

Returns:

  • (Hash{String => Object})


34
35
36
# File 'ek_sv2/kubernetes_patch_props.rb', line 34

def apply_patch
  @apply_patch
end

#clusterAWSCDK::EKSv2::ICluster (readonly)

The cluster to apply the patch to.

[disable-awslint:ref-via-interface]



40
41
42
# File 'ek_sv2/kubernetes_patch_props.rb', line 40

def cluster
  @cluster
end

#patch_typeAWSCDK::EKSv2::PatchType? (readonly)

Note:

Default: PatchType.STRATEGIC

The patch type to pass to kubectl patch.

The default type used by kubectl patch is "strategic".

Returns:



55
56
57
# File 'ek_sv2/kubernetes_patch_props.rb', line 55

def patch_type
  @patch_type
end

#removal_policyAWSCDK::RemovalPolicy? (readonly)

Note:

Default: RemovalPolicy.DESTROY

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

Returns:



67
68
69
# File 'ek_sv2/kubernetes_patch_props.rb', line 67

def removal_policy
  @removal_policy
end

#resource_nameString (readonly)

The full name of the resource to patch (e.g. deployment/coredns).

Returns:

  • (String)


44
45
46
# File 'ek_sv2/kubernetes_patch_props.rb', line 44

def resource_name
  @resource_name
end

#resource_namespaceString? (readonly)

Note:

Default: "default"

The kubernetes API namespace.

Returns:

  • (String, nil)


72
73
74
# File 'ek_sv2/kubernetes_patch_props.rb', line 72

def resource_namespace
  @resource_namespace
end

#restore_patchHash{String => Object} (readonly)

The JSON object to pass to kubectl patch when the resource is removed.

Returns:

  • (Hash{String => Object})


48
49
50
# File 'ek_sv2/kubernetes_patch_props.rb', line 48

def restore_patch
  @restore_patch
end

Class Method Details

.jsii_propertiesObject



74
75
76
77
78
79
80
81
82
83
84
# File 'ek_sv2/kubernetes_patch_props.rb', line 74

def self.jsii_properties
  {
    :apply_patch => "applyPatch",
    :cluster => "cluster",
    :resource_name => "resourceName",
    :restore_patch => "restorePatch",
    :patch_type => "patchType",
    :removal_policy => "removalPolicy",
    :resource_namespace => "resourceNamespace",
  }
end

Instance Method Details

#to_jsiiObject



86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'ek_sv2/kubernetes_patch_props.rb', line 86

def to_jsii
  result = {}
  result.merge!({
    "applyPatch" => @apply_patch,
    "cluster" => @cluster,
    "resourceName" => @resource_name,
    "restorePatch" => @restore_patch,
    "patchType" => @patch_type,
    "removalPolicy" => @removal_policy,
    "resourceNamespace" => @resource_namespace,
  })
  result.compact
end