class Addon (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.EKS.Addon |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awseks#Addon |
Java | software.amazon.awscdk.services.eks.Addon |
Python | aws_cdk.aws_eks.Addon |
TypeScript (source) | aws-cdk-lib » aws_eks » Addon |
Implements
IConstruct
, IDependable
, IResource
, IAddon
Represents an Amazon EKS Add-On.
Example
declare const cluster: eks.Cluster;
new eks.Addon(this, 'Addon', {
cluster,
addonName: 'aws-guardduty-agent',
addonVersion: 'v1.6.1',
// whether to preserve the add-on software on your cluster but Amazon EKS stops managing any settings for the add-on.
preserveOnDelete: false,
});
Initializer
new Addon(scope: Construct, id: string, props: AddonProps)
Parameters
- scope
Construct
— The parent construct. - id
string
— The construct ID. - props
Addon
— The properties for the Add-On.Props
Creates a new Amazon EKS Add-On.
Construct Props
Name | Type | Description |
---|---|---|
addon | string | Name of the Add-On. |
cluster | ICluster | The EKS cluster the Add-On is associated with. |
addon | string | Version of the Add-On. |
preserve | boolean | Specifying this option preserves the add-on software on your cluster but Amazon EKS stops managing any settings for the add-on. |
addonName
Type:
string
Name of the Add-On.
cluster
Type:
ICluster
The EKS cluster the Add-On is associated with.
addonVersion?
Type:
string
(optional, default: the latest version.)
Version of the Add-On.
You can check all available versions with describe-addon-versons.
For example, this lists all available versions for the eks-pod-identity-agent
addon:
$ aws eks describe-addon-versions --addon-name eks-pod-identity-agent
--query 'addons[].addonVersions[].addonVersion'
preserveOnDelete?
Type:
boolean
(optional, default: true)
Specifying this option preserves the add-on software on your cluster but Amazon EKS stops managing any settings for the add-on.
If an IAM account is associated with the add-on, it isn't removed.
Properties
Name | Type | Description |
---|---|---|
addon | string | Arn of the addon. |
addon | string | Name of the addon. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
addonArn
Type:
string
Arn of the addon.
addonName
Type:
string
Name of the addon.
env
Type:
Resource
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.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Creates an IAddon from an existing addon ARN. |
static from | Creates an IAddon instance from the given addon attributes. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
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
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
AddonArn(scope, id, addonArn)
static frompublic static fromAddonArn(scope: Construct, id: string, addonArn: string): IAddon
Parameters
- scope
Construct
— - The parent construct. - id
string
— - The ID of the construct. - addonArn
string
— - The ARN of the addon.
Returns
Creates an IAddon
from an existing addon ARN.
AddonAttributes(scope, id, attrs)
static frompublic static fromAddonAttributes(scope: Construct, id: string, attrs: AddonAttributes): IAddon
Parameters
- scope
Construct
— - The parent construct. - id
string
— - The construct ID. - attrs
Addon
— - The attributes of the addon, including the addon name and the cluster name.Attributes
Returns
Creates an IAddon
instance from the given addon attributes.