Skip to content

Commit

Permalink
Expose Ip-Family for IPV6 (#1089)
Browse files Browse the repository at this point in the history
Fixes #698
Based on #888 and rebased onto
master

---------

Co-authored-by: Mikhail Shilkov <[email protected]>
Co-authored-by: Kyle Pitzen <[email protected]>
Co-authored-by: Ramon Quitales <[email protected]>
  • Loading branch information
4 people authored Mar 26, 2024
1 parent fc90daf commit 70ac41a
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 29 deletions.
20 changes: 15 additions & 5 deletions nodejs/eks/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,11 +562,14 @@ export function createCore(
let kubernetesNetworkConfig:
| pulumi.Output<aws.types.input.eks.ClusterKubernetesNetworkConfig>
| undefined;
if (args.kubernetesServiceIpAddressRange) {
kubernetesNetworkConfig = pulumi
.output(args.kubernetesServiceIpAddressRange)
.apply((serviceIpv4Cidr) => ({ serviceIpv4Cidr }));
}
if (args.kubernetesServiceIpAddressRange || args.ipFamily ) {
kubernetesNetworkConfig = pulumi.all([args.kubernetesServiceIpAddressRange, args.ipFamily]).apply(
([serviceIpv4Cidr, ipFamily = "ipv4"]) => ({
serviceIpv4Cidr: ipFamily === "ipv4" ? serviceIpv4Cidr : undefined, // only applicable for IPv4 IP family
ipFamily: ipFamily
}),
);
}

// Create the EKS cluster
const eksCluster = new aws.eks.Cluster(
Expand Down Expand Up @@ -1530,6 +1533,13 @@ export interface ClusterOptions {
* - Between /24 and /12.
*/
kubernetesServiceIpAddressRange?: pulumi.Input<string>;

/**
* The IP family used to assign Kubernetes pod and service addresses. Valid values are ipv4 (default) and ipv6.
* You can only specify an IP family when you create a cluster, changing this value will force
* a new cluster to be created.
*/
ipFamily?: pulumi.Input<string>;
}

/**
Expand Down
1 change: 0 additions & 1 deletion nodejs/eks/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3970,7 +3970,6 @@ readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0:
version "3.6.2"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967"
integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==
dependencies:
inherits "^2.0.3"
string_decoder "^1.1.1"
util-deprecate "^1.0.1"
Expand Down
10 changes: 8 additions & 2 deletions provider/cmd/pulumi-gen-eks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,12 +591,18 @@ func generateSchema() schema.PackageSpec {
"See for more details:\n" +
"- https://aws.amazon.com/about-aws/whats-new/2020/03/amazon-eks-adds-envelope-encryption-for-secrets-with-aws-kms/",
},
"ipFamily": {
TypeSpec: schema.TypeSpec{Type: "string"},
Description: "The IP family used to assign Kubernetes pod and service addresses. Valid values are `ipv4` (default) and `ipv6`.\n" +
"You can only specify an IP family when you create a cluster, changing this value will force a new cluster to be created.",
ReplaceOnChanges: true,
},
"kubernetesServiceIpAddressRange": {
TypeSpec: schema.TypeSpec{Type: "string"},
Description: "The CIDR block to assign Kubernetes service IP addresses from. If you don't\n" +
"specify a block, Kubernetes assigns addresses from either the 10.100.0.0/16 or\n" +
"172.20.0.0/16 CIDR blocks. We recommend that you specify a block that does not overlap\n" +
"with resources in other networks that are peered or connected to your VPC. You can only specify\n" +
"172.20.0.0/16 CIDR blocks. This setting only applies to IPv4 clusters. We recommend that you specify a block\n" +
"that does not overlap with resources in other networks that are peered or connected to your VPC. You can only specify\n" +
"a custom CIDR block when you create a cluster, changing this value will force a new cluster to be created.\n\n" +
"The block must meet the following requirements:\n" +
"- Within one of the following private IP address blocks: 10.0.0.0/8, 172.16.0.0.0/12, or 192.168.0.0/16.\n" +
Expand Down
7 changes: 6 additions & 1 deletion provider/cmd/pulumi-resource-eks/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -749,9 +749,14 @@
"type": "string",
"description": "The instance type to use for the cluster's nodes. Defaults to \"t2.medium\"."
},
"ipFamily": {
"type": "string",
"description": "The IP family used to assign Kubernetes pod and service addresses. Valid values are `ipv4` (default) and `ipv6`.\nYou can only specify an IP family when you create a cluster, changing this value will force a new cluster to be created.",
"replaceOnChanges": true
},
"kubernetesServiceIpAddressRange": {
"type": "string",
"description": "The CIDR block to assign Kubernetes service IP addresses from. If you don't\nspecify a block, Kubernetes assigns addresses from either the 10.100.0.0/16 or\n172.20.0.0/16 CIDR blocks. We recommend that you specify a block that does not overlap\nwith resources in other networks that are peered or connected to your VPC. You can only specify\na custom CIDR block when you create a cluster, changing this value will force a new cluster to be created.\n\nThe block must meet the following requirements:\n- Within one of the following private IP address blocks: 10.0.0.0/8, 172.16.0.0.0/12, or 192.168.0.0/16.\n- Doesn't overlap with any CIDR block assigned to the VPC that you selected for VPC.\n- Between /24 and /12."
"description": "The CIDR block to assign Kubernetes service IP addresses from. If you don't\nspecify a block, Kubernetes assigns addresses from either the 10.100.0.0/16 or\n172.20.0.0/16 CIDR blocks. This setting only applies to IPv4 clusters. We recommend that you specify a block\nthat does not overlap with resources in other networks that are peered or connected to your VPC. You can only specify\na custom CIDR block when you create a cluster, changing this value will force a new cluster to be created.\n\nThe block must meet the following requirements:\n- Within one of the following private IP address blocks: 10.0.0.0/8, 172.16.0.0.0/12, or 192.168.0.0/16.\n- Doesn't overlap with any CIDR block assigned to the VPC that you selected for VPC.\n- Between /24 and /12."
},
"maxSize": {
"type": "integer",
Expand Down
11 changes: 9 additions & 2 deletions sdk/dotnet/Cluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,18 @@ public InputList<Pulumi.Aws.Iam.Role> InstanceRoles
[Input("instanceType")]
public Input<string>? InstanceType { get; set; }

/// <summary>
/// The IP family used to assign Kubernetes pod and service addresses. Valid values are `ipv4` (default) and `ipv6`.
/// You can only specify an IP family when you create a cluster, changing this value will force a new cluster to be created.
/// </summary>
[Input("ipFamily")]
public Input<string>? IpFamily { get; set; }

/// <summary>
/// The CIDR block to assign Kubernetes service IP addresses from. If you don't
/// specify a block, Kubernetes assigns addresses from either the 10.100.0.0/16 or
/// 172.20.0.0/16 CIDR blocks. We recommend that you specify a block that does not overlap
/// with resources in other networks that are peered or connected to your VPC. You can only specify
/// 172.20.0.0/16 CIDR blocks. This setting only applies to IPv4 clusters. We recommend that you specify a block
/// that does not overlap with resources in other networks that are peered or connected to your VPC. You can only specify
/// a custom CIDR block when you create a cluster, changing this value will force a new cluster to be created.
///
/// The block must meet the following requirements:
Expand Down
14 changes: 10 additions & 4 deletions sdk/go/eks/cluster.go

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

57 changes: 49 additions & 8 deletions sdk/java/src/main/java/com/pulumi/eks/ClusterArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,28 @@ public Optional<Output<String>> instanceType() {
return Optional.ofNullable(this.instanceType);
}

/**
* The IP family used to assign Kubernetes pod and service addresses. Valid values are `ipv4` (default) and `ipv6`.
* You can only specify an IP family when you create a cluster, changing this value will force a new cluster to be created.
*
*/
@Import(name="ipFamily")
private @Nullable Output<String> ipFamily;

/**
* @return The IP family used to assign Kubernetes pod and service addresses. Valid values are `ipv4` (default) and `ipv6`.
* You can only specify an IP family when you create a cluster, changing this value will force a new cluster to be created.
*
*/
public Optional<Output<String>> ipFamily() {
return Optional.ofNullable(this.ipFamily);
}

/**
* The CIDR block to assign Kubernetes service IP addresses from. If you don&#39;t
* specify a block, Kubernetes assigns addresses from either the 10.100.0.0/16 or
* 172.20.0.0/16 CIDR blocks. We recommend that you specify a block that does not overlap
* with resources in other networks that are peered or connected to your VPC. You can only specify
* 172.20.0.0/16 CIDR blocks. This setting only applies to IPv4 clusters. We recommend that you specify a block
* that does not overlap with resources in other networks that are peered or connected to your VPC. You can only specify
* a custom CIDR block when you create a cluster, changing this value will force a new cluster to be created.
*
* The block must meet the following requirements:
Expand All @@ -352,8 +369,8 @@ public Optional<Output<String>> instanceType() {
/**
* @return The CIDR block to assign Kubernetes service IP addresses from. If you don&#39;t
* specify a block, Kubernetes assigns addresses from either the 10.100.0.0/16 or
* 172.20.0.0/16 CIDR blocks. We recommend that you specify a block that does not overlap
* with resources in other networks that are peered or connected to your VPC. You can only specify
* 172.20.0.0/16 CIDR blocks. This setting only applies to IPv4 clusters. We recommend that you specify a block
* that does not overlap with resources in other networks that are peered or connected to your VPC. You can only specify
* a custom CIDR block when you create a cluster, changing this value will force a new cluster to be created.
*
* The block must meet the following requirements:
Expand Down Expand Up @@ -960,6 +977,7 @@ private ClusterArgs(ClusterArgs $) {
this.instanceRole = $.instanceRole;
this.instanceRoles = $.instanceRoles;
this.instanceType = $.instanceType;
this.ipFamily = $.ipFamily;
this.kubernetesServiceIpAddressRange = $.kubernetesServiceIpAddressRange;
this.maxSize = $.maxSize;
this.minSize = $.minSize;
Expand Down Expand Up @@ -1456,11 +1474,34 @@ public Builder instanceType(String instanceType) {
return instanceType(Output.of(instanceType));
}

/**
* @param ipFamily The IP family used to assign Kubernetes pod and service addresses. Valid values are `ipv4` (default) and `ipv6`.
* You can only specify an IP family when you create a cluster, changing this value will force a new cluster to be created.
*
* @return builder
*
*/
public Builder ipFamily(@Nullable Output<String> ipFamily) {
$.ipFamily = ipFamily;
return this;
}

/**
* @param ipFamily The IP family used to assign Kubernetes pod and service addresses. Valid values are `ipv4` (default) and `ipv6`.
* You can only specify an IP family when you create a cluster, changing this value will force a new cluster to be created.
*
* @return builder
*
*/
public Builder ipFamily(String ipFamily) {
return ipFamily(Output.of(ipFamily));
}

/**
* @param kubernetesServiceIpAddressRange The CIDR block to assign Kubernetes service IP addresses from. If you don&#39;t
* specify a block, Kubernetes assigns addresses from either the 10.100.0.0/16 or
* 172.20.0.0/16 CIDR blocks. We recommend that you specify a block that does not overlap
* with resources in other networks that are peered or connected to your VPC. You can only specify
* 172.20.0.0/16 CIDR blocks. This setting only applies to IPv4 clusters. We recommend that you specify a block
* that does not overlap with resources in other networks that are peered or connected to your VPC. You can only specify
* a custom CIDR block when you create a cluster, changing this value will force a new cluster to be created.
*
* The block must meet the following requirements:
Expand All @@ -1479,8 +1520,8 @@ public Builder kubernetesServiceIpAddressRange(@Nullable Output<String> kubernet
/**
* @param kubernetesServiceIpAddressRange The CIDR block to assign Kubernetes service IP addresses from. If you don&#39;t
* specify a block, Kubernetes assigns addresses from either the 10.100.0.0/16 or
* 172.20.0.0/16 CIDR blocks. We recommend that you specify a block that does not overlap
* with resources in other networks that are peered or connected to your VPC. You can only specify
* 172.20.0.0/16 CIDR blocks. This setting only applies to IPv4 clusters. We recommend that you specify a block
* that does not overlap with resources in other networks that are peered or connected to your VPC. You can only specify
* a custom CIDR block when you create a cluster, changing this value will force a new cluster to be created.
*
* The block must meet the following requirements:
Expand Down
Loading

0 comments on commit 70ac41a

Please sign in to comment.