Class: AWSCDK::EKSv2::KubectlProviderOptions

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

Overview

Options for creating the kubectl provider - a lambda function that executes kubectl and helm against the cluster.

Direct Known Subclasses

KubectlProviderProps

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kubectl_layer:, awscli_layer: nil, environment: nil, memory: nil, private_subnets: nil, removal_policy: nil, role: nil, security_group: nil, security_groups: nil) ⇒ KubectlProviderOptions

Returns a new instance of KubectlProviderOptions.

Parameters:

  • kubectl_layer (AWSCDK::Lambda::ILayerVersion)

    An AWS Lambda layer that includes kubectl and helm.

  • awscli_layer (AWSCDK::Lambda::ILayerVersion, nil) (defaults to: nil)

    An AWS Lambda layer that contains the aws CLI.

  • environment (Hash{String => String}, nil) (defaults to: nil)

    Custom environment variables when running kubectl against this cluster.

  • memory (AWSCDK::Size, nil) (defaults to: nil)

    The amount of memory allocated to the kubectl provider's lambda function.

  • private_subnets (Array<AWSCDK::EC2::ISubnet>, nil) (defaults to: nil)

    Subnets to host the kubectl compute resources.

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

    The removal policy applied to the custom resource that provides kubectl.

  • role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    An IAM role that can perform kubectl operations against this cluster.

  • security_group (AWSCDK::EC2::ISecurityGroup, nil) (defaults to: nil)

    A security group to use for kubectl execution.

  • security_groups (Array<AWSCDK::EC2::ISecurityGroup>, nil) (defaults to: nil)

    Security groups to use for kubectl execution.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'ek_sv2/kubectl_provider_options.rb', line 16

def initialize(kubectl_layer:, awscli_layer: nil, environment: nil, memory: nil, private_subnets: nil, removal_policy: nil, role: nil, security_group: nil, security_groups: nil)
  @kubectl_layer = kubectl_layer
  Jsii::Type.check_type(@kubectl_layer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklMYXllclZlcnNpb24ifQ==")), "kubectlLayer")
  @awscli_layer = awscli_layer
  Jsii::Type.check_type(@awscli_layer, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklMYXllclZlcnNpb24ifQ==")), "awscliLayer") unless @awscli_layer.nil?
  @environment = environment
  Jsii::Type.check_type(@environment, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "environment") unless @environment.nil?
  @memory = memory
  Jsii::Type.check_type(@memory, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplIn0=")), "memory") unless @memory.nil?
  @private_subnets = private_subnets
  Jsii::Type.check_type(@private_subnets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVN1Ym5ldCJ9LCJraW5kIjoiYXJyYXkifX0=")), "privateSubnets") unless @private_subnets.nil?
  @removal_policy = removal_policy
  Jsii::Type.check_type(@removal_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "removalPolicy") unless @removal_policy.nil?
  @role = role
  Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil?
  @security_group = security_group
  Jsii::Type.check_type(@security_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklTZWN1cml0eUdyb3VwIn0=")), "securityGroup") unless @security_group.nil?
  @security_groups = security_groups
  Jsii::Type.check_type(@security_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSVNlY3VyaXR5R3JvdXAifSwia2luZCI6ImFycmF5In19")), "securityGroups") unless @security_groups.nil?
end

Instance Attribute Details

#awscli_layerAWSCDK::Lambda::ILayerVersion? (readonly)

Note:

Default: - If not defined, a default layer will be used containing the AWS CLI 2.x.

An AWS Lambda layer that contains the aws CLI.



45
46
47
# File 'ek_sv2/kubectl_provider_options.rb', line 45

def awscli_layer
  @awscli_layer
end

#environmentHash{String => String}? (readonly)

Note:

Default: - No custom environment variables

Custom environment variables when running kubectl against this cluster.

Returns:

  • (Hash{String => String}, nil)


50
51
52
# File 'ek_sv2/kubectl_provider_options.rb', line 50

def environment
  @environment
end

#kubectl_layerAWSCDK::Lambda::ILayerVersion (readonly)

An AWS Lambda layer that includes kubectl and helm.



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

def kubectl_layer
  @kubectl_layer
end

#memoryAWSCDK::Size? (readonly)

Note:

Default: - 1024

The amount of memory allocated to the kubectl provider's lambda function.

Returns:



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

def memory
  @memory
end

#private_subnetsArray<AWSCDK::EC2::ISubnet>? (readonly)

Note:

Default: - the k8s is accessible publicly

Subnets to host the kubectl compute resources.

If not specified, the k8s endpoint is expected to be accessible publicly.

Returns:



63
64
65
# File 'ek_sv2/kubectl_provider_options.rb', line 63

def private_subnets
  @private_subnets
end

#removal_policyAWSCDK::RemovalPolicy? (readonly)

Note:

Default: RemovalPolicy.DESTROY

The removal policy applied to the custom resource that provides kubectl.

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:



75
76
77
# File 'ek_sv2/kubectl_provider_options.rb', line 75

def removal_policy
  @removal_policy
end

#roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: - if not specified, the default role created by a lambda function will be used.

An IAM role that can perform kubectl operations against this cluster.

The role should be mapped to the system:masters Kubernetes RBAC role.

This role is directly passed to the lambda handler that sends Kube Ctl commands to the cluster.

Returns:



84
85
86
# File 'ek_sv2/kubectl_provider_options.rb', line 84

def role
  @role
end

#security_groupAWSCDK::EC2::ISecurityGroup? (readonly)

Deprecated.

Use securityGroups instead.

Note:

Default: - If not specified, the k8s endpoint is expected to be accessible publicly.

A security group to use for kubectl execution.

Returns:



90
91
92
# File 'ek_sv2/kubectl_provider_options.rb', line 90

def security_group
  @security_group
end

#security_groupsArray<AWSCDK::EC2::ISecurityGroup>? (readonly)

Note:

Default: - If not specified, the k8s endpoint is expected to be accessible publicly.

Security groups to use for kubectl execution.

Returns:



95
96
97
# File 'ek_sv2/kubectl_provider_options.rb', line 95

def security_groups
  @security_groups
end

Class Method Details

.jsii_propertiesObject



97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'ek_sv2/kubectl_provider_options.rb', line 97

def self.jsii_properties
  {
    :kubectl_layer => "kubectlLayer",
    :awscli_layer => "awscliLayer",
    :environment => "environment",
    :memory => "memory",
    :private_subnets => "privateSubnets",
    :removal_policy => "removalPolicy",
    :role => "role",
    :security_group => "securityGroup",
    :security_groups => "securityGroups",
  }
end

Instance Method Details

#to_jsiiObject



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'ek_sv2/kubectl_provider_options.rb', line 111

def to_jsii
  result = {}
  result.merge!({
    "kubectlLayer" => @kubectl_layer,
    "awscliLayer" => @awscli_layer,
    "environment" => @environment,
    "memory" => @memory,
    "privateSubnets" => @private_subnets,
    "removalPolicy" => @removal_policy,
    "role" => @role,
    "securityGroup" => @security_group,
    "securityGroups" => @security_groups,
  })
  result.compact
end