Class: AWSCDK::EKS::KubernetesManifestOptions

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
eks/kubernetes_manifest_options.rb

Overview

Options for KubernetesManifest.

Direct Known Subclasses

KubernetesManifestProps

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ingress_alb: nil, ingress_alb_scheme: nil, prune: nil, removal_policy: nil, skip_validation: nil) ⇒ KubernetesManifestOptions

Returns a new instance of KubernetesManifestOptions.

Parameters:

  • ingress_alb (Boolean, nil) (defaults to: nil)

    Automatically detect Ingress resources in the manifest and annotate them so they are picked up by an ALB Ingress Controller.

  • ingress_alb_scheme (AWSCDK::EKS::ALBScheme, nil) (defaults to: nil)

    Specify the ALB scheme that should be applied to Ingress resources.

  • prune (Boolean, nil) (defaults to: nil)

    When a resource is removed from a Kubernetes manifest, it no longer appears in the manifest, and there is no way to know that this resource needs to be deleted.

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

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

  • skip_validation (Boolean, nil) (defaults to: nil)

    A flag to signify if the manifest validation should be skipped.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'eks/kubernetes_manifest_options.rb', line 12

def initialize(ingress_alb: nil, ingress_alb_scheme: nil, prune: nil, removal_policy: nil, skip_validation: nil)
  @ingress_alb = ingress_alb
  Jsii::Type.check_type(@ingress_alb, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "ingressAlb") unless @ingress_alb.nil?
  @ingress_alb_scheme = ingress_alb_scheme
  Jsii::Type.check_type(@ingress_alb_scheme, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzLkFsYlNjaGVtZSJ9")), "ingressAlbScheme") unless @ingress_alb_scheme.nil?
  @prune = prune
  Jsii::Type.check_type(@prune, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "prune") unless @prune.nil?
  @removal_policy = removal_policy
  Jsii::Type.check_type(@removal_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "removalPolicy") unless @removal_policy.nil?
  @skip_validation = skip_validation
  Jsii::Type.check_type(@skip_validation, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "skipValidation") unless @skip_validation.nil?
end

Instance Attribute Details

#ingress_albBoolean? (readonly)

Note:

Default: false

Automatically detect Ingress resources in the manifest and annotate them so they are picked up by an ALB Ingress Controller.

Returns:

  • (Boolean, nil)


29
30
31
# File 'eks/kubernetes_manifest_options.rb', line 29

def ingress_alb
  @ingress_alb
end

#ingress_alb_schemeAWSCDK::EKS::ALBScheme? (readonly)

Note:

Default: AlbScheme.INTERNAL

Specify the ALB scheme that should be applied to Ingress resources.

Only applicable if ingress_alb is set to true.

Returns:



36
37
38
# File 'eks/kubernetes_manifest_options.rb', line 36

def ingress_alb_scheme
  @ingress_alb_scheme
end

#pruneBoolean? (readonly)

Note:

Default: - based on the prune option of the cluster, which is true unless otherwise specified.

When a resource is removed from a Kubernetes manifest, it no longer appears in the manifest, and there is no way to know that this resource needs to be deleted.

To address this, kubectl apply has a --prune option which will query the cluster for all resources with a specific label and will remove all the labeld resources that are not part of the applied manifest. If this option is disabled and a resource is removed, it will become "orphaned" and will not be deleted from the cluster.

When this option is enabled (default), the construct will inject a label to all Kubernetes resources included in this manifest which will be used to prune resources when the manifest changes via kubectl apply --prune.

The label name will be aws.cdk.eks/prune-<ADDR> where <ADDR> is the 42-char unique address of this construct in the construct tree. Value is empty.



56
57
58
# File 'eks/kubernetes_manifest_options.rb', line 56

def prune
  @prune
end

#removal_policyAWSCDK::RemovalPolicy? (readonly)

Note:

Default: RemovalPolicy.DESTROY

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

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:



68
69
70
# File 'eks/kubernetes_manifest_options.rb', line 68

def removal_policy
  @removal_policy
end

#skip_validationBoolean? (readonly)

Note:

Default: false

A flag to signify if the manifest validation should be skipped.

Returns:

  • (Boolean, nil)


73
74
75
# File 'eks/kubernetes_manifest_options.rb', line 73

def skip_validation
  @skip_validation
end

Class Method Details

.jsii_propertiesObject



75
76
77
78
79
80
81
82
83
# File 'eks/kubernetes_manifest_options.rb', line 75

def self.jsii_properties
  {
    :ingress_alb => "ingressAlb",
    :ingress_alb_scheme => "ingressAlbScheme",
    :prune => "prune",
    :removal_policy => "removalPolicy",
    :skip_validation => "skipValidation",
  }
end

Instance Method Details

#to_jsiiObject



85
86
87
88
89
90
91
92
93
94
95
# File 'eks/kubernetes_manifest_options.rb', line 85

def to_jsii
  result = {}
  result.merge!({
    "ingressAlb" => @ingress_alb,
    "ingressAlbScheme" => @ingress_alb_scheme,
    "prune" => @prune,
    "removalPolicy" => @removal_policy,
    "skipValidation" => @skip_validation,
  })
  result.compact
end