Skip to content

Commit

Permalink
add tests and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoud Saada committed Apr 22, 2020
1 parent 9634ce1 commit 933ea47
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 94 deletions.
7 changes: 6 additions & 1 deletion examples/05-advanced-nodegroups.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# An advanced example of ClusterConfig object with customised nodegroups:
---
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

Expand Down Expand Up @@ -42,6 +42,11 @@ nodeGroups:
nodegroup-type: very-special-science-workloads
classicLoadBalancerNames:
- ng3-classic-load-balancer
asgMetricsCollection:
- granularity: 1Minute
metrics:
- GroupMinSize
- GroupMaxSize
taints:
special: "true:NoSchedule"
privateNetworking: true
Expand Down
35 changes: 34 additions & 1 deletion pkg/cfn/builder/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type Properties struct {
VPCZoneIdentifier interface{}

LoadBalancerNames []string
MetricsCollection []interface{}
TargetGroupARNs []string
DesiredCapacity, MinSize, MaxSize string

Expand Down Expand Up @@ -771,7 +772,15 @@ var _ = Describe("CloudFormation template builder API", func() {

Context("NodeGroupAutoScaling", func() {
cfg, ng := newClusterConfigAndNodegroup(true)

ng.ASGMetricsCollection = []api.MetricsCollection{
{
Granularity: "1Minute",
Metrics: []string{
"GroupMinSize",
"GroupMaxSize",
},
},
}
ng.ClassicLoadBalancerNames = []string{"clb-1", "clb-2"}
ng.TargetGroupARNs = []string{"tg-arn-1", "tg-arn-2"}

Expand Down Expand Up @@ -876,6 +885,30 @@ var _ = Describe("CloudFormation template builder API", func() {
Expect(ng.Properties.LoadBalancerNames).To(Equal([]string{"clb-1", "clb-2"}))
})

It("should have metrics collections set", func() {
Expect(ngTemplate.Resources).To(HaveKey("NodeGroup"))
ng := ngTemplate.Resources["NodeGroup"]
Expect(ng).ToNot(BeNil())
Expect(ng.Properties).ToNot(BeNil())

Expect(ng.Properties.MetricsCollection).ToNot(BeEmpty())
var metricsCollection map[string]interface{} = ng.Properties.MetricsCollection[0].(map[string]interface{})
// Expect(ng.Properties.MetricsCollection[0].(interface{})).To(HaveKeyWithValue("granularity", "1Minute"))
Expect(metricsCollection).To(HaveKey("granularity"))
Expect(metricsCollection).To(HaveKey("metrics"))
Expect(metricsCollection["granularity"]).To(Equal("1Minute"))
Expect(metricsCollection["metrics"]).To(ContainElement("GroupMinSize"))
Expect(metricsCollection["metrics"]).To(ContainElement("GroupMaxSize"))

// To(Equal(map[string]interface{}{
// granularity: "1Minute",
// metrics: []string{"GroupMinSize", "GroupMaxSize"},
// }))

// Expect(ng.Properties.MetricsCollection[0].(interface{})).
// To(HaveKeyWithValue("metrics", []string{"GroupMinSize", "GroupMaxSize"}))
})

It("should have target groups ARNs set", func() {
Expect(ngTemplate.Resources).To(HaveKey("NodeGroup"))
ng := ngTemplate.Resources["NodeGroup"]
Expand Down
92 changes: 0 additions & 92 deletions pkg/cfn/builder/nodegroup_test.go

This file was deleted.

1 change: 1 addition & 0 deletions userdocs/src/usage/eks-managed-nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ the provisioned Autoscaling Group like in unmanaged nodegroups.
- Control over the node bootstrapping process and customization of the kubelet are not supported. This includes the
following fields: `classicLoadBalancerNames`, `maxPodsPerNode`, `taints`, `targetGroupARNs`, `preBootstrapCommands`, `overrideBootstrapCommand`,
`clusterDNS` and `kubeletExtraConfig`.
- No support for enabling metrics on AutoScalingGroups using `asgMetricsCollection`

## Note for eksctl versions below 0.12.0
- For clusters upgraded from EKS 1.13 to EKS 1.14, managed nodegroups will not be able to communicate with unmanaged
Expand Down
5 changes: 5 additions & 0 deletions userdocs/src/usage/managing-nodegroups.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ nodeGroups:
classicLoadBalancerNames:
- dev-clb-1
- dev-clb-2
asgMetricsCollection:
- granularity: 1Minute
metrics:
- GroupMinSize
- GroupMaxSize
- name: ng-2-api
labels: { role: api }
instanceType: m5.2xlarge
Expand Down

0 comments on commit 933ea47

Please sign in to comment.