Skip to content

Commit

Permalink
Remove _kubernetes_master tag
Browse files Browse the repository at this point in the history
We can get the master role just as readily from the InstanceGroup spec
  • Loading branch information
justinsb committed Aug 15, 2018
1 parent ab1ab34 commit d883aed
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 24 deletions.
10 changes: 9 additions & 1 deletion nodeup/pkg/model/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ type NodeupModelContext struct {
Cluster *kops.Cluster
Distribution distros.Distribution
InstanceGroup *kops.InstanceGroup
IsMaster bool
KeyStore fi.CAStore
NodeupConfig *nodeup.Config
SecretStore fi.SecretStore

// IsMaster is true if the InstanceGroup has a role of master (populated by Init)
IsMaster bool

kubernetesVersion semver.Version
}

Expand All @@ -58,6 +60,12 @@ func (c *NodeupModelContext) Init() error {
}
c.kubernetesVersion = *k8sVersion

if c.InstanceGroup == nil {
glog.Warningf("cannot determine role, InstanceGroup not set")
} else if c.InstanceGroup.Spec.Role == kops.InstanceGroupMaster {
c.IsMaster = true
}

return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1bmastersadditionalcidrex
Tags:
- _automatic_upgrades
- _aws
- _kubernetes_master
channels:
- memfs://clusters.example.com/additionalcidr.example.com/addons/bootstrap-channel.yaml
protokubeImage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersadditionaluserda
Tags:
- _automatic_upgrades
- _aws
- _kubernetes_master
channels:
- memfs://clusters.example.com/additionaluserdata.example.com/addons/bootstrap-channel.yaml
protokubeImage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexampleco
Tags:
- _automatic_upgrades
- _aws
- _kubernetes_master
channels:
- memfs://clusters.example.com/minimal.example.com/addons/bootstrap-channel.yaml
protokubeImage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ InstanceGroupName: master-us-west-2a
Tags:
- _automatic_upgrades
- _aws
- _kubernetes_master
- _networking_cni
channels:
- s3://tune-k8s-kops-test/k8s-iam.us-west-2.td.priv/addons/bootstrap-channel.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersexternallbexampl
Tags:
- _automatic_upgrades
- _aws
- _kubernetes_master
channels:
- memfs://clusters.example.com/externallb.example.com/addons/bootstrap-channel.yaml
protokubeImage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ Resources.AWSAutoScalingLaunchConfigurationmasterustest1amastersminimalexampleco
Tags:
- _automatic_upgrades
- _aws
- _kubernetes_master
channels:
- memfs://clusters.example.com/minimal.example.com/addons/bootstrap-channel.yaml
protokubeImage:
Expand Down
14 changes: 0 additions & 14 deletions upup/pkg/fi/cloudup/tagbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,6 @@ func buildCloudupTags(cluster *api.Cluster) (sets.String, error) {
func buildNodeupTags(role api.InstanceGroupRole, cluster *api.Cluster, clusterTags sets.String) (sets.String, error) {
tags := sets.NewString()

switch role {
case api.InstanceGroupRoleNode:
// No tags

case api.InstanceGroupRoleMaster:
tags.Insert("_kubernetes_master")

case api.InstanceGroupRoleBastion:
// No tags

default:
return nil, fmt.Errorf("Unrecognized role: %v", role)
}

switch fi.StringValue(cluster.Spec.UpdatePolicy) {
case "": // default
tags.Insert("_automatic_upgrades")
Expand Down
3 changes: 0 additions & 3 deletions upup/pkg/fi/nodeup/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ import (
// MaxTaskDuration is the amount of time to keep trying for; we retry for a long time - there is not really any great fallback
const MaxTaskDuration = 365 * 24 * time.Hour

const TagMaster = "_kubernetes_master"

// NodeUpCommand the configiruation for nodeup
type NodeUpCommand struct {
CacheDir string
Expand Down Expand Up @@ -183,7 +181,6 @@ func (c *NodeUpCommand) Run(out io.Writer) error {
Cluster: c.cluster,
Distribution: distribution,
InstanceGroup: c.instanceGroup,
IsMaster: nodeTags.Has(TagMaster),
NodeupConfig: c.config,
}

Expand Down

0 comments on commit d883aed

Please sign in to comment.