Skip to content

Commit

Permalink
allow setting karpenter disk size
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxxstorm committed Feb 18, 2024
1 parent 2608e22 commit 7e5c7e5
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 0 deletions.
11 changes: 11 additions & 0 deletions provider/pkg/provider/autoscaledNodegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
type AutoscaledNodeGroupArgs struct {
Annotations *pulumi.StringMapInput `pulumi:"annotations"`
AMIFamily *pulumi.StringInput `pulumi:"amiFamily"`
DiskSize pulumi.StringInput `pulumi:"diskSize"`
Taints pulumi.ArrayInput `pulumi:"taints"`
NodeRole pulumi.StringInput `pulumi:"nodeRole"`
SubnetIds pulumi.StringArrayInput `pulumi:"subnetIds"`
Expand Down Expand Up @@ -93,6 +94,16 @@ func NewAutoscaledNodeGroup(ctx *pulumi.Context,
"role": args.NodeRole,
"subnetSelectorTerms": subnetSelectorTermsProcessed,
"securityGroupSelectorTerms": securityGroupSelectorTermsProcessed,
"blockDeviceMappings": []map[string]interface{}{
{
"deviceName": "/dev/xvda",
"ebs": map[string]interface{}{
"encrypted": pulumi.Bool(true),
"volumeSize": args.DiskSize,
"volumeType": pulumi.String("gp3"),
},
},
},
},
},
}, pulumi.Parent(component))
Expand Down
5 changes: 5 additions & 0 deletions schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ resources:
nodeRole:
type: string
description: "Node role for the node group."
diskSize:
type: string
description: "Disk size for the node group."
default: "20Gi"
subnetIds:
type: array
items:
Expand All @@ -343,6 +347,7 @@ resources:
description: "Optional node taints."
requiredInputs:
- nodeRole
- diskSize
- subnetIds
- securityGroupIds
- requirements
Expand Down
7 changes: 7 additions & 0 deletions sdk/dotnet/Eks/AutoscaledNodeGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ public InputMap<string> Annotations
set => _annotations = value;
}

/// <summary>
/// Disk size for the node group.
/// </summary>
[Input("diskSize", required: true)]
public Input<string> DiskSize { get; set; } = null!;

/// <summary>
/// Node role for the node group.
/// </summary>
Expand Down Expand Up @@ -115,6 +121,7 @@ public InputList<Pulumi.Kubernetes.Types.Inputs.Core.V1.TaintArgs> Taints

public AutoscaledNodeGroupArgs()
{
DiskSize = "20Gi";
}
public static new AutoscaledNodeGroupArgs Empty => new AutoscaledNodeGroupArgs();
}
Expand Down
7 changes: 7 additions & 0 deletions sdk/go/eks/autoscaledNodeGroup.go

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

7 changes: 7 additions & 0 deletions sdk/go/eks/x/autoscaledNodeGroup.go

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

8 changes: 8 additions & 0 deletions sdk/nodejs/autoscaledNodeGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export class AutoscaledNodeGroup extends pulumi.ComponentResource {
let resourceInputs: pulumi.Inputs = {};
opts = opts || {};
if (!opts.id) {
if ((!args || args.diskSize === undefined) && !opts.urn) {
throw new Error("Missing required property 'diskSize'");
}
if ((!args || args.nodeRole === undefined) && !opts.urn) {
throw new Error("Missing required property 'nodeRole'");
}
Expand All @@ -49,6 +52,7 @@ export class AutoscaledNodeGroup extends pulumi.ComponentResource {
}
resourceInputs["amiFamily"] = args ? args.amiFamily : undefined;
resourceInputs["annotations"] = args ? args.annotations : undefined;
resourceInputs["diskSize"] = (args ? args.diskSize : undefined) ?? "20Gi";
resourceInputs["nodeRole"] = args ? args.nodeRole : undefined;
resourceInputs["requirements"] = args ? args.requirements : undefined;
resourceInputs["securityGroupIds"] = args ? args.securityGroupIds : undefined;
Expand All @@ -73,6 +77,10 @@ export interface AutoscaledNodeGroupArgs {
* Annotations to apply to the node group.
*/
annotations?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* Disk size for the node group.
*/
diskSize: pulumi.Input<string>;
/**
* Node role for the node group.
*/
Expand Down
25 changes: 25 additions & 0 deletions sdk/python/lbrlabs_pulumi_eks/autoscaled_node_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
@pulumi.input_type
class AutoscaledNodeGroupArgs:
def __init__(__self__, *,
disk_size: Optional[pulumi.Input[str]] = None,
node_role: pulumi.Input[str],
requirements: pulumi.Input[Sequence[pulumi.Input['RequirementArgs']]],
security_group_ids: pulumi.Input[Sequence[pulumi.Input[str]]],
Expand All @@ -25,6 +26,7 @@ def __init__(__self__, *,
taints: Optional[pulumi.Input[Sequence[pulumi.Input['pulumi_kubernetes.core.v1.TaintArgs']]]] = None):
"""
The set of arguments for constructing a AutoscaledNodeGroup resource.
:param pulumi.Input[str] disk_size: Disk size for the node group.
:param pulumi.Input[str] node_role: Node role for the node group.
:param pulumi.Input[Sequence[pulumi.Input['RequirementArgs']]] requirements: List of requirements for the node group.
:param pulumi.Input[Sequence[pulumi.Input[str]]] security_group_ids: List of security group selector terms for the node group.
Expand All @@ -33,6 +35,9 @@ def __init__(__self__, *,
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] annotations: Annotations to apply to the node group.
:param pulumi.Input[Sequence[pulumi.Input['pulumi_kubernetes.core.v1.TaintArgs']]] taints: Optional node taints.
"""
if disk_size is None:
disk_size = '20Gi'
pulumi.set(__self__, "disk_size", disk_size)
pulumi.set(__self__, "node_role", node_role)
pulumi.set(__self__, "requirements", requirements)
pulumi.set(__self__, "security_group_ids", security_group_ids)
Expand All @@ -44,6 +49,18 @@ def __init__(__self__, *,
if taints is not None:
pulumi.set(__self__, "taints", taints)

@property
@pulumi.getter(name="diskSize")
def disk_size(self) -> pulumi.Input[str]:
"""
Disk size for the node group.
"""
return pulumi.get(self, "disk_size")

@disk_size.setter
def disk_size(self, value: pulumi.Input[str]):
pulumi.set(self, "disk_size", value)

@property
@pulumi.getter(name="nodeRole")
def node_role(self) -> pulumi.Input[str]:
Expand Down Expand Up @@ -136,6 +153,7 @@ def __init__(__self__,
opts: Optional[pulumi.ResourceOptions] = None,
ami_family: Optional[pulumi.Input[str]] = None,
annotations: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
disk_size: Optional[pulumi.Input[str]] = None,
node_role: Optional[pulumi.Input[str]] = None,
requirements: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['RequirementArgs']]]]] = None,
security_group_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
Expand All @@ -148,6 +166,7 @@ def __init__(__self__,
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] ami_family: AMI family for the node group.
:param pulumi.Input[Mapping[str, pulumi.Input[str]]] annotations: Annotations to apply to the node group.
:param pulumi.Input[str] disk_size: Disk size for the node group.
:param pulumi.Input[str] node_role: Node role for the node group.
:param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['RequirementArgs']]]] requirements: List of requirements for the node group.
:param pulumi.Input[Sequence[pulumi.Input[str]]] security_group_ids: List of security group selector terms for the node group.
Expand Down Expand Up @@ -179,6 +198,7 @@ def _internal_init(__self__,
opts: Optional[pulumi.ResourceOptions] = None,
ami_family: Optional[pulumi.Input[str]] = None,
annotations: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
disk_size: Optional[pulumi.Input[str]] = None,
node_role: Optional[pulumi.Input[str]] = None,
requirements: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['RequirementArgs']]]]] = None,
security_group_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
Expand All @@ -197,6 +217,11 @@ def _internal_init(__self__,

__props__.__dict__["ami_family"] = ami_family
__props__.__dict__["annotations"] = annotations
if disk_size is None:
disk_size = '20Gi'
if disk_size is None and not opts.urn:
raise TypeError("Missing required property 'disk_size'")
__props__.__dict__["disk_size"] = disk_size
if node_role is None and not opts.urn:
raise TypeError("Missing required property 'node_role'")
__props__.__dict__["node_role"] = node_role
Expand Down

0 comments on commit 7e5c7e5

Please sign in to comment.