From c2cb6646af118d3f45e6557d55406f664bdbf21c Mon Sep 17 00:00:00 2001 From: John Gardiner Myers Date: Wed, 29 Jul 2020 16:26:55 -0700 Subject: [PATCH] Remove tags from NodeupConfig --- pkg/apis/nodeup/config.go | 2 - upup/pkg/fi/cloudup/apply_cluster.go | 15 ------- upup/pkg/fi/cloudup/tagbuilder.go | 16 -------- upup/pkg/fi/cloudup/tagbuilder_test.go | 54 -------------------------- upup/pkg/fi/nodeup/command.go | 2 - 5 files changed, 89 deletions(-) diff --git a/pkg/apis/nodeup/config.go b/pkg/apis/nodeup/config.go index dbba9474a0..4eb6f1e9be 100644 --- a/pkg/apis/nodeup/config.go +++ b/pkg/apis/nodeup/config.go @@ -28,8 +28,6 @@ import ( // Config is the configuration for the nodeup binary type Config struct { - // Tags enable/disable chunks of the model - Tags []string `json:",omitempty"` // Assets are locations where we can find files to be installed // TODO: Remove once everything is in containers? Assets map[architectures.Architecture][]string `json:",omitempty"` diff --git a/upup/pkg/fi/cloudup/apply_cluster.go b/upup/pkg/fi/cloudup/apply_cluster.go index 3892905c18..0003b2eebe 100644 --- a/upup/pkg/fi/cloudup/apply_cluster.go +++ b/upup/pkg/fi/cloudup/apply_cluster.go @@ -1172,7 +1172,6 @@ type nodeUpConfigBuilder struct { cluster *kops.Cluster etcdManifests map[kops.InstanceGroupRole][]string images map[kops.InstanceGroupRole]map[architectures.Architecture][]*nodeup.Image - nodeUpTags []string protokubeImage map[kops.InstanceGroupRole]*nodeup.Image } @@ -1184,12 +1183,6 @@ func (c *ApplyClusterCmd) newNodeUpConfigBuilder(assetBuilder *assets.AssetBuild return nil, fmt.Errorf("error parsing config base %q: %v", cluster.Spec.ConfigBase, err) } - // TODO: Remove - clusterTags, err := buildCloudupTags(cluster) - if err != nil { - return nil, err - } - channels := []string{ configBase.Join("addons", "bootstrap-channel.yaml").Path(), } @@ -1198,11 +1191,6 @@ func (c *ApplyClusterCmd) newNodeUpConfigBuilder(assetBuilder *assets.AssetBuild channels = append(channels, cluster.Spec.Addons[i].Manifest) } - nodeUpTags, err := buildNodeupTags(cluster, clusterTags) - if err != nil { - return nil, err - } - useGossip := dns.IsGossipHostname(cluster.Spec.MasterInternalName) etcdManifests := map[kops.InstanceGroupRole][]string{} @@ -1307,7 +1295,6 @@ func (c *ApplyClusterCmd) newNodeUpConfigBuilder(assetBuilder *assets.AssetBuild cluster: cluster, etcdManifests: etcdManifests, images: images, - nodeUpTags: nodeUpTags.List(), protokubeImage: protokubeImage, } return &configBuilder, nil @@ -1327,8 +1314,6 @@ func (n *nodeUpConfigBuilder) BuildConfig(ig *kops.InstanceGroup, apiserverAddit } config := nodeup.NewConfig(cluster, ig) - config.Tags = append(config.Tags, n.nodeUpTags...) - config.Assets = make(map[architectures.Architecture][]string) for _, arch := range architectures.GetSupported() { config.Assets[arch] = []string{} diff --git a/upup/pkg/fi/cloudup/tagbuilder.go b/upup/pkg/fi/cloudup/tagbuilder.go index 18408728d4..227be76b80 100644 --- a/upup/pkg/fi/cloudup/tagbuilder.go +++ b/upup/pkg/fi/cloudup/tagbuilder.go @@ -65,19 +65,3 @@ func buildCloudupTags(cluster *api.Cluster) (sets.String, error) { return tags, nil } - -func buildNodeupTags(cluster *api.Cluster, clusterTags sets.String) (sets.String, error) { - tags := sets.NewString() - - if clusterTags.Has("_gce") { - tags.Insert("_gce") - } - if clusterTags.Has("_aws") { - tags.Insert("_aws") - } - if clusterTags.Has("_do") { - tags.Insert("_do") - } - - return tags, nil -} diff --git a/upup/pkg/fi/cloudup/tagbuilder_test.go b/upup/pkg/fi/cloudup/tagbuilder_test.go index e5dd3372b7..3614a531f8 100644 --- a/upup/pkg/fi/cloudup/tagbuilder_test.go +++ b/upup/pkg/fi/cloudup/tagbuilder_test.go @@ -78,15 +78,6 @@ func TestBuildTags_CloudProvider_AWS_Weave(t *testing.T) { if !tags.Has("_aws") { t.Fatal("tag _aws not found") } - - nodeUpTags, err := buildNodeupTags(c, tags) - if err != nil { - t.Fatalf("buildNodeupTags error: %v", err) - } - - if !nodeUpTags.Has("_aws") { - t.Fatal("nodeUpTag _aws not found") - } } func TestBuildTags_CloudProvider_AWS_Flannel(t *testing.T) { @@ -104,15 +95,6 @@ func TestBuildTags_CloudProvider_AWS_Flannel(t *testing.T) { if !tags.Has("_aws") { t.Fatal("tag _aws not found") } - - nodeUpTags, err := buildNodeupTags(c, tags) - if err != nil { - t.Fatalf("buildNodeupTags error: %v", err) - } - - if !nodeUpTags.Has("_aws") { - t.Fatal("nodeUpTag _aws not found") - } } func TestBuildTags_CloudProvider_AWS_Calico(t *testing.T) { @@ -130,15 +112,6 @@ func TestBuildTags_CloudProvider_AWS_Calico(t *testing.T) { if !tags.Has("_aws") { t.Fatal("tag _aws not found") } - - nodeUpTags, err := buildNodeupTags(c, tags) - if err != nil { - t.Fatalf("buildNodeupTags error: %v", err) - } - - if !nodeUpTags.Has("_aws") { - t.Fatal("nodeUpTag _aws not found") - } } func TestBuildTags_CloudProvider_AWS_Canal(t *testing.T) { @@ -156,15 +129,6 @@ func TestBuildTags_CloudProvider_AWS_Canal(t *testing.T) { if !tags.Has("_aws") { t.Fatal("tag _aws not found") } - - nodeUpTags, err := buildNodeupTags(c, tags) - if err != nil { - t.Fatalf("buildNodeupTags error: %v", err) - } - - if !nodeUpTags.Has("_aws") { - t.Fatal("nodeUpTag _aws not found") - } } func TestBuildTags_CloudProvider_AWS(t *testing.T) { @@ -179,15 +143,6 @@ func TestBuildTags_CloudProvider_AWS(t *testing.T) { if !tags.Has("_aws") { t.Fatal("tag _aws not found") } - - nodeUpTags, err := buildNodeupTags(c, tags) - if err != nil { - t.Fatalf("buildNodeupTags error: %v", err) - } - - if !nodeUpTags.Has("_aws") { - t.Fatal("nodeUpTag _aws not found") - } } func TestBuildTags_KubernetesVersions(t *testing.T) { @@ -225,13 +180,4 @@ func TestBuildTags_CloudProvider_AWS_Cilium(t *testing.T) { if !tags.Has("_aws") { t.Fatal("tag _aws not found") } - - nodeUpTags, err := buildNodeupTags(c, tags) - if err != nil { - t.Fatalf("buildNodeupTags error: %v", err) - } - - if !nodeUpTags.Has("_aws") { - t.Fatal("nodeUpTag _aws not found") - } } diff --git a/upup/pkg/fi/nodeup/command.go b/upup/pkg/fi/nodeup/command.go index 2c6403b497..b6ba1db31e 100644 --- a/upup/pkg/fi/nodeup/command.go +++ b/upup/pkg/fi/nodeup/command.go @@ -173,11 +173,9 @@ func (c *NodeUpCommand) Run(out io.Writer) error { distroTags := distribution.BuildTags() nodeTags := sets.NewString() - nodeTags.Insert(c.config.Tags...) nodeTags.Insert(archTags...) nodeTags.Insert(distroTags...) - klog.Infof("Config tags: %v", c.config.Tags) klog.Infof("Arch tags: %v", archTags) klog.Infof("Distro tags: %v", distroTags)