Skip to content

Commit

Permalink
Use IsKubernetesGTE helper instead of reparsing semver
Browse files Browse the repository at this point in the history
  • Loading branch information
justinsb committed Sep 30, 2017
1 parent 991cd8c commit 9af2116
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions nodeup/pkg/model/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,6 @@ const RoleLabelNode16 = "node-role.kubernetes.io/node"

// buildKubeletConfigSpec returns the kubeletconfig for the specified instanceGroup
func (b *KubeletBuilder) buildKubeletConfigSpec() (*kops.KubeletConfigSpec, error) {
sv, err := util.ParseKubernetesVersion(b.Cluster.Spec.KubernetesVersion)
if err != nil {
return nil, fmt.Errorf("Failed to lookup kubernetes version: %v", err)
}

// Merge KubeletConfig for NodeLabels
c := &kops.KubeletConfigSpec{}
if b.InstanceGroup.Spec.Role == kops.InstanceGroupRoleMaster {
Expand Down Expand Up @@ -303,10 +298,8 @@ func (b *KubeletBuilder) buildKubeletConfigSpec() (*kops.KubeletConfigSpec, erro
c.NodeLabels[k] = v
}

// --register-with-taints was available in the first 1.6.0 alpha, no need to rely on semver's pre/build ordering
sv.Pre = nil
sv.Build = nil
if sv.GTE(semver.Version{Major: 1, Minor: 6, Patch: 0, Pre: nil, Build: nil}) {
// Use --register-with-taints for k8s 1.6 and on
if b.IsKubernetesGTE("1.6") {
for _, t := range b.InstanceGroup.Spec.Taints {
c.Taints = append(c.Taints, t)
}
Expand Down

0 comments on commit 9af2116

Please sign in to comment.