ServiceAccountProps Struct
Properties for defining service accounts.
| Source | aws-eks-v2/lib/service-account.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_eks_v2 as eks_v2 } from 'aws-cdk-lib';
declare const cluster: eks_v2.Cluster;
const serviceAccountProps: eks_v2.ServiceAccountProps = {
cluster: cluster,
// the properties below are optional
annotations: {
annotationsKey: 'annotations',
},
identityType: eks_v2.IdentityType.IRSA,
labels: {
labelsKey: 'labels',
},
name: 'name',
namespace: 'namespace',
overwriteServiceAccount: false,
removalPolicy: cdk.RemovalPolicy.DESTROY,
};
# 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_eks_v2 as eks_v2
# cluster: eks_v2.Cluster
service_account_props = eks_v2.ServiceAccountProps(
cluster=cluster,
# the properties below are optional
annotations={
"annotations_key": "annotations"
},
identity_type=eks_v2.IdentityType.IRSA,
labels={
"labels_key": "labels"
},
name="name",
namespace="namespace",
overwrite_service_account=False,
removal_policy=cdk.RemovalPolicy.DESTROY
)
// 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.eks_v2.*;
Cluster cluster;
ServiceAccountProps serviceAccountProps = ServiceAccountProps.builder()
.cluster(cluster)
// the properties below are optional
.annotations(Map.of(
"annotationsKey", "annotations"))
.identityType(IdentityType.IRSA)
.labels(Map.of(
"labelsKey", "labels"))
.name("name")
.namespace("namespace")
.overwriteServiceAccount(false)
.removalPolicy(RemovalPolicy.DESTROY)
.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.EKSv2;
Cluster cluster;
var serviceAccountProps = new ServiceAccountProps {
Cluster = cluster,
// the properties below are optional
Annotations = new Dictionary<string, string> {
{ "annotationsKey", "annotations" }
},
IdentityType = IdentityType.IRSA,
Labels = new Dictionary<string, string> {
{ "labelsKey", "labels" }
},
Name = "name",
Namespace = "namespace",
OverwriteServiceAccount = false,
RemovalPolicy = RemovalPolicy.DESTROY
};
// 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"
var cluster Cluster
serviceAccountProps := &ServiceAccountProps{
Cluster: cluster,
// the properties below are optional
Annotations: map[string]*string{
"annotationsKey": jsii.String("annotations"),
},
IdentityType: awscdk.Aws_eks_v2.IdentityType_IRSA,
Labels: map[string]*string{
"labelsKey": jsii.String("labels"),
},
Name: jsii.String("name"),
Namespace: jsii.String("namespace"),
OverwriteServiceAccount: jsii.Boolean(false),
RemovalPolicy: cdk.RemovalPolicy_DESTROY,
}
Properties
annotationsoptional{ [key: string]: string }annotationsoptionaltyping.Mapping[str, str]annotationsoptionalMap<String, String>AnnotationsoptionalIDictionary<string, string>Annotationsoptional*map[string]*string #Default: no additional annotations
identityTypeoptionalIdentityTypeidentity_typeoptionalIdentityTypeidentityTypeoptionalIdentityTypeIdentityTypeoptionalIdentityTypeIdentityTypeoptionalIdentityType = IdentityType.IRSA #labelsoptional{ [key: string]: string }labelsoptionaltyping.Mapping[str, str]labelsoptionalMap<String, String>LabelsoptionalIDictionary<string, string>Labelsoptional*map[string]*string #Default: no additional labels
Default: If no name is given, it will use the id of the resource.
The name of a ServiceAccount object must be a valid DNS subdomain name. https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
namespaceoptionalstringnamespaceoptionalstrnamespaceoptionalStringNamespaceoptionalstringNamespaceoptional*string = "default" #All namespace names must be valid RFC 1123 DNS labels. https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/#namespaces-and-dns
overwriteServiceAccountoptionalbooleanoverwrite_service_accountoptionalbooloverwriteServiceAccountoptionalBooleanOverwriteServiceAccountoptionalboolOverwriteServiceAccountoptional*bool = false #If this is set, we will use kubectl apply instead of kubectl create when the service account is created. Otherwise, if there is already a service account in the cluster with the same name, the operation will fail.
removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy = RemovalPolicy.DESTROY #notes
The removal policy controls what happens to the resources if they stop 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