• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zalando-incubator / cluster-lifecycle-manager / 4437745693

16 Mar 2023 01:53PM UTC coverage: 54.148% (-0.2%) from 54.301%
4437745693

Pull #653

github

Mahmoud Gaballah
code review
Pull Request #653: refactoring

175 of 175 new or added lines in 4 files covered. (100.0%)

2833 of 5232 relevant lines covered (54.15%)

12.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/api/node_pool.go
1
package api
2

3
import (
4
        "strings"
5

6
        "github.com/zalando-incubator/cluster-lifecycle-manager/pkg/kubernetes"
7
        corev1 "k8s.io/api/core/v1"
8
)
9

10
// NodePool describes a node pool in a kubernetes cluster.
11
type NodePool struct {
12
        DiscountStrategy string            `json:"discount_strategy" yaml:"discount_strategy"`
13
        InstanceTypes    []string          `json:"instance_types"    yaml:"instance_types"`
14
        Name             string            `json:"name"              yaml:"name"`
15
        Profile          string            `json:"profile"           yaml:"profile"`
16
        MinSize          int64             `json:"min_size"          yaml:"min_size"`
17
        MaxSize          int64             `json:"max_size"          yaml:"max_size"`
18
        ConfigItems      map[string]string `json:"config_items"      yaml:"config_items"`
19

20
        // Deprecated, only kept here so the existing clusters don't break
21
        InstanceType string
22
}
23

24
func (np NodePool) IsSpot() bool {
×
25
        return np.DiscountStrategy == "spot_max_price" || np.DiscountStrategy == "spot"
×
26
}
×
27

28
func (np NodePool) IsMaster() bool {
×
29
        return strings.Contains(np.Profile, "master")
×
30
}
×
31

32
func (np NodePool) Taints() []*corev1.Taint {
×
33
        conf, exist := np.ConfigItems["taints"]
×
34
        if !exist {
×
35
                return nil
×
36
        }
×
37
        var taints []*corev1.Taint
×
38
        for _, t := range strings.Split(conf, ",") {
×
39
                taint, err := kubernetes.ParseTaint(t)
×
40
                if err == nil {
×
41
                        taints = append(taints, taint)
×
42
                }
×
43
        }
44
        return taints
×
45
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc