KubectlProviderProps Struct
Properties for a KubectlProvider.
| Source | aws-eks-v2/lib/kubectl-provider.ts |
|---|---|
| Type last changed |
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
import { aws_eks_v2 as eks_v2 } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_lambda as lambda } from 'aws-cdk-lib';
declare const cluster: eks_v2.Cluster;
declare const layerVersion: lambda.LayerVersion;
declare const role: iam.Role;
declare const securityGroup: ec2.SecurityGroup;
declare const size: cdk.Size;
declare const subnet: ec2.Subnet;
const kubectlProviderProps: eks_v2.KubectlProviderProps = {
cluster: cluster,
kubectlLayer: layerVersion,
// the properties below are optional
awscliLayer: layerVersion,
environment: {
environmentKey: 'environment',
},
memory: size,
privateSubnets: [subnet],
removalPolicy: cdk.RemovalPolicy.DESTROY,
role: role,
securityGroup: securityGroup,
securityGroups: [securityGroup],
};
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_ec2 as ec2
from aws_cdk import aws_eks_v2 as eks_v2
from aws_cdk import aws_iam as iam
from aws_cdk import aws_lambda as lambda_
# cluster: eks_v2.Cluster
# layer_version: lambda.LayerVersion
# role: iam.Role
# security_group: ec2.SecurityGroup
# size: cdk.Size
# subnet: ec2.Subnet
kubectl_provider_props = eks_v2.KubectlProviderProps(
cluster=cluster,
kubectl_layer=layer_version,
# the properties below are optional
awscli_layer=layer_version,
environment={
"environment_key": "environment"
},
memory=size,
private_subnets=[subnet],
removal_policy=cdk.RemovalPolicy.DESTROY,
role=role,
security_group=security_group,
security_groups=[security_group]
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.ec2.*;
import software.amazon.awscdk.services.eks_v2.*;
import software.amazon.awscdk.services.iam.*;
import software.amazon.awscdk.services.lambda.*;
Cluster cluster;
LayerVersion layerVersion;
Role role;
SecurityGroup securityGroup;
Size size;
Subnet subnet;
KubectlProviderProps kubectlProviderProps = KubectlProviderProps.builder()
.cluster(cluster)
.kubectlLayer(layerVersion)
// the properties below are optional
.awscliLayer(layerVersion)
.environment(Map.of(
"environmentKey", "environment"))
.memory(size)
.privateSubnets(List.of(subnet))
.removalPolicy(RemovalPolicy.DESTROY)
.role(role)
.securityGroup(securityGroup)
.securityGroups(List.of(securityGroup))
.build();
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.EKSv2;
using Amazon.CDK.AWS.IAM;
using Amazon.CDK.AWS.Lambda;
Cluster cluster;
LayerVersion layerVersion;
Role role;
SecurityGroup securityGroup;
Size size;
Subnet subnet;
var kubectlProviderProps = new KubectlProviderProps {
Cluster = cluster,
KubectlLayer = layerVersion,
// the properties below are optional
AwscliLayer = layerVersion,
Environment = new Dictionary<string, string> {
{ "environmentKey", "environment" }
},
Memory = size,
PrivateSubnets = new [] { subnet },
RemovalPolicy = RemovalPolicy.DESTROY,
Role = role,
SecurityGroup = securityGroup,
SecurityGroups = new [] { securityGroup }
};
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var cluster Cluster
var layerVersion LayerVersion
var role Role
var securityGroup SecurityGroup
var size Size
var subnet Subnet
kubectlProviderProps := &KubectlProviderProps{
Cluster: cluster,
KubectlLayer: layerVersion,
// the properties below are optional
AwscliLayer: layerVersion,
Environment: map[string]*string{
"environmentKey": jsii.String("environment"),
},
Memory: size,
PrivateSubnets: []ISubnet{
subnet,
},
RemovalPolicy: cdk.RemovalPolicy_DESTROY,
Role: role,
SecurityGroup: securityGroup,
SecurityGroups: []ISecurityGroup{
securityGroup,
},
}
Properties
awscliLayeroptionalILayerVersionawscli_layeroptionalILayerVersionawscliLayeroptionalILayerVersionAwscliLayeroptionalILayerVersionAwscliLayeroptionalILayerVersion #Default: If not defined, a default layer will be used containing the AWS CLI 2.x.
environmentoptional{ [key: string]: string }environmentoptionaltyping.Mapping[str, str]environmentoptionalMap<String, String>EnvironmentoptionalIDictionary<string, string>Environmentoptional*map[string]*string #Default: No custom environment variables
kubectlLayerILayerVersionkubectl_layerILayerVersionkubectlLayerILayerVersionKubectlLayerILayerVersionKubectlLayerILayerVersion required #privateSubnetsoptionalISubnet[]private_subnetsoptionaltyping.List[ISubnet]privateSubnetsoptionalList<ISubnet>PrivateSubnetsoptionalISubnet[]PrivateSubnetsoptional*[]ISubnet #Default: the k8s is accessible publicly
If not specified, the k8s endpoint is expected to be accessible publicly.
removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy = RemovalPolicy.DESTROY #notes
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
Default: if not specified, the default role created by a lambda function will be used.
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.
securityGroupoptionalISecurityGroupsecurity_groupoptionalISecurityGroupsecurityGroupoptionalISecurityGroupSecurityGroupoptionalISecurityGroupSecurityGroupoptionalISecurityGroup deprecated #Default: If not specified, the k8s endpoint is expected to be accessible publicly.
securityGroupsoptionalISecurityGroup[]security_groupsoptionaltyping.List[ISecurityGroup]securityGroupsoptionalList<ISecurityGroup>SecurityGroupsoptionalISecurityGroup[]SecurityGroupsoptional*[]ISecurityGroup #Default: If not specified, the k8s endpoint is expected to be accessible publicly.