Skip to content

Commit

Permalink
tests: add addon tests to nodejs and MLC python program
Browse files Browse the repository at this point in the history
  • Loading branch information
rquitales committed May 17, 2024
1 parent 75cc4e7 commit 5334057
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 59 deletions.
69 changes: 43 additions & 26 deletions examples/cluster-py/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,51 @@
# TODO specify tags: { "Name": f"{project_name}-2" }
vpc = Vpc(f"{project_name}-2")

cluster2 = eks.Cluster('eks-cluster',
vpc_id=vpc.vpc_id,
public_subnet_ids=vpc.public_subnet_ids,
public_access_cidrs=['0.0.0.0/0'],
desired_capacity=2,
min_size=2,
max_size=2,
instance_type='t3.micro',
# set storage class.
storage_classes={"gp2": eks.StorageClassArgs(
type='gp2', allow_volume_expansion=True, default=True, encrypted=True,)},
enabled_cluster_log_types=[
"api",
"audit",
"authenticator",
],)

cluster3 = eks.Cluster(f"{project_name}-3",
vpc_id=vpc.vpc_id,
public_subnet_ids=vpc.public_subnet_ids,
node_group_options=eks.ClusterNodeGroupOptionsArgs(
desired_capacity=1,
min_size=1,
max_size=1,
instance_type="t3.small"
)
cluster2 = eks.Cluster(
"eks-cluster",
vpc_id=vpc.vpc_id,
public_subnet_ids=vpc.public_subnet_ids,
public_access_cidrs=["0.0.0.0/0"],
desired_capacity=2,
min_size=2,
max_size=2,
instance_type="t3.micro",
# set storage class.
storage_classes={
"gp2": eks.StorageClassArgs(
type="gp2",
allow_volume_expansion=True,
default=True,
encrypted=True,
)
},
enabled_cluster_log_types=[
"api",
"audit",
"authenticator",
],
)

cluster3 = eks.Cluster(
f"{project_name}-3",
vpc_id=vpc.vpc_id,
public_subnet_ids=vpc.public_subnet_ids,
node_group_options=eks.ClusterNodeGroupOptionsArgs(
desired_capacity=1, min_size=1, max_size=1, instance_type="t3.small"
),
)

##########################
### EKS Addons ###
##########################

coredns = eks.Addon(
f"{project_name}-cluster3-coredns",
cluster=cluster3,
addon_name="coredns",
addon_version="v1.11.1-eksbuild.9",
resolve_conflicts_on_update="PRESERVE",
)


# Export the clusters' kubeconfig.
Expand Down
78 changes: 45 additions & 33 deletions examples/cluster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,62 @@ import * as eks from "@pulumi/eks";

const projectName = pulumi.getProject();

// Create an EKS cluster with the default configuration.
const cluster1 = new eks.Cluster(`${projectName}-1`);

// Create an EKS cluster with a non-default configuration.
const vpc = new awsx.ec2.Vpc(`${projectName}-2`, {
tags: {"Name": `${projectName}-2`},
tags: { Name: `${projectName}-2` },
});

////////////////////////////
/// EKS Clusters ///
////////////////////////////

// Create an EKS cluster with the default configuration.
const cluster1 = new eks.Cluster(`${projectName}-1`);

const cluster2 = new eks.Cluster(`${projectName}-2`, {
vpcId: vpc.vpcId,
publicSubnetIds: vpc.publicSubnetIds,
desiredCapacity: 2,
minSize: 2,
maxSize: 2,
deployDashboard: false,
enabledClusterLogTypes: [
"api",
"audit",
"authenticator",
],
vpcCniOptions: {
disableTcpEarlyDemux: true,
},
vpcId: vpc.vpcId,
publicSubnetIds: vpc.publicSubnetIds,
desiredCapacity: 2,
minSize: 2,
maxSize: 2,
deployDashboard: false,
enabledClusterLogTypes: ["api", "audit", "authenticator"],
vpcCniOptions: {
disableTcpEarlyDemux: true,
},
});

const cluster3 = new eks.Cluster(`${projectName}-3`, {
vpcId: vpc.vpcId,
publicSubnetIds: vpc.publicSubnetIds,
nodeGroupOptions: {
desiredCapacity: 1,
minSize: 1,
maxSize: 1,
instanceType: "t3.small",
enableDetailedMonitoring: false,
}
})
vpcId: vpc.vpcId,
publicSubnetIds: vpc.publicSubnetIds,
nodeGroupOptions: {
desiredCapacity: 1,
minSize: 1,
maxSize: 1,
instanceType: "t3.small",
enableDetailedMonitoring: false,
},
});

// cluster4 is a graviton cluster to test the ARM64 architecture
// can be successfully provisioned.
const cluster4 = new eks.Cluster(`${projectName}-4`, {
vpcId: vpc.vpcId,
publicSubnetIds: vpc.publicSubnetIds,
instanceType: "t4g.small",
})
vpcId: vpc.vpcId,
publicSubnetIds: vpc.publicSubnetIds,
instanceType: "t4g.small",
});

//////////////////////////
/// EKS Addons ///
//////////////////////////

// Test that we can create a coredns addon within cluster3.
const coredns = new eks.Addon("coredns", {
cluster: cluster3,
addonName: "coredns",
addonVersion: "v1.11.1-eksbuild.9",
resolveConflictsOnUpdate: "PRESERVE",
});

// Export the clusters' kubeconfig.
export const kubeconfig1 = cluster1.kubeconfig;
Expand All @@ -56,4 +68,4 @@ export const kubeconfig3 = cluster3.kubeconfig;
export const kubeconfig4 = cluster4.kubeconfig;

// export the IAM Role ARN of the cluster
export const iamRoleArn = cluster1.core.clusterIamRole.arn;
export const iamRoleArn = cluster1.core.clusterIamRole.arn;

0 comments on commit 5334057

Please sign in to comment.