Skip to content

Commit

Permalink
fix: expose nodeRootVolume fields in NodeGroup and NodeGroupV2 resour…
Browse files Browse the repository at this point in the history
…ces (#1183)

### Proposed changes

Update schema to expose the nodeRootVolume fields that is already
present in Typescript.

- Exposed existing fields to schema and regenerated SDKs
- Added a new nodegroup in Python to test `gp3` volume type
- Manually inspecting created cluster from Python test to verify gp3 is
created

### Related issues (optional)

Fixes: #895
Fixes: #677
Fixes: #784
Fixes: #718
  • Loading branch information
rquitales authored Jun 5, 2024
1 parent e2cff0f commit 0404693
Show file tree
Hide file tree
Showing 18 changed files with 1,366 additions and 6 deletions.
15 changes: 15 additions & 0 deletions examples/nodegroup-py/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,20 @@
opts=pulumi.ResourceOptions(providers={"kubernetes": cluster2_provider}),
)

eks.NodeGroup(
"example-ng-advanced-spot-gp3-py",
cluster=cluster2,
instance_type="t3.medium",
desired_capacity=1,
min_size=1,
max_size=2,
node_root_volume_type="gp3",
spot_price="1",
labels={"preemptible": "true"},
taints={"special": eks.TaintArgs(value="true", effect="NoSchedule")},
instance_profile=instance_profile3,
opts=pulumi.ResourceOptions(providers={"kubernetes": cluster2_provider}),
)

# Export the cluster's kubeconfig.
pulumi.export("kubeconfig2", cluster2.kubeconfig)
32 changes: 26 additions & 6 deletions provider/cmd/pulumi-gen-eks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ func generateSchema() schema.PackageSpec {
},
"authenticationMode": {
TypeSpec: schema.TypeSpec{
Ref: "#/types/eks:index:AuthenticationMode",
Ref: "#/types/eks:index:AuthenticationMode",
Plain: true,
},
Description: "The authentication mode of the cluster. Valid values are `CONFIG_MAP`, `API` or `API_AND_CONFIG_MAP`.\n\n" +
Expand Down Expand Up @@ -1587,9 +1587,9 @@ func generateSchema() schema.PackageSpec {
},
"eks:index:AccessEntryType": {
ObjectTypeSpec: schema.ObjectTypeSpec{
Type: "string",
Type: "string",
Description: "The type of the new access entry. Valid values are STANDARD, FARGATE_LINUX, EC2_LINUX, and EC2_WINDOWS.\n" +
"Defaults to STANDARD which provides the standard workflow. EC2_LINUX and EC2_WINDOWS types disallow users to input a kubernetesGroup, and prevent associating access policies.",
"Defaults to STANDARD which provides the standard workflow. EC2_LINUX and EC2_WINDOWS types disallow users to input a kubernetesGroup, and prevent associating access policies.",
},
Enum: []schema.EnumValueSpec{
{
Expand All @@ -1609,16 +1609,16 @@ func generateSchema() schema.PackageSpec {
},
{
Name: "EC2Windows",
Value: "EC2_WINDOWS",
Value: "EC2_WINDOWS",
Description: "For IAM roles associated with self-managed Windows node groups. Allows the nodes to join the cluster.",
},
},
},
"eks:index:AuthenticationMode": {
ObjectTypeSpec: schema.ObjectTypeSpec{
Type: "string",
Type: "string",
Description: "The authentication mode of the cluster. Valid values are `CONFIG_MAP`, `API` or `API_AND_CONFIG_MAP`.\n\n" +
"See for more details:\nhttps://docs.aws.amazon.com/eks/latest/userguide/grant-k8s-access.html#set-cam",
"See for more details:\nhttps://docs.aws.amazon.com/eks/latest/userguide/grant-k8s-access.html#set-cam",
},
Enum: []schema.EnumValueSpec{
{
Expand Down Expand Up @@ -1745,6 +1745,26 @@ func nodeGroupProperties(cluster, v2 bool) map[string]schema.PropertySpec {
TypeSpec: schema.TypeSpec{Type: "integer"},
Description: "The size in GiB of a cluster node's root volume. Defaults to 20.",
},
"nodeRootVolumeDeleteOnTermination": {
TypeSpec: schema.TypeSpec{Type: "boolean"},
Description: "Whether the root block device should be deleted on termination of the instance. Defaults to true.",
},
"nodeRootVolumeEncrypted": {
TypeSpec: schema.TypeSpec{Type: "boolean"},
Description: "Whether to encrypt a cluster node's root volume. Defaults to false.",
},
"nodeRootVolumeIops": {
TypeSpec: schema.TypeSpec{Type: "integer"},
Description: "The amount of provisioned IOPS. This is only valid with a volumeType of 'io1'.",
},
"nodeRootVolumeThroughput": {
TypeSpec: schema.TypeSpec{Type: "integer"},
Description: "Provisioned throughput performance in integer MiB/s for a cluster node's root volume. This is only valid with a volumeType of 'gp3'.",
},
"nodeRootVolumeType": {
TypeSpec: schema.TypeSpec{Type: "string"},
Description: "Configured EBS type for a cluster node's root volume. Default is 'gp2'. Supported values are 'standard', 'gp2', 'gp3', 'st1', 'sc1', 'io1'.",
},
"nodeUserData": {
TypeSpec: schema.TypeSpec{Type: "string"},
Description: "Extra code to run on node startup. This code will run after the AWS EKS " +
Expand Down
60 changes: 60 additions & 0 deletions provider/cmd/pulumi-resource-eks/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,30 @@
"type": "string",
"description": "Public key material for SSH access to worker nodes. See allowed formats at:\nhttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html\nIf not provided, no SSH access is enabled on VMs."
},
"nodeRootVolumeDeleteOnTermination": {
"type": "boolean",
"description": "Whether the root block device should be deleted on termination of the instance. Defaults to true."
},
"nodeRootVolumeEncrypted": {
"type": "boolean",
"description": "Whether to encrypt a cluster node's root volume. Defaults to false."
},
"nodeRootVolumeIops": {
"type": "integer",
"description": "The amount of provisioned IOPS. This is only valid with a volumeType of 'io1'."
},
"nodeRootVolumeSize": {
"type": "integer",
"description": "The size in GiB of a cluster node's root volume. Defaults to 20."
},
"nodeRootVolumeThroughput": {
"type": "integer",
"description": "Provisioned throughput performance in integer MiB/s for a cluster node's root volume. This is only valid with a volumeType of 'gp3'."
},
"nodeRootVolumeType": {
"type": "string",
"description": "Configured EBS type for a cluster node's root volume. Default is 'gp2'. Supported values are 'standard', 'gp2', 'gp3', 'st1', 'sc1', 'io1'."
},
"nodeSecurityGroup": {
"$ref": "/aws/v6.18.2/schema.json#/resources/aws:ec2%2FsecurityGroup:SecurityGroup",
"description": "The security group for the worker node group to communicate with the cluster.\n\nThis security group requires specific inbound and outbound rules.\n\nSee for more details:\nhttps://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html\n\nNote: The `nodeSecurityGroup` option and the cluster option`nodeSecurityGroupTags` are mutually exclusive."
Expand Down Expand Up @@ -1425,10 +1445,30 @@
"type": "string",
"description": "Public key material for SSH access to worker nodes. See allowed formats at:\nhttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html\nIf not provided, no SSH access is enabled on VMs."
},
"nodeRootVolumeDeleteOnTermination": {
"type": "boolean",
"description": "Whether the root block device should be deleted on termination of the instance. Defaults to true."
},
"nodeRootVolumeEncrypted": {
"type": "boolean",
"description": "Whether to encrypt a cluster node's root volume. Defaults to false."
},
"nodeRootVolumeIops": {
"type": "integer",
"description": "The amount of provisioned IOPS. This is only valid with a volumeType of 'io1'."
},
"nodeRootVolumeSize": {
"type": "integer",
"description": "The size in GiB of a cluster node's root volume. Defaults to 20."
},
"nodeRootVolumeThroughput": {
"type": "integer",
"description": "Provisioned throughput performance in integer MiB/s for a cluster node's root volume. This is only valid with a volumeType of 'gp3'."
},
"nodeRootVolumeType": {
"type": "string",
"description": "Configured EBS type for a cluster node's root volume. Default is 'gp2'. Supported values are 'standard', 'gp2', 'gp3', 'st1', 'sc1', 'io1'."
},
"nodeSecurityGroup": {
"$ref": "/aws/v6.18.2/schema.json#/resources/aws:ec2%2FsecurityGroup:SecurityGroup",
"description": "The security group for the worker node group to communicate with the cluster.\n\nThis security group requires specific inbound and outbound rules.\n\nSee for more details:\nhttps://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html\n\nNote: The `nodeSecurityGroup` option and the cluster option`nodeSecurityGroupTags` are mutually exclusive."
Expand Down Expand Up @@ -1660,10 +1700,30 @@
"type": "string",
"description": "Public key material for SSH access to worker nodes. See allowed formats at:\nhttps://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html\nIf not provided, no SSH access is enabled on VMs."
},
"nodeRootVolumeDeleteOnTermination": {
"type": "boolean",
"description": "Whether the root block device should be deleted on termination of the instance. Defaults to true."
},
"nodeRootVolumeEncrypted": {
"type": "boolean",
"description": "Whether to encrypt a cluster node's root volume. Defaults to false."
},
"nodeRootVolumeIops": {
"type": "integer",
"description": "The amount of provisioned IOPS. This is only valid with a volumeType of 'io1'."
},
"nodeRootVolumeSize": {
"type": "integer",
"description": "The size in GiB of a cluster node's root volume. Defaults to 20."
},
"nodeRootVolumeThroughput": {
"type": "integer",
"description": "Provisioned throughput performance in integer MiB/s for a cluster node's root volume. This is only valid with a volumeType of 'gp3'."
},
"nodeRootVolumeType": {
"type": "string",
"description": "Configured EBS type for a cluster node's root volume. Default is 'gp2'. Supported values are 'standard', 'gp2', 'gp3', 'st1', 'sc1', 'io1'."
},
"nodeSecurityGroup": {
"$ref": "/aws/v6.18.2/schema.json#/resources/aws:ec2%2FsecurityGroup:SecurityGroup",
"description": "The security group for the worker node group to communicate with the cluster.\n\nThis security group requires specific inbound and outbound rules.\n\nSee for more details:\nhttps://docs.aws.amazon.com/eks/latest/userguide/sec-group-reqs.html\n\nNote: The `nodeSecurityGroup` option and the cluster option`nodeSecurityGroupTags` are mutually exclusive."
Expand Down
30 changes: 30 additions & 0 deletions sdk/dotnet/Inputs/ClusterNodeGroupOptionsArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,42 @@ public Dictionary<string, string> Labels
[Input("nodePublicKey")]
public Input<string>? NodePublicKey { get; set; }

/// <summary>
/// Whether the root block device should be deleted on termination of the instance. Defaults to true.
/// </summary>
[Input("nodeRootVolumeDeleteOnTermination")]
public Input<bool>? NodeRootVolumeDeleteOnTermination { get; set; }

/// <summary>
/// Whether to encrypt a cluster node's root volume. Defaults to false.
/// </summary>
[Input("nodeRootVolumeEncrypted")]
public Input<bool>? NodeRootVolumeEncrypted { get; set; }

/// <summary>
/// The amount of provisioned IOPS. This is only valid with a volumeType of 'io1'.
/// </summary>
[Input("nodeRootVolumeIops")]
public Input<int>? NodeRootVolumeIops { get; set; }

/// <summary>
/// The size in GiB of a cluster node's root volume. Defaults to 20.
/// </summary>
[Input("nodeRootVolumeSize")]
public Input<int>? NodeRootVolumeSize { get; set; }

/// <summary>
/// Provisioned throughput performance in integer MiB/s for a cluster node's root volume. This is only valid with a volumeType of 'gp3'.
/// </summary>
[Input("nodeRootVolumeThroughput")]
public Input<int>? NodeRootVolumeThroughput { get; set; }

/// <summary>
/// Configured EBS type for a cluster node's root volume. Default is 'gp2'. Supported values are 'standard', 'gp2', 'gp3', 'st1', 'sc1', 'io1'.
/// </summary>
[Input("nodeRootVolumeType")]
public Input<string>? NodeRootVolumeType { get; set; }

/// <summary>
/// The security group for the worker node group to communicate with the cluster.
///
Expand Down
30 changes: 30 additions & 0 deletions sdk/dotnet/NodeGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,42 @@ public Dictionary<string, string> Labels
[Input("nodePublicKey")]
public Input<string>? NodePublicKey { get; set; }

/// <summary>
/// Whether the root block device should be deleted on termination of the instance. Defaults to true.
/// </summary>
[Input("nodeRootVolumeDeleteOnTermination")]
public Input<bool>? NodeRootVolumeDeleteOnTermination { get; set; }

/// <summary>
/// Whether to encrypt a cluster node's root volume. Defaults to false.
/// </summary>
[Input("nodeRootVolumeEncrypted")]
public Input<bool>? NodeRootVolumeEncrypted { get; set; }

/// <summary>
/// The amount of provisioned IOPS. This is only valid with a volumeType of 'io1'.
/// </summary>
[Input("nodeRootVolumeIops")]
public Input<int>? NodeRootVolumeIops { get; set; }

/// <summary>
/// The size in GiB of a cluster node's root volume. Defaults to 20.
/// </summary>
[Input("nodeRootVolumeSize")]
public Input<int>? NodeRootVolumeSize { get; set; }

/// <summary>
/// Provisioned throughput performance in integer MiB/s for a cluster node's root volume. This is only valid with a volumeType of 'gp3'.
/// </summary>
[Input("nodeRootVolumeThroughput")]
public Input<int>? NodeRootVolumeThroughput { get; set; }

/// <summary>
/// Configured EBS type for a cluster node's root volume. Default is 'gp2'. Supported values are 'standard', 'gp2', 'gp3', 'st1', 'sc1', 'io1'.
/// </summary>
[Input("nodeRootVolumeType")]
public Input<string>? NodeRootVolumeType { get; set; }

/// <summary>
/// The security group for the worker node group to communicate with the cluster.
///
Expand Down
30 changes: 30 additions & 0 deletions sdk/dotnet/NodeGroupV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,42 @@ public InputList<Pulumi.Aws.Ec2.Inputs.LaunchTemplateTagSpecificationArgs> Launc
[Input("nodePublicKey")]
public Input<string>? NodePublicKey { get; set; }

/// <summary>
/// Whether the root block device should be deleted on termination of the instance. Defaults to true.
/// </summary>
[Input("nodeRootVolumeDeleteOnTermination")]
public Input<bool>? NodeRootVolumeDeleteOnTermination { get; set; }

/// <summary>
/// Whether to encrypt a cluster node's root volume. Defaults to false.
/// </summary>
[Input("nodeRootVolumeEncrypted")]
public Input<bool>? NodeRootVolumeEncrypted { get; set; }

/// <summary>
/// The amount of provisioned IOPS. This is only valid with a volumeType of 'io1'.
/// </summary>
[Input("nodeRootVolumeIops")]
public Input<int>? NodeRootVolumeIops { get; set; }

/// <summary>
/// The size in GiB of a cluster node's root volume. Defaults to 20.
/// </summary>
[Input("nodeRootVolumeSize")]
public Input<int>? NodeRootVolumeSize { get; set; }

/// <summary>
/// Provisioned throughput performance in integer MiB/s for a cluster node's root volume. This is only valid with a volumeType of 'gp3'.
/// </summary>
[Input("nodeRootVolumeThroughput")]
public Input<int>? NodeRootVolumeThroughput { get; set; }

/// <summary>
/// Configured EBS type for a cluster node's root volume. Default is 'gp2'. Supported values are 'standard', 'gp2', 'gp3', 'st1', 'sc1', 'io1'.
/// </summary>
[Input("nodeRootVolumeType")]
public Input<string>? NodeRootVolumeType { get; set; }

/// <summary>
/// The security group for the worker node group to communicate with the cluster.
///
Expand Down
35 changes: 35 additions & 0 deletions sdk/dotnet/Outputs/ClusterNodeGroupOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,30 @@ public sealed class ClusterNodeGroupOptions
/// </summary>
public readonly string? NodePublicKey;
/// <summary>
/// Whether the root block device should be deleted on termination of the instance. Defaults to true.
/// </summary>
public readonly bool? NodeRootVolumeDeleteOnTermination;
/// <summary>
/// Whether to encrypt a cluster node's root volume. Defaults to false.
/// </summary>
public readonly bool? NodeRootVolumeEncrypted;
/// <summary>
/// The amount of provisioned IOPS. This is only valid with a volumeType of 'io1'.
/// </summary>
public readonly int? NodeRootVolumeIops;
/// <summary>
/// The size in GiB of a cluster node's root volume. Defaults to 20.
/// </summary>
public readonly int? NodeRootVolumeSize;
/// <summary>
/// Provisioned throughput performance in integer MiB/s for a cluster node's root volume. This is only valid with a volumeType of 'gp3'.
/// </summary>
public readonly int? NodeRootVolumeThroughput;
/// <summary>
/// Configured EBS type for a cluster node's root volume. Default is 'gp2'. Supported values are 'standard', 'gp2', 'gp3', 'st1', 'sc1', 'io1'.
/// </summary>
public readonly string? NodeRootVolumeType;
/// <summary>
/// The security group for the worker node group to communicate with the cluster.
///
/// This security group requires specific inbound and outbound rules.
Expand Down Expand Up @@ -217,8 +237,18 @@ private ClusterNodeGroupOptions(

string? nodePublicKey,

bool? nodeRootVolumeDeleteOnTermination,

bool? nodeRootVolumeEncrypted,

int? nodeRootVolumeIops,

int? nodeRootVolumeSize,

int? nodeRootVolumeThroughput,

string? nodeRootVolumeType,

Pulumi.Aws.Ec2.SecurityGroup? nodeSecurityGroup,

ImmutableArray<string> nodeSubnetIds,
Expand Down Expand Up @@ -253,7 +283,12 @@ private ClusterNodeGroupOptions(
MinSize = minSize;
NodeAssociatePublicIpAddress = nodeAssociatePublicIpAddress;
NodePublicKey = nodePublicKey;
NodeRootVolumeDeleteOnTermination = nodeRootVolumeDeleteOnTermination;
NodeRootVolumeEncrypted = nodeRootVolumeEncrypted;
NodeRootVolumeIops = nodeRootVolumeIops;
NodeRootVolumeSize = nodeRootVolumeSize;
NodeRootVolumeThroughput = nodeRootVolumeThroughput;
NodeRootVolumeType = nodeRootVolumeType;
NodeSecurityGroup = nodeSecurityGroup;
NodeSubnetIds = nodeSubnetIds;
NodeUserData = nodeUserData;
Expand Down
Loading

0 comments on commit 0404693

Please sign in to comment.