CfnFargateProfilePropsMixin

class aws_cdk.mixins_preview.aws_eks.mixins.CfnFargateProfilePropsMixin(props, *, strategy=None)

Bases: Mixin

Creates an AWS Fargate profile for your Amazon EKS cluster.

You must have at least one Fargate profile in a cluster to be able to run pods on Fargate.

The Fargate profile allows an administrator to declare which pods run on Fargate and specify which pods run on which Fargate profile. This declaration is done through the profile’s selectors. Each profile can have up to five selectors that contain a namespace and labels. A namespace is required for every selector. The label field consists of multiple optional key-value pairs. Pods that match the selectors are scheduled on Fargate. If a to-be-scheduled pod matches any of the selectors in the Fargate profile, then that pod is run on Fargate.

When you create a Fargate profile, you must specify a pod execution role to use with the pods that are scheduled with the profile. This role is added to the cluster’s Kubernetes Role Based Access Control (RBAC) for authorization so that the kubelet that is running on the Fargate infrastructure can register with your Amazon EKS cluster so that it can appear in your cluster as a node. The pod execution role also provides IAM permissions to the Fargate infrastructure to allow read access to Amazon ECR image repositories. For more information, see Pod Execution Role in the Amazon EKS User Guide .

Fargate profiles are immutable. However, you can create a new updated profile to replace an existing profile and then delete the original after the updated profile has finished creating.

If any Fargate profiles in a cluster are in the DELETING status, you must wait for that Fargate profile to finish deleting before you can create any other profiles in that cluster.

For more information, see AWS Fargate profile in the Amazon EKS User Guide .

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-eks-fargateprofile.html

CloudformationResource:

AWS::EKS::FargateProfile

Mixin:

true

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.mixins_preview import mixins
from aws_cdk.mixins_preview.aws_eks import mixins as eks_mixins

cfn_fargate_profile_props_mixin = eks_mixins.CfnFargateProfilePropsMixin(eks_mixins.CfnFargateProfileMixinProps(
    cluster_name="clusterName",
    fargate_profile_name="fargateProfileName",
    pod_execution_role_arn="podExecutionRoleArn",
    selectors=[eks_mixins.CfnFargateProfilePropsMixin.SelectorProperty(
        labels=[eks_mixins.CfnFargateProfilePropsMixin.LabelProperty(
            key="key",
            value="value"
        )],
        namespace="namespace"
    )],
    subnets=["subnets"],
    tags=[CfnTag(
        key="key",
        value="value"
    )]
),
    strategy=mixins.PropertyMergeStrategy.OVERRIDE
)

Create a mixin to apply properties to AWS::EKS::FargateProfile.

Parameters:

Methods

apply_to(construct)

Apply the mixin properties to the construct.

Parameters:

construct (IConstruct)

Return type:

IConstruct

supports(construct)

Check if this mixin supports the given construct.

Parameters:

construct (IConstruct)

Return type:

bool

Attributes

CFN_PROPERTY_KEYS = ['clusterName', 'fargateProfileName', 'podExecutionRoleArn', 'selectors', 'subnets', 'tags']

Static Methods

classmethod is_mixin(x)

(experimental) Checks if x is a Mixin.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Mixin.

Stability:

experimental

LabelProperty

class CfnFargateProfilePropsMixin.LabelProperty(*, key=None, value=None)

Bases: object

A key-value pair.

Parameters:
  • key (Optional[str]) – Enter a key.

  • value (Optional[str]) – Enter a value.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-eks-fargateprofile-label.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.mixins_preview.aws_eks import mixins as eks_mixins

label_property = eks_mixins.CfnFargateProfilePropsMixin.LabelProperty(
    key="key",
    value="value"
)

Attributes

key

Enter a key.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-eks-fargateprofile-label.html#cfn-eks-fargateprofile-label-key

value

Enter a value.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-eks-fargateprofile-label.html#cfn-eks-fargateprofile-label-value

SelectorProperty

class CfnFargateProfilePropsMixin.SelectorProperty(*, labels=None, namespace=None)

Bases: object

An object representing an AWS Fargate profile selector.

Parameters:
  • labels (Union[IResolvable, Sequence[Union[IResolvable, LabelProperty, Dict[str, Any]]], None]) – The Kubernetes labels that the selector should match. A pod must contain all of the labels that are specified in the selector for it to be considered a match.

  • namespace (Optional[str]) – The Kubernetes namespace that the selector should match.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-eks-fargateprofile-selector.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk.mixins_preview.aws_eks import mixins as eks_mixins

selector_property = eks_mixins.CfnFargateProfilePropsMixin.SelectorProperty(
    labels=[eks_mixins.CfnFargateProfilePropsMixin.LabelProperty(
        key="key",
        value="value"
    )],
    namespace="namespace"
)

Attributes

labels

The Kubernetes labels that the selector should match.

A pod must contain all of the labels that are specified in the selector for it to be considered a match.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-eks-fargateprofile-selector.html#cfn-eks-fargateprofile-selector-labels

namespace

The Kubernetes namespace that the selector should match.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-eks-fargateprofile-selector.html#cfn-eks-fargateprofile-selector-namespace