Skip to content

Commit

Permalink
Fix output of default node group referring to autoscalingGroupName (#…
Browse files Browse the repository at this point in the history
…1410)

In #1373 the default node group
was updated to use the `NodeGroupV2` component. We missed changing the
`NodeGroupData` type to reflect this. It was still referring to a
property called `autoScalingGroupName`, but it should've been changed to
expose an `autoScalingGroup`.

Fixes #1402
  • Loading branch information
flostadler authored Oct 1, 2024
1 parent 120f84d commit dfd76f2
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 46 deletions.
2 changes: 2 additions & 0 deletions examples/cluster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const cluster1 = new eks.Cluster(`${projectName}-1`, {
nodeAmiId: "ami-066e69f6f03b5383e",
});

export const defaultAsgArn: pulumi.Output<string> = cluster1.defaultNodeGroup.apply(ng => ng?.autoScalingGroup.arn ?? pulumi.output(""));

const cluster2 = new eks.Cluster(`${projectName}-2`, {
vpcId: vpc.vpcId,
publicSubnetIds: vpc.publicSubnetIds,
Expand Down
2 changes: 2 additions & 0 deletions examples/examples_nodejs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ func TestAccCluster(t *testing.T) {
info.Outputs["kubeconfig4"],
)

assert.NotEmpty(t, info.Outputs["defaultAsgArn"], "should have a default ASG")

// let's test there's a iamRoleArn specified for the cluster
assert.NotEmpty(t, info.Outputs["iamRoleArn"])

Expand Down
8 changes: 4 additions & 4 deletions provider/cmd/pulumi-gen-eks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1393,15 +1393,15 @@ func generateSchema(version semver.Version) schema.PackageSpec {
},
Description: "The additional security groups for the node group that captures user-specific rules.",
},
"autoScalingGroupName": {
TypeSpec: schema.TypeSpec{Type: "string"},
Description: "The AutoScalingGroup name for the node group.",
"autoScalingGroup": {
TypeSpec: schema.TypeSpec{Ref: awsRef("#/resources/aws:autoscaling%2Fgroup:Group")},
Description: "The AutoScalingGroup for the node group.",
},
},
Required: []string{
"nodeSecurityGroup",
"extraNodeSecurityGroups",
"autoScalingGroupName",
"autoScalingGroup",
},
},
},
Expand Down
8 changes: 4 additions & 4 deletions provider/cmd/pulumi-resource-eks/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -677,9 +677,9 @@
"eks:index:NodeGroupData": {
"description": "NodeGroupData describes the resources created for the given NodeGroup.",
"properties": {
"autoScalingGroupName": {
"type": "string",
"description": "The AutoScalingGroup name for the node group."
"autoScalingGroup": {
"$ref": "/aws/v6.18.2/schema.json#/resources/aws:autoscaling%2Fgroup:Group",
"description": "The AutoScalingGroup for the node group."
},
"extraNodeSecurityGroups": {
"type": "array",
Expand All @@ -697,7 +697,7 @@
"required": [
"nodeSecurityGroup",
"extraNodeSecurityGroups",
"autoScalingGroupName"
"autoScalingGroup"
]
},
"eks:index:NodeadmOptions": {
Expand Down
8 changes: 4 additions & 4 deletions sdk/dotnet/Outputs/NodeGroupData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ namespace Pulumi.Eks.Outputs
public sealed class NodeGroupData
{
/// <summary>
/// The AutoScalingGroup name for the node group.
/// The AutoScalingGroup for the node group.
/// </summary>
public readonly string AutoScalingGroupName;
public readonly Pulumi.Aws.AutoScaling.Group AutoScalingGroup;
/// <summary>
/// The additional security groups for the node group that captures user-specific rules.
/// </summary>
Expand All @@ -31,13 +31,13 @@ public sealed class NodeGroupData

[OutputConstructor]
private NodeGroupData(
string autoScalingGroupName,
Pulumi.Aws.AutoScaling.Group autoScalingGroup,

ImmutableArray<Pulumi.Aws.Ec2.SecurityGroup> extraNodeSecurityGroups,

Pulumi.Aws.Ec2.SecurityGroup nodeSecurityGroup)
{
AutoScalingGroupName = autoScalingGroupName;
AutoScalingGroup = autoScalingGroup;
ExtraNodeSecurityGroups = extraNodeSecurityGroups;
NodeSecurityGroup = nodeSecurityGroup;
}
Expand Down
21 changes: 11 additions & 10 deletions sdk/go/eks/pulumiTypes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions sdk/java/src/main/java/com/pulumi/eks/outputs/NodeGroupData.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@

package com.pulumi.eks.outputs;

import com.pulumi.aws.autoscaling.Group;
import com.pulumi.aws.ec2.SecurityGroup;
import com.pulumi.core.annotations.CustomType;
import com.pulumi.exceptions.MissingRequiredPropertyException;
import java.lang.String;
import java.util.List;
import java.util.Objects;

@CustomType
public final class NodeGroupData {
/**
* @return The AutoScalingGroup name for the node group.
* @return The AutoScalingGroup for the node group.
*
*/
private String autoScalingGroupName;
private Group autoScalingGroup;
/**
* @return The additional security groups for the node group that captures user-specific rules.
*
Expand All @@ -30,11 +30,11 @@ public final class NodeGroupData {

private NodeGroupData() {}
/**
* @return The AutoScalingGroup name for the node group.
* @return The AutoScalingGroup for the node group.
*
*/
public String autoScalingGroupName() {
return this.autoScalingGroupName;
public Group autoScalingGroup() {
return this.autoScalingGroup;
}
/**
* @return The additional security groups for the node group that captures user-specific rules.
Expand All @@ -60,23 +60,23 @@ public static Builder builder(NodeGroupData defaults) {
}
@CustomType.Builder
public static final class Builder {
private String autoScalingGroupName;
private Group autoScalingGroup;
private List<SecurityGroup> extraNodeSecurityGroups;
private SecurityGroup nodeSecurityGroup;
public Builder() {}
public Builder(NodeGroupData defaults) {
Objects.requireNonNull(defaults);
this.autoScalingGroupName = defaults.autoScalingGroupName;
this.autoScalingGroup = defaults.autoScalingGroup;
this.extraNodeSecurityGroups = defaults.extraNodeSecurityGroups;
this.nodeSecurityGroup = defaults.nodeSecurityGroup;
}

@CustomType.Setter
public Builder autoScalingGroupName(String autoScalingGroupName) {
if (autoScalingGroupName == null) {
throw new MissingRequiredPropertyException("NodeGroupData", "autoScalingGroupName");
public Builder autoScalingGroup(Group autoScalingGroup) {
if (autoScalingGroup == null) {
throw new MissingRequiredPropertyException("NodeGroupData", "autoScalingGroup");
}
this.autoScalingGroupName = autoScalingGroupName;
this.autoScalingGroup = autoScalingGroup;
return this;
}
@CustomType.Setter
Expand All @@ -100,7 +100,7 @@ public Builder nodeSecurityGroup(SecurityGroup nodeSecurityGroup) {
}
public NodeGroupData build() {
final var _resultValue = new NodeGroupData();
_resultValue.autoScalingGroupName = autoScalingGroupName;
_resultValue.autoScalingGroup = autoScalingGroup;
_resultValue.extraNodeSecurityGroups = extraNodeSecurityGroups;
_resultValue.nodeSecurityGroup = nodeSecurityGroup;
return _resultValue;
Expand Down
4 changes: 2 additions & 2 deletions sdk/nodejs/types/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,9 @@ export interface CoreData {
*/
export interface NodeGroupData {
/**
* The AutoScalingGroup name for the node group.
* The AutoScalingGroup for the node group.
*/
autoScalingGroupName: string;
autoScalingGroup: pulumiAws.autoscaling.Group;
/**
* The additional security groups for the node group that captures user-specific rules.
*/
Expand Down
18 changes: 9 additions & 9 deletions sdk/python/pulumi_eks/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1192,8 +1192,8 @@ class NodeGroupData(dict):
@staticmethod
def __key_warning(key: str):
suggest = None
if key == "autoScalingGroupName":
suggest = "auto_scaling_group_name"
if key == "autoScalingGroup":
suggest = "auto_scaling_group"
elif key == "extraNodeSecurityGroups":
suggest = "extra_node_security_groups"
elif key == "nodeSecurityGroup":
Expand All @@ -1211,26 +1211,26 @@ def get(self, key: str, default = None) -> Any:
return super().get(key, default)

def __init__(__self__, *,
auto_scaling_group_name: str,
auto_scaling_group: 'pulumi_aws.autoscaling.Group',
extra_node_security_groups: Sequence['pulumi_aws.ec2.SecurityGroup'],
node_security_group: 'pulumi_aws.ec2.SecurityGroup'):
"""
NodeGroupData describes the resources created for the given NodeGroup.
:param str auto_scaling_group_name: The AutoScalingGroup name for the node group.
:param 'pulumi_aws.autoscaling.Group' auto_scaling_group: The AutoScalingGroup for the node group.
:param Sequence['pulumi_aws.ec2.SecurityGroup'] extra_node_security_groups: The additional security groups for the node group that captures user-specific rules.
:param 'pulumi_aws.ec2.SecurityGroup' node_security_group: The security group for the node group to communicate with the cluster.
"""
pulumi.set(__self__, "auto_scaling_group_name", auto_scaling_group_name)
pulumi.set(__self__, "auto_scaling_group", auto_scaling_group)
pulumi.set(__self__, "extra_node_security_groups", extra_node_security_groups)
pulumi.set(__self__, "node_security_group", node_security_group)

@property
@pulumi.getter(name="autoScalingGroupName")
def auto_scaling_group_name(self) -> str:
@pulumi.getter(name="autoScalingGroup")
def auto_scaling_group(self) -> 'pulumi_aws.autoscaling.Group':
"""
The AutoScalingGroup name for the node group.
The AutoScalingGroup for the node group.
"""
return pulumi.get(self, "auto_scaling_group_name")
return pulumi.get(self, "auto_scaling_group")

@property
@pulumi.getter(name="extraNodeSecurityGroups")
Expand Down

0 comments on commit dfd76f2

Please sign in to comment.