Skip to content
v2.274.0

ServiceAccountOptions Struct ​

Options for ServiceAccount.

Example ​

ts
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',
  },
});

Properties ​

annotationsoptional{ [key: string]: string }annotationsoptionaltyping.Mapping[str, str]annotationsoptionalMap<String, String>AnnotationsoptionalIDictionary<string, string>Annotationsoptional*map[string]*string#
Additional annotations of the service account.

Default: no additional annotations

identityTypeoptionalIdentityTypeidentity_typeoptionalIdentityTypeidentityTypeoptionalIdentityTypeIdentityTypeoptionalIdentityTypeIdentityTypeoptionalIdentityType= IdentityType.IRSA#
The identity type to use for the service account.
labelsoptional{ [key: string]: string }labelsoptionaltyping.Mapping[str, str]labelsoptionalMap<String, String>LabelsoptionalIDictionary<string, string>Labelsoptional*map[string]*string#
Additional labels of the service account.

Default: no additional labels

nameoptionalstringnameoptionalstrnameoptionalStringNameoptionalstringNameoptional*string#
The name of the service account.

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"#
The namespace of the service account.
overwriteServiceAccountoptionalbooleanoverwrite_service_accountoptionalbooloverwriteServiceAccountoptionalBooleanOverwriteServiceAccountoptionalboolOverwriteServiceAccountoptional*bool= false#
Overwrite existing service account.

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#
The removal policy applied to the service account resources.
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