Skip to content

Commit

Permalink
Merge pull request #826 from jpmcb/testsys-launcher-num-instances
Browse files Browse the repository at this point in the history
testsys-launcher: CFN param for number of cluster nodes
  • Loading branch information
jpmcb authored May 17, 2023
2 parents 910a912 + 9c4d91e commit 4260eb9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion deploy/testsys-launcher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ Bottlerocket nodes on the cluster consume the latest releases and stay up to dat

## Optional Parameters

* `TestsysAssumerRole` name of the role that can assume the `testsys-admin` role to perform cluster operations _(string)_ - Default: "Administrator"
* `TestsysAssumerRole` name of the role that can assume the `testsys-admin` role to perform cluster operations _(string)_ - Default: "Administrator"
* `TestsysNodegroupSize` number of instances for the testsys node-group _(number)_ - Default: "3"
12 changes: 9 additions & 3 deletions deploy/testsys-launcher/testsys-launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type TestsysLauncherStackProps struct {

// NewTestsysCluster creates a new EKS 1.25 cluster with the default capacity
// set to 0 and a custom managed nodegroup using bottlerocket AMIs
func NewTestsysCluster(stack constructs.Construct) eks.Cluster {
func NewTestsysCluster(stack constructs.Construct, size float64) eks.Cluster {
testsysClusterProps := eks.ClusterProps{
Version: eks.KubernetesVersion_V1_25(),
ClusterName: jsii.String("testsys"),
Expand All @@ -41,7 +41,7 @@ func NewTestsysCluster(stack constructs.Construct) eks.Cluster {
InstanceTypes: &[]ec2.InstanceType{
ec2.NewInstanceType(jsii.String("m5.xlarge")),
},
MinSize: jsii.Number(5),
MinSize: jsii.Number(size),
AmiType: eks.NodegroupAmiType_BOTTLEROCKET_X86_64,
NodeRole: nodeRole,
})
Expand Down Expand Up @@ -83,8 +83,14 @@ func NewTestsysLauncherStack(scope constructs.Construct, id string, props *Tests
Default: jsii.String("Administrator"),
})

testsysNodegroupSize := awscdk.NewCfnParameter(stack, jsii.String("TestsysNodegroupSize"), &awscdk.CfnParameterProps{
Type: jsii.String("Number"),
Description: jsii.String("The minimum size of the testsys nodegroup"),
Default: jsii.Number(3),
})

// Start testsys deployments
testsysCluster := NewTestsysCluster(stack)
testsysCluster := NewTestsysCluster(stack, *testsysNodegroupSize.ValueAsNumber())
NewTestsysAdminUser(stack, testsysCluster, *testsysAdminAssumedBy.ValueAsString())

return stack
Expand Down

0 comments on commit 4260eb9

Please sign in to comment.