implemented EKS infra provisioning with CFN
Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
43
examples/aws-eks/infrastructure.cue
Normal file
43
examples/aws-eks/infrastructure.cue
Normal file
@@ -0,0 +1,43 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"dagger.io/aws"
|
||||
"dagger.io/aws/cloudformation"
|
||||
)
|
||||
|
||||
#Infrastructure: {
|
||||
awsConfig: aws.#Config
|
||||
namePrefix: *"dagger-example-" | string
|
||||
// Cluster size is 1 for example (to limit resources)
|
||||
workerNodeCapacity: *1 | >1
|
||||
workerNodeInstanceType: *"t3.small" | string
|
||||
|
||||
let clusterName = "\(namePrefix)eks-cluster"
|
||||
|
||||
eksControlPlane: cloudformation.#Stack & {
|
||||
config: awsConfig
|
||||
source: json.Marshal(#CFNTemplate.eksControlPlane)
|
||||
stackName: "\(namePrefix)eks-controlplane"
|
||||
neverUpdate: true
|
||||
parameters: ClusterName: clusterName
|
||||
}
|
||||
|
||||
eksNodeGroup: cloudformation.#Stack & {
|
||||
config: awsConfig
|
||||
source: json.Marshal(#CFNTemplate.eksNodeGroup)
|
||||
stackName: "\(namePrefix)eks-nodegroup"
|
||||
neverUpdate: true
|
||||
parameters: {
|
||||
ClusterName: clusterName
|
||||
ClusterControlPlaneSecurityGroup: eksControlPlane.outputs.DefaultSecurityGroup
|
||||
NodeAutoScalingGroupDesiredCapacity: 1
|
||||
NodeAutoScalingGroupMaxSize: NodeAutoScalingGroupDesiredCapacity + 1
|
||||
NodeGroupName: "\(namePrefix)eks-nodegroup"
|
||||
NodeInstanceType: workerNodeInstanceType
|
||||
VpcId: eksControlPlane.outputs.VPC
|
||||
Subnets: eksControlPlane.outputs.SubnetIds
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user