Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions examples/cluster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ const cluster3 = new eks.Cluster(`${projectName}-3`, {
upgradePolicy: {
supportType: "STANDARD",
},
kubeSchedulerConfig: {
nodeResourcesFit: {
scoringStrategy: {
type: "MostAllocated",
},
},
},
})

// cluster4 is a graviton cluster to test the ARM64 architecture
Expand Down
31 changes: 31 additions & 0 deletions nodejs/eks/cluster/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,9 @@ export function createCore(
}
: undefined,
upgradePolicy: args.upgradePolicy,
kubeApiServerConfig: args.kubeApiServerConfig,
kubeControllerManagerConfig: args.kubeControllerManagerConfig,
kubeSchedulerConfig: args.kubeSchedulerConfig,
deletionProtection: args.deletionProtection,
},
{
Expand Down Expand Up @@ -1920,6 +1923,28 @@ export interface ClusterOptions {
*/
upgradePolicy?: aws.types.input.eks.ClusterUpgradePolicy;

/**
* Advanced configuration for the cluster's Kubernetes API server. Requires Kubernetes version 1.31 or later.
*
* For more information, see: https://docs.aws.amazon.com/eks/latest/userguide/control-plane-configuration.html
*/
kubeApiServerConfig?: aws.types.input.eks.ClusterKubeApiServerConfig;

/**
* Advanced configuration for the cluster's Kubernetes controller manager. Requires Kubernetes version 1.31
* or later, and a cluster using EKS Provisioned Control Plane.
*
* For more information, see: https://docs.aws.amazon.com/eks/latest/userguide/control-plane-configuration.html
*/
kubeControllerManagerConfig?: aws.types.input.eks.ClusterKubeControllerManagerConfig;

/**
* Advanced configuration for the cluster's Kubernetes scheduler. Requires Kubernetes version 1.31 or later.
*
* For more information, see: https://docs.aws.amazon.com/eks/latest/userguide/control-plane-configuration.html
*/
kubeSchedulerConfig?: aws.types.input.eks.ClusterKubeSchedulerConfig;

/**
* Whether to enable deletion protection for the cluster. When enabled, the cluster cannot be deleted unless deletion protection is first disabled. Default: `false`.
*/
Expand Down Expand Up @@ -2081,6 +2106,9 @@ export interface ClusterResult {
oidcIssuer: pulumi.Output<string>;
autoModeNodeRoleName: pulumi.Output<string>;
upgradePolicy: pulumi.Output<aws.types.output.eks.ClusterUpgradePolicy>;
kubeApiServerConfig: pulumi.Output<aws.types.output.eks.ClusterKubeApiServerConfig>;
kubeControllerManagerConfig: pulumi.Output<aws.types.output.eks.ClusterKubeControllerManagerConfig>;
kubeSchedulerConfig: pulumi.Output<aws.types.output.eks.ClusterKubeSchedulerConfig>;
}

/** @internal */
Expand Down Expand Up @@ -2211,6 +2239,9 @@ export function createCluster(
oidcIssuer: oidcIssuerUrl.apply((url) => url.replace("https://", "")),
autoModeNodeRoleName: core.autoModeNodeRoleName,
upgradePolicy: core.cluster.upgradePolicy,
kubeApiServerConfig: core.cluster.kubeApiServerConfig,
kubeControllerManagerConfig: core.cluster.kubeControllerManagerConfig,
kubeSchedulerConfig: core.cluster.kubeSchedulerConfig,
};
}

Expand Down
8 changes: 4 additions & 4 deletions nodejs/eks/nodes/instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const DEFAULT_INSTANCE_TYPE = "t3.medium";

export interface GetEfaNetworkInterfacesArgs {
// The instance types configured for the node group.
instanceTypes: pulumi.Input<pulumi.Input<string>[]> | undefined;
instanceTypes: pulumi.Input<pulumi.Input<string>[] | undefined> | undefined;
// The security group IDs to associate with the network interfaces.
securityGroupIds: pulumi.Input<pulumi.Input<string>[]>;
// The property path to use for the instance type in error messages.
Expand Down Expand Up @@ -118,7 +118,7 @@ export function getEfaNetworkInterfaces(
export function filterEfaSubnets(
subnetIds: pulumi.Input<pulumi.Input<string>[]>,
placementGroupAvailabilityZone: pulumi.Input<string>,
instanceTypes: pulumi.Input<pulumi.Input<string>[]> | undefined,
instanceTypes: pulumi.Input<pulumi.Input<string>[] | undefined> | undefined,
opts: pulumi.InvokeOptions,
): pulumi.Output<string[]> {
const instanceType = getEfaInstanceType(instanceTypes);
Expand Down Expand Up @@ -199,11 +199,11 @@ function getSupportedAZs(
* @returns The first instance type from the list, or "t3.medium" if no instance types are provided
*/
function getEfaInstanceType(
instanceTypes: pulumi.Input<pulumi.Input<string>[]> | undefined,
instanceTypes: pulumi.Input<pulumi.Input<string>[] | undefined> | undefined,
): pulumi.Output<string> {
return instanceTypes
? pulumi.output(instanceTypes).apply((types) => {
return types.length > 0 ? types[0] : DEFAULT_INSTANCE_TYPE;
return types && types.length > 0 ? types[0] : DEFAULT_INSTANCE_TYPE;
})
: pulumi.output(DEFAULT_INSTANCE_TYPE);
}
12 changes: 7 additions & 5 deletions nodejs/eks/nodes/nodegroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,7 @@ function createMNGCustomLaunchTemplate(

const taints = args.taints
? pulumi.output(args.taints).apply((taints) => {
return taints
return (taints ?? [])
.map((taint) => {
return {
[taint.key]: {
Expand Down Expand Up @@ -2351,7 +2351,7 @@ function getRecommendedAMI(
k8sVersion: pulumi.Output<string>,
parent: pulumi.Resource | undefined,
): pulumi.Input<string> {
let instanceTypes: pulumi.Input<pulumi.Input<string>[]> | undefined;
let instanceTypes: pulumi.Input<pulumi.Input<string>[] | undefined> | undefined;
let instanceTypesPropertyPath: string = "";
if ("instanceType" in args && args.instanceType) {
instanceTypes = [args.instanceType];
Expand All @@ -2369,7 +2369,7 @@ function getRecommendedAMI(

const amiType = args.amiType
? pulumi.output(args.amiType).apply((amiType) => {
const resolvedType = toAmiType(amiType);
const resolvedType = amiType === undefined ? undefined : toAmiType(amiType);
if (resolvedType === undefined) {
throw new pulumi.InputPropertyError({
propertyPath: "amiType",
Expand All @@ -2381,7 +2381,9 @@ function getRecommendedAMI(
: determineAmiType(os, args.gpu, instanceTypes, instanceTypesPropertyPath, parent);

// if specified use the version from the args, otherwise use the version from the cluster.
const version = args.version ? args.version : k8sVersion;
const version = pulumi
.all([args.version, k8sVersion])
.apply(([version, clusterVersion]) => version ?? clusterVersion);

return pulumi.all([amiType, version]).apply(([amiType, version]) => {
const parameterName = getAmiMetadata(amiType).ssmParameterName(version);
Expand Down Expand Up @@ -2430,7 +2432,7 @@ export function isGravitonInstance(instanceType: string, propertyPath: string):
function determineAmiType(
os: pulumi.Input<OperatingSystem>,
gpu: pulumi.Input<boolean> | undefined,
instanceTypes: pulumi.Input<pulumi.Input<string>[]> | undefined,
instanceTypes: pulumi.Input<pulumi.Input<string>[] | undefined> | undefined,
instanceTypesPropertyPath: string,
parent: pulumi.Resource | undefined,
): pulumi.Output<AmiType> {
Expand Down
2 changes: 1 addition & 1 deletion nodejs/eks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"bugs": "https://github.com/pulumi/pulumi-eks/issues",
"dependencies": {
"@iarna/toml": "^3.0.0",
"@pulumi/aws": "7.25.0",
"@pulumi/aws": "7.43.0",
"@pulumi/kubernetes": "4.19.0",
"@pulumi/pulumi": "^3.143.0",
"https-proxy-agent": "^5.0.1",
Expand Down
8 changes: 4 additions & 4 deletions nodejs/eks/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1763,10 +1763,10 @@
resolved "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz"
integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==

"@pulumi/aws@7.25.0":
version "7.25.0"
resolved "https://registry.yarnpkg.com/@pulumi/aws/-/aws-7.25.0.tgz#d831f99e4e5faac496d36b3f3726b50cc1bba818"
integrity sha512-qP2ikhFJrw/NrizaOBWiAGkHe003+fPT5Blsc4X1q8uQ0CpmjnPAbbsotpI13hVBU4a2sflIX4GkHcXzRU9QQw==
"@pulumi/aws@7.43.0":
version "7.43.0"
resolved "https://ironsrc.jfrog.io/artifactory/api/npm/npm-virtual/@pulumi/aws/-/aws-7.43.0.tgz#84e4d90e83ebf32e05c64a2bf15c51aeee86d1ae"
integrity sha512-UCZCrOBn1xVu5CSfd9I3FNZCPkdEcXaB6XNacTj0wVB9iPj8Ma6dLnbfLsUT2ceGsmSMrhwOMvnacOrrhG722A==
dependencies:
"@pulumi/pulumi" "^3.142.0"
mime "^2.0.0"
Expand Down
15 changes: 15 additions & 0 deletions provider/cmd/pulumi-gen-eks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,21 @@ func generateSchema(version semver.Version, outdir string) schema.PackageSpec {
TypeSpec: schema.TypeSpec{Ref: awsRef("#/types/aws:eks%2FClusterUpgradePolicy:ClusterUpgradePolicy", dependencies.Aws)},
Description: `The cluster's upgrade policy. Valid support types are "STANDARD" and "EXTENDED". Defaults to "EXTENDED".`,
},
"kubeApiServerConfig": {
TypeSpec: schema.TypeSpec{Ref: awsRef("#/types/aws:eks%2FClusterKubeApiServerConfig:ClusterKubeApiServerConfig", dependencies.Aws)},
Description: "Advanced configuration for the cluster's Kubernetes API server. Requires Kubernetes version 1.31 or later.\n\n" +
"For more information, see: https://docs.aws.amazon.com/eks/latest/userguide/control-plane-configuration.html",
},
"kubeControllerManagerConfig": {
TypeSpec: schema.TypeSpec{Ref: awsRef("#/types/aws:eks%2FClusterKubeControllerManagerConfig:ClusterKubeControllerManagerConfig", dependencies.Aws)},
Description: "Advanced configuration for the cluster's Kubernetes controller manager. Requires Kubernetes version 1.31 or later, and a cluster using EKS Provisioned Control Plane.\n\n" +
"For more information, see: https://docs.aws.amazon.com/eks/latest/userguide/control-plane-configuration.html",
},
"kubeSchedulerConfig": {
TypeSpec: schema.TypeSpec{Ref: awsRef("#/types/aws:eks%2FClusterKubeSchedulerConfig:ClusterKubeSchedulerConfig", dependencies.Aws)},
Description: "Advanced configuration for the cluster's Kubernetes scheduler. Requires Kubernetes version 1.31 or later.\n\n" +
"For more information, see: https://docs.aws.amazon.com/eks/latest/userguide/control-plane-configuration.html",
},
"deletionProtection": {
TypeSpec: schema.TypeSpec{Type: "boolean"},
Description: "Whether to enable deletion protection for the cluster. When enabled, the cluster cannot be deleted unless deletion protection is first disabled. Default: `false`.",
Expand Down
Loading