Class: AWSCDK::EKSv2::KubectlProviderProps

Inherits:
KubectlProviderOptions
  • Object
show all
Defined in:
ek_sv2/kubectl_provider_props.rb

Overview

Properties for a KubectlProvider.

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, cluster:) ⇒ KubectlProviderProps

Returns a new instance of KubectlProviderProps.

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.

  • cluster (AWSCDK::EKSv2::ICluster)

    The cluster to control.



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

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, cluster:)
  @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?
  @cluster = cluster
  Jsii::Type.check_type(@cluster, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWtzX3YyLklDbHVzdGVyIn0=")), "cluster")
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.



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

def awscli_layer
  @awscli_layer
end

#clusterAWSCDK::EKSv2::ICluster (readonly)

The cluster to control.



102
103
104
# File 'ek_sv2/kubectl_provider_props.rb', line 102

def cluster
  @cluster
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)


53
54
55
# File 'ek_sv2/kubectl_provider_props.rb', line 53

def environment
  @environment
end

#kubectl_layerAWSCDK::Lambda::ILayerVersion (readonly)

An AWS Lambda layer that includes kubectl and helm.



43
44
45
# File 'ek_sv2/kubectl_provider_props.rb', line 43

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:



58
59
60
# File 'ek_sv2/kubectl_provider_props.rb', line 58

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:



66
67
68
# File 'ek_sv2/kubectl_provider_props.rb', line 66

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:



78
79
80
# File 'ek_sv2/kubectl_provider_props.rb', line 78

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:



87
88
89
# File 'ek_sv2/kubectl_provider_props.rb', line 87

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:



93
94
95
# File 'ek_sv2/kubectl_provider_props.rb', line 93

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:



98
99
100
# File 'ek_sv2/kubectl_provider_props.rb', line 98

def security_groups
  @security_groups
end

Class Method Details

.jsii_propertiesObject



104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'ek_sv2/kubectl_provider_props.rb', line 104

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",
    :cluster => "cluster",
  }
end

Instance Method Details

#to_jsiiObject



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'ek_sv2/kubectl_provider_props.rb', line 119

def to_jsii
  result = {}
  result.merge!(super)
  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,
    "cluster" => @cluster,
  })
  result.compact
end