ServiceAccountOptions Struct
Options for ServiceAccount.
| Source | aws-eks/lib/service-account.ts |
|---|---|
| Type last changed |
Example
declare const cluster: eks.Cluster;
// add service account with annotations and labels
const serviceAccount = cluster.addServiceAccount('MyServiceAccount', {
annotations: {
'eks.amazonaws.com/sts-regional-endpoints': 'false',
},
labels: {
'some-label': 'with-some-value',
},
});
# cluster: eks.Cluster
# add service account with annotations and labels
service_account = cluster.add_service_account("MyServiceAccount",
annotations={
"eks.amazonaws.com/sts-regional-endpoints": "false"
},
labels={
"some-label": "with-some-value"
}
)
Cluster cluster;
// add service account with annotations and labels
ServiceAccount serviceAccount = cluster.addServiceAccount("MyServiceAccount", ServiceAccountOptions.builder()
.annotations(Map.of(
"eks.amazonaws.com/sts-regional-endpoints", "false"))
.labels(Map.of(
"some-label", "with-some-value"))
.build());
// Install: dotnet add package Amazon.CDK.Lib
Cluster cluster;
// add service account with annotations and labels
var serviceAccount = cluster.AddServiceAccount("MyServiceAccount", new ServiceAccountOptions {
Annotations = new Dictionary<string, string> {
{ "eks.amazonaws.com/sts-regional-endpoints", "false" }
},
Labels = new Dictionary<string, string> {
{ "some-label", "with-some-value" }
}
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var cluster Cluster
// add service account with annotations and labels
serviceAccount := cluster.addServiceAccount(jsii.String("MyServiceAccount"), &ServiceAccountOptions{
Annotations: map[string]*string{
"eks.amazonaws.com/sts-regional-endpoints": jsii.String("false"),
},
Labels: map[string]*string{
"some-label": jsii.String("with-some-value"),
},
})
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