Skip to content

Latest commit

 

History

History
327 lines (196 loc) · 11.1 KB

API.md

File metadata and controls

327 lines (196 loc) · 11.1 KB

Lambda Layer with KubeCtl v1.29


cdk-constructs: Stable


This module exports a single class called KubectlV29Layer which is a lambda.LayerVersion that bundles the kubectl and the helm command line.

  • Helm Version: 3.14.0
  • Kubectl Version: 1.29.1

Usage:

// KubectlLayer bundles the 'kubectl' and 'helm' command lines
import { KubectlV29Layer } from '@aws-cdk/lambda-layer-kubectl-v29';
import * as lambda from 'aws-cdk-lib/aws-lambda';

declare const fn: lambda.Function;
const kubectl = new KubectlV29Layer(this, 'KubectlLayer');
fn.addLayers(kubectl);

kubectl will be installed under /opt/kubectl/kubectl, and helm will be installed under /opt/helm/helm.

API Reference

Constructs

KubectlV29Layer

A CDK Asset construct that contains kubectl and helm.

Initializers

import { KubectlV29Layer } from '@aws-cdk/lambda-layer-kubectl-v29'

new KubectlV29Layer(scope: Construct, id: string)
Name Type Description
scope constructs.Construct No description.
id string No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

Methods

Name Description
toString Returns a string representation of this construct.
applyRemovalPolicy Apply the given removal policy to this resource.
addPermission Add permission for this layer version to specific entities.

toString
public toString(): string

Returns a string representation of this construct.

applyRemovalPolicy
public applyRemovalPolicy(policy: RemovalPolicy): void

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

policyRequired
  • Type: aws-cdk-lib.RemovalPolicy

addPermission
public addPermission(id: string, permission: LayerVersionPermission): void

Add permission for this layer version to specific entities.

Usage within the same account where the layer is defined is always allowed and does not require calling this method. Note that the principal that creates the Lambda function using the layer (for example, a CloudFormation changeset execution role) also needs to have the lambda:GetLayerVersion permission on the layer version.

idRequired
  • Type: string

permissionRequired
  • Type: aws-cdk-lib.aws_lambda.LayerVersionPermission

Static Functions

Name Description
isConstruct Checks if x is a construct.
isResource Check whether the given construct is a Resource.
fromLayerVersionArn Imports a layer version by ARN.
fromLayerVersionAttributes Imports a Layer that has been defined externally.

isConstruct
import { KubectlV29Layer } from '@aws-cdk/lambda-layer-kubectl-v29'

KubectlV29Layer.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


isResource
import { KubectlV29Layer } from '@aws-cdk/lambda-layer-kubectl-v29'

KubectlV29Layer.isResource(construct: IConstruct)

Check whether the given construct is a Resource.

constructRequired
  • Type: constructs.IConstruct

fromLayerVersionArn
import { KubectlV29Layer } from '@aws-cdk/lambda-layer-kubectl-v29'

KubectlV29Layer.fromLayerVersionArn(scope: Construct, id: string, layerVersionArn: string)

Imports a layer version by ARN.

Assumes it is compatible with all Lambda runtimes.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

layerVersionArnRequired
  • Type: string

fromLayerVersionAttributes
import { KubectlV29Layer } from '@aws-cdk/lambda-layer-kubectl-v29'

KubectlV29Layer.fromLayerVersionAttributes(scope: Construct, id: string, attrs: LayerVersionAttributes)

Imports a Layer that has been defined externally.

scopeRequired
  • Type: constructs.Construct

the parent Construct that will use the imported layer.


idRequired
  • Type: string

the id of the imported layer in the construct tree.


attrsRequired
  • Type: aws-cdk-lib.aws_lambda.LayerVersionAttributes

the properties of the imported layer.


Properties

Name Type Description
node constructs.Node The tree node.
env aws-cdk-lib.ResourceEnvironment The environment this resource belongs to.
stack aws-cdk-lib.Stack The stack in which this resource is defined.
layerVersionArn string The ARN of the Lambda Layer version that this Layer defines.
compatibleRuntimes aws-cdk-lib.aws_lambda.Runtime[] The runtimes compatible with this Layer.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


envRequired
public readonly env: ResourceEnvironment;
  • Type: aws-cdk-lib.ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


stackRequired
public readonly stack: Stack;
  • Type: aws-cdk-lib.Stack

The stack in which this resource is defined.


layerVersionArnRequired
public readonly layerVersionArn: string;
  • Type: string

The ARN of the Lambda Layer version that this Layer defines.


compatibleRuntimesOptional
public readonly compatibleRuntimes: Runtime[];
  • Type: aws-cdk-lib.aws_lambda.Runtime[]

The runtimes compatible with this Layer.