diff --git a/examples/managed-nodegroups-go/main.go b/examples/managed-nodegroups-go/main.go index 52d816ee4..b0395191d 100644 --- a/examples/managed-nodegroups-go/main.go +++ b/examples/managed-nodegroups-go/main.go @@ -95,8 +95,9 @@ func main() { _, err = eks.NewManagedNodeGroup(ctx, "aws-managed-ng0", &eks.ManagedNodeGroupArgs{ - Cluster: cluster, - NodeRole: role0, + Cluster: cluster, + NodeRole: role0, + KubeletExtraArgs: pulumi.StringRef("--max-pods=500"), }) if err != nil { return err diff --git a/examples/managed-nodegroups/index.ts b/examples/managed-nodegroups/index.ts index 4d3bd378f..d349ffb9a 100644 --- a/examples/managed-nodegroups/index.ts +++ b/examples/managed-nodegroups/index.ts @@ -22,6 +22,7 @@ export const kubeconfig = cluster.kubeconfig; const managedNodeGroup0 = eks.createManagedNodeGroup("example-managed-ng0", { cluster: cluster, nodeRole: role0, + kubeletExtraArgs: "--max-pods=500", }); // Create a simple AWS managed node group using a cluster as input and the diff --git a/nodejs/eks/nodegroup.ts b/nodejs/eks/nodegroup.ts index b7e8a8e16..87cd16a26 100644 --- a/nodejs/eks/nodegroup.ts +++ b/nodejs/eks/nodegroup.ts @@ -222,7 +222,7 @@ export interface NodeGroupBaseOptions { kubeletExtraArgs?: string; /** - * Additional args to pass directly to `/etc/eks/bootstrap.sh`. Fror details on available options, see: + * Additional args to pass directly to `/etc/eks/bootstrap.sh`. For details on available options, see: * https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh. Note that the `--apiserver-endpoint`, * `--b64-cluster-ca` and `--kubelet-extra-args` flags are included automatically based on other configuration * parameters. @@ -1437,6 +1437,25 @@ export type ManagedNodeGroupOptions = Omit< */ clusterName?: pulumi.Output; + /** + * Extra args to pass to the Kubelet. Corresponds to the options passed in the `--kubeletExtraArgs` flag to + * `/etc/eks/bootstrap.sh`. For example, '--port=10251 --address=0.0.0.0'. To escape characters in the extra args + * value, wrap the value in quotes. For example, `kubeletExtraArgs = '--allowed-unsafe-sysctls "net.core.somaxconn"'`. + * + * Note that this field conflicts with `launchTemplate`. + */ + kubeletExtraArgs?: string; + + /** + * Additional args to pass directly to `/etc/eks/bootstrap.sh`. For details on available options, see: + * https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh. Note that the `--apiserver-endpoint`, + * `--b64-cluster-ca` and `--kubelet-extra-args` flags are included automatically based on other configuration + * parameters. + * + * Note that this field conflicts with `launchTemplate`. + */ + bootstrapExtraArgs?: string; + /** * Make nodeGroupName optional, since the NodeGroup resource name can be * used as a default. @@ -1657,6 +1676,20 @@ function createManagedNodeGroupInternal( delete (nodeGroupArgs).cluster; } + // Create a custom launch template for the managed node group if the user specifies either kubeletExtraArgs or bootstrapExtraArgs. + // If the user sepcifies a custom LaunchTemplate, we throw an error and suggest that the user include this in the launch template that they are providing. + // If neither of these are provided, we can use the default launch template for managed node groups. + if (args.launchTemplate && (args.kubeletExtraArgs || args.bootstrapExtraArgs)) { + throw new Error( + "If you provide a custom launch template, you cannot provide kubeletExtraArgs or bootstrapExtraArgs. Please include these in the launch template that you are providing.", + ); + } + + let launchTemplate: aws.ec2.LaunchTemplate | undefined; + if (args.kubeletExtraArgs || args.bootstrapExtraArgs) { + launchTemplate = createMNGCustomLaunchTemplate(name, args, core, parent, provider); + } + // Make the aws-auth configmap a dependency of the node group. const ngDeps = core.apply((c) => (c.eksNodeAccess !== undefined ? [c.eksNodeAccess] : [])); // Create the managed node group. @@ -1677,6 +1710,7 @@ function createManagedNodeGroupInternal( }; }), subnetIds: subnetIds, + launchTemplate: launchTemplate ? { id: launchTemplate.id, version: launchTemplate.latestVersion.apply((version) => {return `${version}`})} : undefined, }, { parent: parent, dependsOn: ngDeps, provider }, ); @@ -1684,6 +1718,49 @@ function createManagedNodeGroupInternal( return nodeGroup; } +/** + * Create a custom launch template for the managed node group if the user specifies either kubeletExtraArgs or bootstrapExtraArgs. + */ +function createMNGCustomLaunchTemplate( + name: string, + args: Omit, + core: pulumi.Output>, + parent: pulumi.Resource, + provider?: pulumi.ProviderResource, +): aws.ec2.LaunchTemplate { + const kubeletExtraArgs = args.kubeletExtraArgs ? args.kubeletExtraArgs.split(" ") : []; + let bootstrapExtraArgs = args.bootstrapExtraArgs ? " " + args.bootstrapExtraArgs : ""; + + if (kubeletExtraArgs.length === 1) { + // For backward compatibility with previous versions of this package, don't wrap a single argument with `''`. + bootstrapExtraArgs += ` --kubelet-extra-args ${kubeletExtraArgs[0]}`; + } else if (kubeletExtraArgs.length > 1) { + bootstrapExtraArgs += ` --kubelet-extra-args '${kubeletExtraArgs.join(" ")}'`; + } + + const userdata = pulumi.all([core.cluster.name, core.cluster.endpoint, core.cluster.certificateAuthority.data, args.clusterName]).apply(([clusterName, clusterEndpoint, clusterCertAuthority, argsClusterName]) => { + return `#!/bin/bash + + /etc/eks/bootstrap.sh --apiserver-endpoint "${clusterEndpoint}" --b64-cluster-ca "${ + clusterCertAuthority + }" "${argsClusterName || clusterName}"${bootstrapExtraArgs} + `; + }); + + // Encode the user data as base64. + const encodedUserData = pulumi.output(userdata).apply((ud) => Buffer.from(ud, "utf-8").toString("base64")); + + const nodeLaunchTemplate = new aws.ec2.LaunchTemplate( + `${name}-launchTemplate`, + { + userData: encodedUserData, + }, + { parent, provider }, + ); + + return nodeLaunchTemplate; +} + /** * getRecommendedAMI returns the recommended AMI to use for a given configuration * when none is provided by the user. diff --git a/provider/cmd/pulumi-gen-eks/main.go b/provider/cmd/pulumi-gen-eks/main.go index 3daf6b8b1..7161e9ea3 100644 --- a/provider/cmd/pulumi-gen-eks/main.go +++ b/provider/cmd/pulumi-gen-eks/main.go @@ -754,8 +754,9 @@ func generateSchema() schema.PackageSpec { "will not be managed.", }, "launchTemplate": { - TypeSpec: schema.TypeSpec{Ref: awsRef("#/types/aws:eks%2FNodeGroupLaunchTemplate:NodeGroupLaunchTemplate")}, - Description: "Launch Template settings.", + TypeSpec: schema.TypeSpec{Ref: awsRef("#/types/aws:eks%2FNodeGroupLaunchTemplate:NodeGroupLaunchTemplate")}, + Description: "Launch Template settings.\n\n" + + "Note: This field is mutually exclusive with `kubeletExtraArgs` and `bootstrapExtraArgs`.", }, "nodeGroupName": { TypeSpec: schema.TypeSpec{Type: "string"}, @@ -830,6 +831,29 @@ func generateSchema() schema.PackageSpec { "version": { TypeSpec: schema.TypeSpec{Type: "string"}, }, + "kubeletExtraArgs": { + TypeSpec: schema.TypeSpec{ + Type: "string", + Plain: true, + }, + Description: "Extra args to pass to the Kubelet. Corresponds to the options passed in the " + + "`--kubeletExtraArgs` flag to `/etc/eks/bootstrap.sh`. For example, " + + "'--port=10251 --address=0.0.0.0'. To escape characters in the extra args" + + "value, wrap the value in quotes. For example, `kubeletExtraArgs = '--allowed-unsafe-sysctls \"net.core.somaxconn\"'`.\n" + + "Note that this field conflicts with `launchTemplate`.", + }, + "bootstrapExtraArgs": { + TypeSpec: schema.TypeSpec{ + Type: "string", + Plain: true, + }, + Description: "Additional args to pass directly to `/etc/eks/bootstrap.sh`. For details on " + + "available options, see: " + + "https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh. " + + "Note that the `--apiserver-endpoint`, `--b64-cluster-ca` and `--kubelet-extra-args` " + + "flags are included automatically based on other configuration parameters.\n\n" + + "Note that this field conflicts with `launchTemplate`.", + }, }, RequiredInputs: []string{"cluster"}, }, @@ -1642,7 +1666,7 @@ func nodeGroupProperties(cluster, v2 bool) map[string]schema.PropertySpec { }, "enableDetailedMonitoring": { TypeSpec: schema.TypeSpec{ - Type: "boolean", + Type: "boolean", }, Description: "Enables/disables detailed monitoring of the EC2 instances.\n\n" + "With detailed monitoring, all metrics, including status check metrics, are available in 1-minute intervals.\n" + diff --git a/provider/cmd/pulumi-resource-eks/schema.json b/provider/cmd/pulumi-resource-eks/schema.json index b44cc85bd..c14cfcf67 100644 --- a/provider/cmd/pulumi-resource-eks/schema.json +++ b/provider/cmd/pulumi-resource-eks/schema.json @@ -984,6 +984,11 @@ "type": "string", "description": "Type of Amazon Machine Image (AMI) associated with the EKS Node Group. Defaults to `AL2_x86_64`. See the AWS documentation (https://docs.aws.amazon.com/eks/latest/APIReference/API_Nodegroup.html#AmazonEKS-Type-Nodegroup-amiType) for valid AMI Types. This provider will only perform drift detection if a configuration value is provided." }, + "bootstrapExtraArgs": { + "type": "string", + "plain": true, + "description": "Additional args to pass directly to `/etc/eks/bootstrap.sh`. For details on available options, see: https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh. Note that the `--apiserver-endpoint`, `--b64-cluster-ca` and `--kubelet-extra-args` flags are included automatically based on other configuration parameters.\n\nNote that this field conflicts with `launchTemplate`." + }, "capacityType": { "type": "string", "description": "Type of capacity associated with the EKS Node Group. Valid values: `ON_DEMAND`, `SPOT`. This provider will only perform drift detection if a configuration value is provided." @@ -1018,6 +1023,11 @@ }, "description": "Set of instance types associated with the EKS Node Group. Defaults to `[\"t3.medium\"]`. This provider will only perform drift detection if a configuration value is provided. Currently, the EKS API only accepts a single value in the set." }, + "kubeletExtraArgs": { + "type": "string", + "plain": true, + "description": "Extra args to pass to the Kubelet. Corresponds to the options passed in the `--kubeletExtraArgs` flag to `/etc/eks/bootstrap.sh`. For example, '--port=10251 --address=0.0.0.0'. To escape characters in the extra argsvalue, wrap the value in quotes. For example, `kubeletExtraArgs = '--allowed-unsafe-sysctls \"net.core.somaxconn\"'`.\nNote that this field conflicts with `launchTemplate`." + }, "labels": { "type": "object", "additionalProperties": { @@ -1027,7 +1037,7 @@ }, "launchTemplate": { "$ref": "/aws/v6.5.0/schema.json#/types/aws:eks%2FNodeGroupLaunchTemplate:NodeGroupLaunchTemplate", - "description": "Launch Template settings." + "description": "Launch Template settings.\n\nNote: This field is mutually exclusive with `kubeletExtraArgs` and `bootstrapExtraArgs`." }, "nodeGroupName": { "type": "string", diff --git a/sdk/dotnet/ManagedNodeGroup.cs b/sdk/dotnet/ManagedNodeGroup.cs index 76d82d509..7368b9fd7 100644 --- a/sdk/dotnet/ManagedNodeGroup.cs +++ b/sdk/dotnet/ManagedNodeGroup.cs @@ -58,6 +58,14 @@ public sealed class ManagedNodeGroupArgs : global::Pulumi.ResourceArgs [Input("amiType")] public Input? AmiType { get; set; } + /// + /// Additional args to pass directly to `/etc/eks/bootstrap.sh`. For details on available options, see: https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh. Note that the `--apiserver-endpoint`, `--b64-cluster-ca` and `--kubelet-extra-args` flags are included automatically based on other configuration parameters. + /// + /// Note that this field conflicts with `launchTemplate`. + /// + [Input("bootstrapExtraArgs")] + public string? BootstrapExtraArgs { get; set; } + /// /// Type of capacity associated with the EKS Node Group. Valid values: `ON_DEMAND`, `SPOT`. This provider will only perform drift detection if a configuration value is provided. /// @@ -100,6 +108,13 @@ public InputList InstanceTypes set => _instanceTypes = value; } + /// + /// Extra args to pass to the Kubelet. Corresponds to the options passed in the `--kubeletExtraArgs` flag to `/etc/eks/bootstrap.sh`. For example, '--port=10251 --address=0.0.0.0'. To escape characters in the extra argsvalue, wrap the value in quotes. For example, `kubeletExtraArgs = '--allowed-unsafe-sysctls "net.core.somaxconn"'`. + /// Note that this field conflicts with `launchTemplate`. + /// + [Input("kubeletExtraArgs")] + public string? KubeletExtraArgs { get; set; } + [Input("labels")] private InputMap? _labels; @@ -114,6 +129,8 @@ public InputMap Labels /// /// Launch Template settings. + /// + /// Note: This field is mutually exclusive with `kubeletExtraArgs` and `bootstrapExtraArgs`. /// [Input("launchTemplate")] public Input? LaunchTemplate { get; set; } diff --git a/sdk/go/eks/managedNodeGroup.go b/sdk/go/eks/managedNodeGroup.go index 74fd1e8b5..f3b80b481 100644 --- a/sdk/go/eks/managedNodeGroup.go +++ b/sdk/go/eks/managedNodeGroup.go @@ -47,6 +47,10 @@ func NewManagedNodeGroup(ctx *pulumi.Context, type managedNodeGroupArgs struct { // Type of Amazon Machine Image (AMI) associated with the EKS Node Group. Defaults to `AL2_x86_64`. See the AWS documentation (https://docs.aws.amazon.com/eks/latest/APIReference/API_Nodegroup.html#AmazonEKS-Type-Nodegroup-amiType) for valid AMI Types. This provider will only perform drift detection if a configuration value is provided. AmiType *string `pulumi:"amiType"` + // Additional args to pass directly to `/etc/eks/bootstrap.sh`. For details on available options, see: https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh. Note that the `--apiserver-endpoint`, `--b64-cluster-ca` and `--kubelet-extra-args` flags are included automatically based on other configuration parameters. + // + // Note that this field conflicts with `launchTemplate`. + BootstrapExtraArgs *string `pulumi:"bootstrapExtraArgs"` // Type of capacity associated with the EKS Node Group. Valid values: `ON_DEMAND`, `SPOT`. This provider will only perform drift detection if a configuration value is provided. CapacityType *string `pulumi:"capacityType"` // The target EKS cluster. @@ -59,9 +63,14 @@ type managedNodeGroupArgs struct { ForceUpdateVersion *bool `pulumi:"forceUpdateVersion"` // Set of instance types associated with the EKS Node Group. Defaults to `["t3.medium"]`. This provider will only perform drift detection if a configuration value is provided. Currently, the EKS API only accepts a single value in the set. InstanceTypes []string `pulumi:"instanceTypes"` + // Extra args to pass to the Kubelet. Corresponds to the options passed in the `--kubeletExtraArgs` flag to `/etc/eks/bootstrap.sh`. For example, '--port=10251 --address=0.0.0.0'. To escape characters in the extra argsvalue, wrap the value in quotes. For example, `kubeletExtraArgs = '--allowed-unsafe-sysctls "net.core.somaxconn"'`. + // Note that this field conflicts with `launchTemplate`. + KubeletExtraArgs *string `pulumi:"kubeletExtraArgs"` // Key-value map of Kubernetes labels. Only labels that are applied with the EKS API are managed by this argument. Other Kubernetes labels applied to the EKS Node Group will not be managed. Labels map[string]string `pulumi:"labels"` // Launch Template settings. + // + // Note: This field is mutually exclusive with `kubeletExtraArgs` and `bootstrapExtraArgs`. LaunchTemplate *eks.NodeGroupLaunchTemplate `pulumi:"launchTemplate"` // Name of the EKS Node Group. If omitted, this provider will assign a random, unique name. Conflicts with `nodeGroupNamePrefix`. NodeGroupName *string `pulumi:"nodeGroupName"` @@ -106,6 +115,10 @@ type managedNodeGroupArgs struct { type ManagedNodeGroupArgs struct { // Type of Amazon Machine Image (AMI) associated with the EKS Node Group. Defaults to `AL2_x86_64`. See the AWS documentation (https://docs.aws.amazon.com/eks/latest/APIReference/API_Nodegroup.html#AmazonEKS-Type-Nodegroup-amiType) for valid AMI Types. This provider will only perform drift detection if a configuration value is provided. AmiType pulumi.StringPtrInput + // Additional args to pass directly to `/etc/eks/bootstrap.sh`. For details on available options, see: https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh. Note that the `--apiserver-endpoint`, `--b64-cluster-ca` and `--kubelet-extra-args` flags are included automatically based on other configuration parameters. + // + // Note that this field conflicts with `launchTemplate`. + BootstrapExtraArgs *string // Type of capacity associated with the EKS Node Group. Valid values: `ON_DEMAND`, `SPOT`. This provider will only perform drift detection if a configuration value is provided. CapacityType pulumi.StringPtrInput // The target EKS cluster. @@ -118,9 +131,14 @@ type ManagedNodeGroupArgs struct { ForceUpdateVersion pulumi.BoolPtrInput // Set of instance types associated with the EKS Node Group. Defaults to `["t3.medium"]`. This provider will only perform drift detection if a configuration value is provided. Currently, the EKS API only accepts a single value in the set. InstanceTypes pulumi.StringArrayInput + // Extra args to pass to the Kubelet. Corresponds to the options passed in the `--kubeletExtraArgs` flag to `/etc/eks/bootstrap.sh`. For example, '--port=10251 --address=0.0.0.0'. To escape characters in the extra argsvalue, wrap the value in quotes. For example, `kubeletExtraArgs = '--allowed-unsafe-sysctls "net.core.somaxconn"'`. + // Note that this field conflicts with `launchTemplate`. + KubeletExtraArgs *string // Key-value map of Kubernetes labels. Only labels that are applied with the EKS API are managed by this argument. Other Kubernetes labels applied to the EKS Node Group will not be managed. Labels pulumi.StringMapInput // Launch Template settings. + // + // Note: This field is mutually exclusive with `kubeletExtraArgs` and `bootstrapExtraArgs`. LaunchTemplate eks.NodeGroupLaunchTemplatePtrInput // Name of the EKS Node Group. If omitted, this provider will assign a random, unique name. Conflicts with `nodeGroupNamePrefix`. NodeGroupName pulumi.StringPtrInput diff --git a/sdk/java/src/main/java/com/pulumi/eks/ManagedNodeGroupArgs.java b/sdk/java/src/main/java/com/pulumi/eks/ManagedNodeGroupArgs.java index 4156a2cf3..55fb523c1 100644 --- a/sdk/java/src/main/java/com/pulumi/eks/ManagedNodeGroupArgs.java +++ b/sdk/java/src/main/java/com/pulumi/eks/ManagedNodeGroupArgs.java @@ -42,6 +42,25 @@ public Optional> amiType() { return Optional.ofNullable(this.amiType); } + /** + * Additional args to pass directly to `/etc/eks/bootstrap.sh`. For details on available options, see: https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh. Note that the `--apiserver-endpoint`, `--b64-cluster-ca` and `--kubelet-extra-args` flags are included automatically based on other configuration parameters. + * + * Note that this field conflicts with `launchTemplate`. + * + */ + @Import(name="bootstrapExtraArgs") + private @Nullable String bootstrapExtraArgs; + + /** + * @return Additional args to pass directly to `/etc/eks/bootstrap.sh`. For details on available options, see: https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh. Note that the `--apiserver-endpoint`, `--b64-cluster-ca` and `--kubelet-extra-args` flags are included automatically based on other configuration parameters. + * + * Note that this field conflicts with `launchTemplate`. + * + */ + public Optional bootstrapExtraArgs() { + return Optional.ofNullable(this.bootstrapExtraArgs); + } + /** * Type of capacity associated with the EKS Node Group. Valid values: `ON_DEMAND`, `SPOT`. This provider will only perform drift detection if a configuration value is provided. * @@ -132,6 +151,23 @@ public Optional>> instanceTypes() { return Optional.ofNullable(this.instanceTypes); } + /** + * Extra args to pass to the Kubelet. Corresponds to the options passed in the `--kubeletExtraArgs` flag to `/etc/eks/bootstrap.sh`. For example, '--port=10251 --address=0.0.0.0'. To escape characters in the extra argsvalue, wrap the value in quotes. For example, `kubeletExtraArgs = '--allowed-unsafe-sysctls "net.core.somaxconn"'`. + * Note that this field conflicts with `launchTemplate`. + * + */ + @Import(name="kubeletExtraArgs") + private @Nullable String kubeletExtraArgs; + + /** + * @return Extra args to pass to the Kubelet. Corresponds to the options passed in the `--kubeletExtraArgs` flag to `/etc/eks/bootstrap.sh`. For example, '--port=10251 --address=0.0.0.0'. To escape characters in the extra argsvalue, wrap the value in quotes. For example, `kubeletExtraArgs = '--allowed-unsafe-sysctls "net.core.somaxconn"'`. + * Note that this field conflicts with `launchTemplate`. + * + */ + public Optional kubeletExtraArgs() { + return Optional.ofNullable(this.kubeletExtraArgs); + } + /** * Key-value map of Kubernetes labels. Only labels that are applied with the EKS API are managed by this argument. Other Kubernetes labels applied to the EKS Node Group will not be managed. * @@ -150,6 +186,8 @@ public Optional>> labels() { /** * Launch Template settings. * + * Note: This field is mutually exclusive with `kubeletExtraArgs` and `bootstrapExtraArgs`. + * */ @Import(name="launchTemplate") private @Nullable Output launchTemplate; @@ -157,6 +195,8 @@ public Optional>> labels() { /** * @return Launch Template settings. * + * Note: This field is mutually exclusive with `kubeletExtraArgs` and `bootstrapExtraArgs`. + * */ public Optional> launchTemplate() { return Optional.ofNullable(this.launchTemplate); @@ -355,12 +395,14 @@ private ManagedNodeGroupArgs() {} private ManagedNodeGroupArgs(ManagedNodeGroupArgs $) { this.amiType = $.amiType; + this.bootstrapExtraArgs = $.bootstrapExtraArgs; this.capacityType = $.capacityType; this.cluster = $.cluster; this.clusterName = $.clusterName; this.diskSize = $.diskSize; this.forceUpdateVersion = $.forceUpdateVersion; this.instanceTypes = $.instanceTypes; + this.kubeletExtraArgs = $.kubeletExtraArgs; this.labels = $.labels; this.launchTemplate = $.launchTemplate; this.nodeGroupName = $.nodeGroupName; @@ -415,6 +457,19 @@ public Builder amiType(String amiType) { return amiType(Output.of(amiType)); } + /** + * @param bootstrapExtraArgs Additional args to pass directly to `/etc/eks/bootstrap.sh`. For details on available options, see: https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh. Note that the `--apiserver-endpoint`, `--b64-cluster-ca` and `--kubelet-extra-args` flags are included automatically based on other configuration parameters. + * + * Note that this field conflicts with `launchTemplate`. + * + * @return builder + * + */ + public Builder bootstrapExtraArgs(@Nullable String bootstrapExtraArgs) { + $.bootstrapExtraArgs = bootstrapExtraArgs; + return this; + } + /** * @param capacityType Type of capacity associated with the EKS Node Group. Valid values: `ON_DEMAND`, `SPOT`. This provider will only perform drift detection if a configuration value is provided. * @@ -571,6 +626,18 @@ public Builder instanceTypes(String... instanceTypes) { return instanceTypes(List.of(instanceTypes)); } + /** + * @param kubeletExtraArgs Extra args to pass to the Kubelet. Corresponds to the options passed in the `--kubeletExtraArgs` flag to `/etc/eks/bootstrap.sh`. For example, '--port=10251 --address=0.0.0.0'. To escape characters in the extra argsvalue, wrap the value in quotes. For example, `kubeletExtraArgs = '--allowed-unsafe-sysctls "net.core.somaxconn"'`. + * Note that this field conflicts with `launchTemplate`. + * + * @return builder + * + */ + public Builder kubeletExtraArgs(@Nullable String kubeletExtraArgs) { + $.kubeletExtraArgs = kubeletExtraArgs; + return this; + } + /** * @param labels Key-value map of Kubernetes labels. Only labels that are applied with the EKS API are managed by this argument. Other Kubernetes labels applied to the EKS Node Group will not be managed. * @@ -595,6 +662,8 @@ public Builder labels(Map labels) { /** * @param launchTemplate Launch Template settings. * + * Note: This field is mutually exclusive with `kubeletExtraArgs` and `bootstrapExtraArgs`. + * * @return builder * */ @@ -606,6 +675,8 @@ public Builder launchTemplate(@Nullable Output laun /** * @param launchTemplate Launch Template settings. * + * Note: This field is mutually exclusive with `kubeletExtraArgs` and `bootstrapExtraArgs`. + * * @return builder * */ diff --git a/sdk/python/pulumi_eks/managed_node_group.py b/sdk/python/pulumi_eks/managed_node_group.py index 5cfbcb6f7..5311ac3ee 100644 --- a/sdk/python/pulumi_eks/managed_node_group.py +++ b/sdk/python/pulumi_eks/managed_node_group.py @@ -21,11 +21,13 @@ class ManagedNodeGroupArgs: def __init__(__self__, *, cluster: pulumi.Input[Union['Cluster', 'CoreDataArgs']], ami_type: Optional[pulumi.Input[str]] = None, + bootstrap_extra_args: Optional[str] = None, capacity_type: Optional[pulumi.Input[str]] = None, cluster_name: Optional[pulumi.Input[str]] = None, disk_size: Optional[pulumi.Input[int]] = None, force_update_version: Optional[pulumi.Input[bool]] = None, instance_types: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + kubelet_extra_args: Optional[str] = None, labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, launch_template: Optional[pulumi.Input['pulumi_aws.eks.NodeGroupLaunchTemplateArgs']] = None, node_group_name: Optional[pulumi.Input[str]] = None, @@ -43,13 +45,20 @@ def __init__(__self__, *, The set of arguments for constructing a ManagedNodeGroup resource. :param pulumi.Input[Union['Cluster', 'CoreDataArgs']] cluster: The target EKS cluster. :param pulumi.Input[str] ami_type: Type of Amazon Machine Image (AMI) associated with the EKS Node Group. Defaults to `AL2_x86_64`. See the AWS documentation (https://docs.aws.amazon.com/eks/latest/APIReference/API_Nodegroup.html#AmazonEKS-Type-Nodegroup-amiType) for valid AMI Types. This provider will only perform drift detection if a configuration value is provided. + :param str bootstrap_extra_args: Additional args to pass directly to `/etc/eks/bootstrap.sh`. For details on available options, see: https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh. Note that the `--apiserver-endpoint`, `--b64-cluster-ca` and `--kubelet-extra-args` flags are included automatically based on other configuration parameters. + + Note that this field conflicts with `launchTemplate`. :param pulumi.Input[str] capacity_type: Type of capacity associated with the EKS Node Group. Valid values: `ON_DEMAND`, `SPOT`. This provider will only perform drift detection if a configuration value is provided. :param pulumi.Input[str] cluster_name: Name of the EKS Cluster. :param pulumi.Input[int] disk_size: Disk size in GiB for worker nodes. Defaults to `20`. This provider will only perform drift detection if a configuration value is provided. :param pulumi.Input[bool] force_update_version: Force version update if existing pods are unable to be drained due to a pod disruption budget issue. :param pulumi.Input[Sequence[pulumi.Input[str]]] instance_types: Set of instance types associated with the EKS Node Group. Defaults to `["t3.medium"]`. This provider will only perform drift detection if a configuration value is provided. Currently, the EKS API only accepts a single value in the set. + :param str kubelet_extra_args: Extra args to pass to the Kubelet. Corresponds to the options passed in the `--kubeletExtraArgs` flag to `/etc/eks/bootstrap.sh`. For example, '--port=10251 --address=0.0.0.0'. To escape characters in the extra argsvalue, wrap the value in quotes. For example, `kubeletExtraArgs = '--allowed-unsafe-sysctls "net.core.somaxconn"'`. + Note that this field conflicts with `launchTemplate`. :param pulumi.Input[Mapping[str, pulumi.Input[str]]] labels: Key-value map of Kubernetes labels. Only labels that are applied with the EKS API are managed by this argument. Other Kubernetes labels applied to the EKS Node Group will not be managed. :param pulumi.Input['pulumi_aws.eks.NodeGroupLaunchTemplateArgs'] launch_template: Launch Template settings. + + Note: This field is mutually exclusive with `kubeletExtraArgs` and `bootstrapExtraArgs`. :param pulumi.Input[str] node_group_name: Name of the EKS Node Group. If omitted, this provider will assign a random, unique name. Conflicts with `nodeGroupNamePrefix`. :param pulumi.Input[str] node_group_name_prefix: Creates a unique name beginning with the specified prefix. Conflicts with `nodeGroupName`. :param pulumi.Input['pulumi_aws.iam.Role'] node_role: The IAM Role that provides permissions for the EKS Node Group. @@ -80,6 +89,8 @@ def __init__(__self__, *, pulumi.set(__self__, "cluster", cluster) if ami_type is not None: pulumi.set(__self__, "ami_type", ami_type) + if bootstrap_extra_args is not None: + pulumi.set(__self__, "bootstrap_extra_args", bootstrap_extra_args) if capacity_type is not None: pulumi.set(__self__, "capacity_type", capacity_type) if cluster_name is not None: @@ -90,6 +101,8 @@ def __init__(__self__, *, pulumi.set(__self__, "force_update_version", force_update_version) if instance_types is not None: pulumi.set(__self__, "instance_types", instance_types) + if kubelet_extra_args is not None: + pulumi.set(__self__, "kubelet_extra_args", kubelet_extra_args) if labels is not None: pulumi.set(__self__, "labels", labels) if launch_template is not None: @@ -141,6 +154,20 @@ def ami_type(self) -> Optional[pulumi.Input[str]]: def ami_type(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "ami_type", value) + @property + @pulumi.getter(name="bootstrapExtraArgs") + def bootstrap_extra_args(self) -> Optional[str]: + """ + Additional args to pass directly to `/etc/eks/bootstrap.sh`. For details on available options, see: https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh. Note that the `--apiserver-endpoint`, `--b64-cluster-ca` and `--kubelet-extra-args` flags are included automatically based on other configuration parameters. + + Note that this field conflicts with `launchTemplate`. + """ + return pulumi.get(self, "bootstrap_extra_args") + + @bootstrap_extra_args.setter + def bootstrap_extra_args(self, value: Optional[str]): + pulumi.set(self, "bootstrap_extra_args", value) + @property @pulumi.getter(name="capacityType") def capacity_type(self) -> Optional[pulumi.Input[str]]: @@ -201,6 +228,19 @@ def instance_types(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]: def instance_types(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]): pulumi.set(self, "instance_types", value) + @property + @pulumi.getter(name="kubeletExtraArgs") + def kubelet_extra_args(self) -> Optional[str]: + """ + Extra args to pass to the Kubelet. Corresponds to the options passed in the `--kubeletExtraArgs` flag to `/etc/eks/bootstrap.sh`. For example, '--port=10251 --address=0.0.0.0'. To escape characters in the extra argsvalue, wrap the value in quotes. For example, `kubeletExtraArgs = '--allowed-unsafe-sysctls "net.core.somaxconn"'`. + Note that this field conflicts with `launchTemplate`. + """ + return pulumi.get(self, "kubelet_extra_args") + + @kubelet_extra_args.setter + def kubelet_extra_args(self, value: Optional[str]): + pulumi.set(self, "kubelet_extra_args", value) + @property @pulumi.getter def labels(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]: @@ -218,6 +258,8 @@ def labels(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]) def launch_template(self) -> Optional[pulumi.Input['pulumi_aws.eks.NodeGroupLaunchTemplateArgs']]: """ Launch Template settings. + + Note: This field is mutually exclusive with `kubeletExtraArgs` and `bootstrapExtraArgs`. """ return pulumi.get(self, "launch_template") @@ -377,12 +419,14 @@ def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, ami_type: Optional[pulumi.Input[str]] = None, + bootstrap_extra_args: Optional[str] = None, capacity_type: Optional[pulumi.Input[str]] = None, cluster: Optional[pulumi.Input[Union['Cluster', pulumi.InputType['CoreDataArgs']]]] = None, cluster_name: Optional[pulumi.Input[str]] = None, disk_size: Optional[pulumi.Input[int]] = None, force_update_version: Optional[pulumi.Input[bool]] = None, instance_types: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + kubelet_extra_args: Optional[str] = None, labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, launch_template: Optional[pulumi.Input[pulumi.InputType['pulumi_aws.eks.NodeGroupLaunchTemplateArgs']]] = None, node_group_name: Optional[pulumi.Input[str]] = None, @@ -406,14 +450,21 @@ def __init__(__self__, :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] ami_type: Type of Amazon Machine Image (AMI) associated with the EKS Node Group. Defaults to `AL2_x86_64`. See the AWS documentation (https://docs.aws.amazon.com/eks/latest/APIReference/API_Nodegroup.html#AmazonEKS-Type-Nodegroup-amiType) for valid AMI Types. This provider will only perform drift detection if a configuration value is provided. + :param str bootstrap_extra_args: Additional args to pass directly to `/etc/eks/bootstrap.sh`. For details on available options, see: https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh. Note that the `--apiserver-endpoint`, `--b64-cluster-ca` and `--kubelet-extra-args` flags are included automatically based on other configuration parameters. + + Note that this field conflicts with `launchTemplate`. :param pulumi.Input[str] capacity_type: Type of capacity associated with the EKS Node Group. Valid values: `ON_DEMAND`, `SPOT`. This provider will only perform drift detection if a configuration value is provided. :param pulumi.Input[Union['Cluster', pulumi.InputType['CoreDataArgs']]] cluster: The target EKS cluster. :param pulumi.Input[str] cluster_name: Name of the EKS Cluster. :param pulumi.Input[int] disk_size: Disk size in GiB for worker nodes. Defaults to `20`. This provider will only perform drift detection if a configuration value is provided. :param pulumi.Input[bool] force_update_version: Force version update if existing pods are unable to be drained due to a pod disruption budget issue. :param pulumi.Input[Sequence[pulumi.Input[str]]] instance_types: Set of instance types associated with the EKS Node Group. Defaults to `["t3.medium"]`. This provider will only perform drift detection if a configuration value is provided. Currently, the EKS API only accepts a single value in the set. + :param str kubelet_extra_args: Extra args to pass to the Kubelet. Corresponds to the options passed in the `--kubeletExtraArgs` flag to `/etc/eks/bootstrap.sh`. For example, '--port=10251 --address=0.0.0.0'. To escape characters in the extra argsvalue, wrap the value in quotes. For example, `kubeletExtraArgs = '--allowed-unsafe-sysctls "net.core.somaxconn"'`. + Note that this field conflicts with `launchTemplate`. :param pulumi.Input[Mapping[str, pulumi.Input[str]]] labels: Key-value map of Kubernetes labels. Only labels that are applied with the EKS API are managed by this argument. Other Kubernetes labels applied to the EKS Node Group will not be managed. :param pulumi.Input[pulumi.InputType['pulumi_aws.eks.NodeGroupLaunchTemplateArgs']] launch_template: Launch Template settings. + + Note: This field is mutually exclusive with `kubeletExtraArgs` and `bootstrapExtraArgs`. :param pulumi.Input[str] node_group_name: Name of the EKS Node Group. If omitted, this provider will assign a random, unique name. Conflicts with `nodeGroupNamePrefix`. :param pulumi.Input[str] node_group_name_prefix: Creates a unique name beginning with the specified prefix. Conflicts with `nodeGroupName`. :param pulumi.Input['pulumi_aws.iam.Role'] node_role: The IAM Role that provides permissions for the EKS Node Group. @@ -469,12 +520,14 @@ def _internal_init(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, ami_type: Optional[pulumi.Input[str]] = None, + bootstrap_extra_args: Optional[str] = None, capacity_type: Optional[pulumi.Input[str]] = None, cluster: Optional[pulumi.Input[Union['Cluster', pulumi.InputType['CoreDataArgs']]]] = None, cluster_name: Optional[pulumi.Input[str]] = None, disk_size: Optional[pulumi.Input[int]] = None, force_update_version: Optional[pulumi.Input[bool]] = None, instance_types: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None, + kubelet_extra_args: Optional[str] = None, labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None, launch_template: Optional[pulumi.Input[pulumi.InputType['pulumi_aws.eks.NodeGroupLaunchTemplateArgs']]] = None, node_group_name: Optional[pulumi.Input[str]] = None, @@ -500,6 +553,7 @@ def _internal_init(__self__, __props__ = ManagedNodeGroupArgs.__new__(ManagedNodeGroupArgs) __props__.__dict__["ami_type"] = ami_type + __props__.__dict__["bootstrap_extra_args"] = bootstrap_extra_args __props__.__dict__["capacity_type"] = capacity_type if cluster is None and not opts.urn: raise TypeError("Missing required property 'cluster'") @@ -508,6 +562,7 @@ def _internal_init(__self__, __props__.__dict__["disk_size"] = disk_size __props__.__dict__["force_update_version"] = force_update_version __props__.__dict__["instance_types"] = instance_types + __props__.__dict__["kubelet_extra_args"] = kubelet_extra_args __props__.__dict__["labels"] = labels __props__.__dict__["launch_template"] = launch_template __props__.__dict__["node_group_name"] = node_group_name