Repository: kubernetes/kops (go)

Issue:
Removing baremetal cloud provider
Following #9166, does anyone mind removing baremetal? Looks like some basic work was done on this about three years ago, but that it was never completed. Later commits are more about general changes to cloud provides.

@justinsb any plans on doing more work on this? With where kops is today, a baremetal provider perhaps overlaps more than usual with kubeadm.

Pull request description:
Remove the baremetal cloud provider
I found with #9356 that the baremetal provider has been broken for k8s >= 1.7 unless anonymous auth was enabled.

The baremetal provider, being an extremely special case, is hindering development. I believe that
baremetal would be better managed under a cloud provider such as OpenStack.

Fixes #9357

Patch:
diff --git a/cmd/kops/BUILD.bazel b/cmd/kops/BUILD.bazel
index ec9e2a5d09..5ce000005f 100644
--- a/cmd/kops/BUILD.bazel
+++ b/cmd/kops/BUILD.bazel
@@ -42,7 +42,6 @@ go_library(
         "set.go",
         "set_cluster.go",
         "toolbox.go",
-        "toolbox_bundle.go",
         "toolbox_convert_imported.go",
         "toolbox_dump.go",
         "toolbox_template.go",
@@ -65,7 +64,6 @@ go_library(
         "//pkg/apis/kops/util:go_default_library",
         "//pkg/apis/kops/validation:go_default_library",
         "//pkg/assets:go_default_library",
-        "//pkg/bundle:go_default_library",
         "//pkg/client/simple:go_default_library",
         "//pkg/cloudinstances:go_default_library",
         "//pkg/commands:go_default_library",
@@ -104,7 +102,6 @@ go_library(
         "//vendor/github.com/spf13/cobra:go_default_library",
         "//vendor/github.com/spf13/cobra/doc:go_default_library",
         "//vendor/github.com/spf13/viper:go_default_library",
-        "//vendor/golang.org/x/crypto/ssh:go_default_library",
         "//vendor/k8s.io/api/core/v1:go_default_library",
         "//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
         "//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",
diff --git a/cmd/kops/toolbox.go b/cmd/kops/toolbox.go
index 186ed6ae70..c85b93eedd 100644
--- a/cmd/kops/toolbox.go
+++ b/cmd/kops/toolbox.go
@@ -47,7 +47,6 @@ func NewCmdToolbox(f *util.Factory, out io.Writer) *cobra.Command {
 
 	cmd.AddCommand(NewCmdToolboxConvertImported(f, out))
 	cmd.AddCommand(NewCmdToolboxDump(f, out))
-	cmd.AddCommand(NewCmdToolboxBundle(f, out))
 	cmd.AddCommand(NewCmdToolboxTemplate(f, out))
 
 	return cmd
diff --git a/cmd/kops/toolbox_bundle.go b/cmd/kops/toolbox_bundle.go
deleted file mode 100644
index ef3cf15ffa..0000000000
--- a/cmd/kops/toolbox_bundle.go
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
-Copyright 2017 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package main
-
-import (
-	"bytes"
-	"context"
-	"fmt"
-	"io"
-	"os"
-	"path/filepath"
-
-	"github.com/spf13/cobra"
-	"golang.org/x/crypto/ssh"
-	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-	"k8s.io/client-go/util/homedir"
-	"k8s.io/klog"
-	"k8s.io/kops/cmd/kops/util"
-	"k8s.io/kops/pkg/bundle"
-	"k8s.io/kops/upup/pkg/kutil"
-	"k8s.io/kops/util/pkg/vfs"
-	"k8s.io/kubectl/pkg/util/i18n"
-	"k8s.io/kubectl/pkg/util/templates"
-)
-
-var (
-	toolboxBundleLong = templates.LongDesc(i18n.T(`
-	Creates a bundle for enrolling a bare metal machine.`))
-
-	toolboxBundleExample = templates.Examples(i18n.T(`
-	# Bundle
-	kops toolbox bundle --name k8s-cluster.example.com
-	`))
-
-	toolboxBundleShort = i18n.T(`Bundle cluster information`)
-)
-
-type ToolboxBundleOptions struct {
-	// Target is the machine we are enrolling in the cluster
-	Target string
-}
-
-func (o *ToolboxBundleOptions) InitDefaults() {
-}
-
-func NewCmdToolboxBundle(f *util.Factory, out io.Writer) *cobra.Command {
-	options := &ToolboxBundleOptions{}
-	options.InitDefaults()
-
-	cmd := &cobra.Command{
-		Use:     "bundle",
-		Short:   toolboxBundleShort,
-		Long:    toolboxBundleLong,
-		Example: toolboxBundleExample,
-		Run: func(cmd *cobra.Command, args []string) {
-			ctx := context.TODO()
-			err := RunToolboxBundle(ctx, f, out, options, args)
-			if err != nil {
-				exitWithError(err)
-			}
-		},
-	}
-
-	cmd.Flags().StringVar(&options.Target, "target", options.Target, "machine to target (IP address)")
-
-	return cmd
-}
-
-func RunToolboxBundle(ctx context.Context, f Factory, out io.Writer, options *ToolboxBundleOptions, args []string) error {
-	if len(args) == 0 {
-		return fmt.Errorf("specify name of instance group for node")
-	}
-	if len(args) != 1 {
-		return fmt.Errorf("can only specify one instance group")
-	}
-
-	if options.Target == "" {
-		return fmt.Errorf("target is required")
-	}
-	groupName := args[0]
-
-	cluster, err := rootCommand.Cluster(ctx)
-	if err != nil {
-		return err
-	}
-
-	clientset, err := f.Clientset()
-	if err != nil {
-		return err
-	}
-
-	ig, err := clientset.InstanceGroupsFor(cluster).Get(ctx, groupName, metav1.GetOptions{})
-	if err != nil {
-		return fmt.Errorf("error reading InstanceGroup %q: %v", groupName, err)
-	}
-	if ig == nil {
-		return fmt.Errorf("InstanceGroup %q not found", groupName)
-	}
-
-	builder := bundle.Builder{
-		Clientset: clientset,
-	}
-	bundleData, err := builder.Build(cluster, ig)
-	if err != nil {
-		return fmt.Errorf("error building bundle: %v", err)
-	}
-
-	sshUser := os.Getenv("USER")
-
-	nodeSSH := &kutil.NodeSSH{
-		Hostname: options.Target,
-	}
-	nodeSSH.SSHConfig.HostKeyCallback = ssh.InsecureIgnoreHostKey()
-	nodeSSH.SSHConfig.User = sshUser
-	sshIdentity := filepath.Join(homedir.HomeDir(), ".ssh", "id_rsa")
-	if err := kutil.AddSSHIdentity(&nodeSSH.SSHConfig, sshIdentity); err != nil {
-		return err
-	}
-
-	sshClient, err := nodeSSH.GetSSHClient()
-	if err != nil {
-		return fmt.Errorf("error getting SSH client: %v", err)
-	}
-
-	if err := runSshCommand(sshClient, "sudo mkdir -p /etc/kubernetes/bootstrap"); err != nil {
-		return err
-	}
-
-	root, err := nodeSSH.Root()
-	if err != nil {
-		return fmt.Errorf("error connecting to nodeSSH: %v", err)
-	}
-	for _, file := range bundleData.Files {
-		sshAcl := &vfs.SSHAcl{
-			Mode: file.Header.FileInfo().Mode(),
-		}
-		p := root.Join("etc", "kubernetes", "bootstrap", file.Header.Name)
-		klog.Infof("writing %s", p)
-		if err := p.WriteFile(bytes.NewReader(file.Data), sshAcl); err != nil {
-			return fmt.Errorf("error writing file %q: %v", file.Header.Name, err)
-		}
-	}
-
-	if err := runSshCommand(sshClient, "sudo /etc/kubernetes/bootstrap/bootstrap.sh"); err != nil {
-		return err
-	}
-
-	return nil
-}
-
-func runSshCommand(sshClient *ssh.Client, cmd string) error {
-	s, err := sshClient.NewSession()
-	if err != nil {
-		return fmt.Errorf("error creating ssh session: %v", err)
-	}
-
-	var stdout bytes.Buffer
-	var stderr bytes.Buffer
-
-	s.Stdout = io.MultiWriter(&stdout, os.Stdout)
-	s.Stderr = io.MultiWriter(&stderr, os.Stderr)
-
-	klog.Infof("running %s", cmd)
-	if err := s.Run(cmd); err != nil {
-		return fmt.Errorf("error running %s: %v\nstdout: %s\nstderr: %s", cmd, err, stdout.String(), stderr.String())
-	}
-
-	klog.Infof("stdout: %s", stdout.String())
-	klog.Infof("stderr: %s", stderr.String())
-	return nil
-}
-
-// bazel build //cmd/kops && bazel-bin/cmd/kops/kops toolbox bundle --name ${CLUSTER} ${IGNAME} && scp output.tar.gz ${TARGET}:/tmp/output.tar.gz
-// sudo apt-get install --yes ca-certificates
-// sudo mkdir -p /etc/kubernetes/bootstrap
-// sudo tar zx -C /etc/kubernetes/bootstrap -f /tmp/output.tar.gz
-// sudo /etc/kubernetes/bootstrap/bootstrap.sh
diff --git a/docs/cli/kops_toolbox.md b/docs/cli/kops_toolbox.md
index 46fa348cfe..ab2f83175f 100644
--- a/docs/cli/kops_toolbox.md
+++ b/docs/cli/kops_toolbox.md
@@ -45,7 +45,6 @@ Misc infrequently used commands.
 ### SEE ALSO
 
 * [kops](kops.md)	 - kops is Kubernetes ops.
-* [kops toolbox bundle](kops_toolbox_bundle.md)	 - Bundle cluster information
 * [kops toolbox convert-imported](kops_toolbox_convert-imported.md)	 - Convert an imported cluster into a kops cluster.
 * [kops toolbox dump](kops_toolbox_dump.md)	 - Dump cluster information
 * [kops toolbox template](kops_toolbox_template.md)	 - Generate cluster.yaml from template
diff --git a/docs/cli/kops_toolbox_bundle.md b/docs/cli/kops_toolbox_bundle.md
deleted file mode 100644
index 1dbd8e78cd..0000000000
--- a/docs/cli/kops_toolbox_bundle.md
+++ /dev/null
@@ -1,53 +0,0 @@
-
-<!--- This file is automatically generated by make gen-cli-docs; changes should be made in the go CLI command code (under cmd/kops) -->
-
-## kops toolbox bundle
-
-Bundle cluster information
-
-### Synopsis
-
-Creates a bundle for enrolling a bare metal machine.
-
-```
-kops toolbox bundle [flags]
-```
-
-### Examples
-
-```
-  # Bundle
-  kops toolbox bundle --name k8s-cluster.example.com
-```
-
-### Options
-
-```
-  -h, --help            help for bundle
-      --target string   machine to target (IP address)
-```
-
-### Options inherited from parent commands
-
-```
-      --add_dir_header                   If true, adds the file directory to the header
-      --alsologtostderr                  log to standard error as well as files
-      --config string                    yaml config file (default is $HOME/.kops.yaml)
-      --log_backtrace_at traceLocation   when logging hits line file:N, emit a stack trace (default :0)
-      --log_dir string                   If non-empty, write log files in this directory
-      --log_file string                  If non-empty, use this log file
-      --log_file_max_size uint           Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
-      --logtostderr                      log to standard error instead of files (default true)
-      --name string                      Name of cluster. Overrides KOPS_CLUSTER_NAME environment variable
-      --skip_headers                     If true, avoid header prefixes in the log messages
-      --skip_log_headers                 If true, avoid headers when opening log files
-      --state string                     Location of state storage (kops 'config' file). Overrides KOPS_STATE_STORE environment variable
-      --stderrthreshold severity         logs at or above this threshold go to stderr (default 2)
-  -v, --v Level                          number for the log level verbosity
-      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging
-```
-
-### SEE ALSO
-
-* [kops toolbox](kops_toolbox.md)	 - Misc infrequently used commands.
-
diff --git a/docs/releases/1.17-NOTES.md b/docs/releases/1.17-NOTES.md
index 4403e9b162..66d72397ed 100644
--- a/docs/releases/1.17-NOTES.md
+++ b/docs/releases/1.17-NOTES.md
@@ -75,8 +75,6 @@
 
 * Support for the "Legacy" etcd provider has been deprecated. It will not be supported for Kubernetes 1.18 or later. To migrate to the default "Manager" etcd provider see the [etcd migration documentation](../etcd3-migration.md).
 
-* The default StorageClass `gp2` prior to Kops 1.17.0 is no longer the default, replaced by StorageClass `kops-ssd-1-17`.
-
 # Known Issues
 
 * Kops 1.17.0-beta.1 included an update for AWS IAM Authenticator to 0.5.0.
@@ -85,11 +83,6 @@
   The workaround is to specify the old 0.4.0 image with `spec.authentication.aws.image=602401143452.dkr.ecr.us-west-2.amazonaws.com/amazon/aws-iam-authenticator:v0.4.0`.
   For the 1.17.0 release, this change was rolled back, and the AWS IAM authenticator defaults to version 0.4.0
 
-* Kops 1.17.0 includes a new StorageClass `kops-ssd-1-17` which is set as the default via the annotation `"storageclass.beta.kubernetes.io/is-default-class":"true"`.
-  If you have modified the previous `gp2` StorageClass, it could conflict with the defaulting behavior.
-  To resolve, patch the `gp2` StorageClass to have the annotation `"storageclass.beta.kubernetes.io/is-default-class":"false"`, which aligns with a patch to Kops 1.17.1 as well.
-  `kubectl patch storageclass.storage.k8s.io/gp2 --patch '{"metadata": {"annotations": {"storageclass.beta.kubernetes.io/is-default-class": "false"}}}'`
-
 # Full change list since 1.16.0 release
 
 ## 1.16.0-alpha.1 to 1.17.0-alpha.1
diff --git a/hack/.packages b/hack/.packages
index 26c7711abe..6cf3103e77 100644
--- a/hack/.packages
+++ b/hack/.packages
@@ -166,7 +166,6 @@ k8s.io/kops/upup/pkg/fi/cloudup/alitasks
 k8s.io/kops/upup/pkg/fi/cloudup/aliup
 k8s.io/kops/upup/pkg/fi/cloudup/awstasks
 k8s.io/kops/upup/pkg/fi/cloudup/awsup
-k8s.io/kops/upup/pkg/fi/cloudup/baremetal
 k8s.io/kops/upup/pkg/fi/cloudup/cloudformation
 k8s.io/kops/upup/pkg/fi/cloudup/dnstasks
 k8s.io/kops/upup/pkg/fi/cloudup/do
diff --git a/pkg/apis/kops/channel.go b/pkg/apis/kops/channel.go
index 88b87564d3..c1e82c88c5 100644
--- a/pkg/apis/kops/channel.go
+++ b/pkg/apis/kops/channel.go
@@ -247,7 +247,6 @@ type CloudProviderID string
 const (
 	CloudProviderALI       CloudProviderID = "alicloud"
 	CloudProviderAWS       CloudProviderID = "aws"
-	CloudProviderBareMetal CloudProviderID = "baremetal"
 	CloudProviderDO        CloudProviderID = "digitalocean"
 	CloudProviderGCE       CloudProviderID = "gce"
 	CloudProviderOpenstack CloudProviderID = "openstack"
diff --git a/pkg/apis/kops/validation/legacy.go b/pkg/apis/kops/validation/legacy.go
index c2610deaa6..6382a44df1 100644
--- a/pkg/apis/kops/validation/legacy.go
+++ b/pkg/apis/kops/validation/legacy.go
@@ -56,14 +56,6 @@ func ValidateCluster(c *kops.Cluster, strict bool) field.ErrorList {
 		requiresSubnetCIDR = false
 		requiresNetworkCIDR = false
 
-	case kops.CloudProviderBareMetal:
-		requiresSubnets = false
-		requiresSubnetCIDR = false
-		requiresNetworkCIDR = false
-		if c.Spec.NetworkCIDR != "" {
-			allErrs = append(allErrs, field.Forbidden(fieldSpec.Child("networkCIDR"), "networkCIDR should not be set on bare metal"))
-		}
-
 	case kops.CloudProviderGCE:
 		requiresNetworkCIDR = false
 		if c.Spec.NetworkCIDR != "" {
@@ -89,7 +81,6 @@ func ValidateCluster(c *kops.Cluster, strict bool) field.ErrorList {
 
 	default:
 		allErrs = append(allErrs, field.NotSupported(fieldSpec.Child("cloudProvider"), c.Spec.CloudProvider, []string{
-			string(kops.CloudProviderBareMetal),
 			string(kops.CloudProviderGCE),
 			string(kops.CloudProviderDO),
 			string(kops.CloudProviderALI),
@@ -301,8 +292,6 @@ func ValidateCluster(c *kops.Cluster, strict bool) field.ErrorList {
 			k8sCloudProvider = "gce"
 		case kops.CloudProviderDO:
 			k8sCloudProvider = "external"
-		case kops.CloudProviderBareMetal:
-			k8sCloudProvider = ""
 		case kops.CloudProviderOpenstack:
 			k8sCloudProvider = "openstack"
 		case kops.CloudProviderALI:
diff --git a/pkg/model/components/apiserver.go b/pkg/model/components/apiserver.go
index ae527ac2a1..74f7416f00 100644
--- a/pkg/model/components/apiserver.go
+++ b/pkg/model/components/apiserver.go
@@ -145,8 +145,6 @@ func (b *KubeAPIServerOptionsBuilder) BuildOptions(o interface{}) error {
 		c.CloudProvider = "gce"
 	case kops.CloudProviderDO:
 		c.CloudProvider = "external"
-	case kops.CloudProviderBareMetal:
-		// for baremetal, we don't specify a cloudprovider to apiserver
 	case kops.CloudProviderOpenstack:
 		c.CloudProvider = "openstack"
 	case kops.CloudProviderALI:
diff --git a/pkg/model/components/kubecontrollermanager.go b/pkg/model/components/kubecontrollermanager.go
index df0d248c8b..f418573751 100644
--- a/pkg/model/components/kubecontrollermanager.go
+++ b/pkg/model/components/kubecontrollermanager.go
@@ -92,9 +92,6 @@ func (b *KubeControllerManagerOptionsBuilder) BuildOptions(o interface{}) error
 	case kops.CloudProviderDO:
 		kcm.CloudProvider = "external"
 
-	case kops.CloudProviderBareMetal:
-		// No cloudprovider
-
 	case kops.CloudProviderOpenstack:
 		kcm.CloudProvider = "openstack"
 
diff --git a/pkg/model/master_volumes.go b/pkg/model/master_volumes.go
index b9bc1161c3..400d04e2d1 100644
--- a/pkg/model/master_volumes.go
+++ b/pkg/model/master_volumes.go
@@ -21,7 +21,6 @@ import (
 	"sort"
 	"strings"
 
-	"k8s.io/klog"
 	"k8s.io/kops/pkg/apis/kops"
 	"k8s.io/kops/pkg/apis/kops/model"
 	"k8s.io/kops/upup/pkg/fi"
@@ -101,8 +100,6 @@ func (b *MasterVolumeBuilder) Build(c *fi.ModelBuilderContext) error {
 				b.addDOVolume(c, name, volumeSize, zone, etcd, m, allMembers)
 			case kops.CloudProviderGCE:
 				b.addGCEVolume(c, name, volumeSize, zone, etcd, m, allMembers)
-			case kops.CloudProviderBareMetal:
-				klog.Fatalf("BareMetal not implemented")
 			case kops.CloudProviderOpenstack:
 				err = b.addOpenstackVolume(c, name, volumeSize, zone, etcd, m, allMembers)
 				if err != nil {
diff --git a/protokube/cmd/protokube/main.go b/protokube/cmd/protokube/main.go
index e4f9254c53..631ea9c314 100644
--- a/protokube/cmd/protokube/main.go
+++ b/protokube/cmd/protokube/main.go
@@ -176,15 +176,6 @@ func run() error {
 		if internalIP == nil {
 			internalIP = gceVolumes.InternalIP()
 		}
-	} else if cloud == "baremetal" {
-		if internalIP == nil {
-			ip, err := findInternalIP()
-			if err != nil {
-				klog.Errorf("error finding internal IP: %v", err)
-				os.Exit(1)
-			}
-			internalIP = ip
-		}
 	} else if cloud == "openstack" {
 		klog.Info("Initializing openstack volumes")
 		osVolumes, err := protokube.NewOpenstackVolumes()
@@ -437,87 +428,3 @@ func run() error {
 
 	return fmt.Errorf("Unexpected exit")
 }
-
-// findInternalIP attempts to discover the internal IP address by inspecting the network interfaces
-func findInternalIP() (net.IP, error) {
-	var ips []net.IP
-
-	networkInterfaces, err := net.Interfaces()
-	if err != nil {
-		return nil, fmt.Errorf("error querying interfaces to determine internal ip: %v", err)
-	}
-
-	for i := range networkInterfaces {
-		networkInterface := &networkInterfaces[i]
-		flags := networkInterface.Flags
-		name := networkInterface.Name
-
-		if (flags & net.FlagLoopback) != 0 {
-			klog.V(2).Infof("Ignoring interface %s - loopback", name)
-			continue
-		}
-
-		// Not a lot else to go on...
-		if !strings.HasPrefix(name, "eth") && !strings.HasPrefix(name, "en") {
-			klog.V(2).Infof("Ignoring interface %s - name does not look like ethernet device", name)
-			continue
-		}
-
-		addrs, err := networkInterface.Addrs()
-		if err != nil {
-			return nil, fmt.Errorf("error querying network interface %s for IP addresses: %v", name, err)
-		}
-
-		for _, addr := range addrs {
-			ip, _, err := net.ParseCIDR(addr.String())
-			if err != nil {
-				return nil, fmt.Errorf("error parsing address %s on network interface %s: %v", addr.String(), name, err)
-			}
-
-			if ip.IsLoopback() {
-				klog.V(2).Infof("Ignoring address %s (loopback)", ip)
-				continue
-			}
-
-			if ip.IsLinkLocalMulticast() || ip.IsLinkLocalUnicast() {
-				klog.V(2).Infof("Ignoring address %s (link-local)", ip)
-				continue
-			}
-
-			ips = append(ips, ip)
-		}
-	}
-
-	if len(ips) == 0 {
-		return nil, fmt.Errorf("unable to determine internal ip (no addresses found)")
-	}
-
-	if len(ips) == 1 {
-		return ips[0], nil
-	}
-
-	var ipv4s []net.IP
-	for _, ip := range ips {
-		if ip.To4() != nil {
-			ipv4s = append(ipv4s, ip)
-		}
-	}
-
-	klog.Warningf("Found multiple internal IPs")
-	for _, ip := range ips {
-		klog.Warningf("\tip: %s", ip.String())
-	}
-
-	if len(ipv4s) != 0 {
-		// TODO: sort?
-		if len(ipv4s) == 1 {
-			klog.Warningf("choosing IPv4 address: %s", ipv4s[0].String())
-		} else {
-			klog.Warningf("arbitrarily choosing IPv4 address: %s", ipv4s[0].String())
-		}
-		return ipv4s[0], nil
-	}
-
-	klog.Warningf("arbitrarily choosing address: %s", ips[0].String())
-	return ips[0], nil
-}
diff --git a/protokube/pkg/protokube/BUILD.bazel b/protokube/pkg/protokube/BUILD.bazel
index 4aeb82cbeb..f3559b94dc 100644
--- a/protokube/pkg/protokube/BUILD.bazel
+++ b/protokube/pkg/protokube/BUILD.bazel
@@ -5,7 +5,6 @@ go_library(
     srcs = [
         "ali_volume.go",
         "aws_volume.go",
-        "baremetal_volume.go",
         "channels.go",
         "do_volume.go",
         "etcd_cluster.go",
diff --git a/protokube/pkg/protokube/baremetal_volume.go b/protokube/pkg/protokube/baremetal_volume.go
deleted file mode 100644
index d9eff61a38..0000000000
--- a/protokube/pkg/protokube/baremetal_volume.go
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-Copyright 2019 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package protokube
-
-// Ideas:
-// * Scan for well known metadata file under /mnt e.g. /mnt/*/.k8s.io.volume
-// * Use a file lock to enforce single-mounter, for things like NFS.  We could do this everywhere.
diff --git a/upup/models/bindata.go b/upup/models/bindata.go
index 17709174a7..4cc8d987d2 100644
--- a/upup/models/bindata.go
+++ b/upup/models/bindata.go
@@ -15604,8 +15604,6 @@ apiVersion: storage.k8s.io/v1
 kind: StorageClass
 metadata:
   name: gp2
-  annotations:
-    storageclass.beta.kubernetes.io/is-default-class: "false"
   labels:
     k8s-addon: storage-aws.addons.k8s.io
 provisioner: kubernetes.io/aws-ebs
diff --git a/upup/models/cloudup/resources/addons/storage-aws.addons.k8s.io/v1.15.0.yaml b/upup/models/cloudup/resources/addons/storage-aws.addons.k8s.io/v1.15.0.yaml
index 68386b89ab..48838ec17a 100644
--- a/upup/models/cloudup/resources/addons/storage-aws.addons.k8s.io/v1.15.0.yaml
+++ b/upup/models/cloudup/resources/addons/storage-aws.addons.k8s.io/v1.15.0.yaml
@@ -14,8 +14,6 @@ apiVersion: storage.k8s.io/v1
 kind: StorageClass
 metadata:
   name: gp2
-  annotations:
-    storageclass.beta.kubernetes.io/is-default-class: "false"
   labels:
     k8s-addon: storage-aws.addons.k8s.io
 provisioner: kubernetes.io/aws-ebs
diff --git a/upup/pkg/fi/cloudup/BUILD.bazel b/upup/pkg/fi/cloudup/BUILD.bazel
index 69b57400e5..f744c994c3 100644
--- a/upup/pkg/fi/cloudup/BUILD.bazel
+++ b/upup/pkg/fi/cloudup/BUILD.bazel
@@ -63,7 +63,6 @@ go_library(
         "//upup/pkg/fi/cloudup/aliup:go_default_library",
         "//upup/pkg/fi/cloudup/awstasks:go_default_library",
         "//upup/pkg/fi/cloudup/awsup:go_default_library",
-        "//upup/pkg/fi/cloudup/baremetal:go_default_library",
         "//upup/pkg/fi/cloudup/cloudformation:go_default_library",
         "//upup/pkg/fi/cloudup/do:go_default_library",
         "//upup/pkg/fi/cloudup/dotasks:go_default_library",
diff --git a/upup/pkg/fi/cloudup/apply_cluster.go b/upup/pkg/fi/cloudup/apply_cluster.go
index 5133b964e8..1b080964fd 100644
--- a/upup/pkg/fi/cloudup/apply_cluster.go
+++ b/upup/pkg/fi/cloudup/apply_cluster.go
@@ -56,7 +56,6 @@ import (
 	"k8s.io/kops/upup/pkg/fi/cloudup/aliup"
 	"k8s.io/kops/upup/pkg/fi/cloudup/awstasks"
 	"k8s.io/kops/upup/pkg/fi/cloudup/awsup"
-	"k8s.io/kops/upup/pkg/fi/cloudup/baremetal"
 	"k8s.io/kops/upup/pkg/fi/cloudup/cloudformation"
 	"k8s.io/kops/upup/pkg/fi/cloudup/do"
 	"k8s.io/kops/upup/pkg/fi/cloudup/dotasks"
@@ -76,8 +75,6 @@ const (
 )
 
 var (
-	// AlphaAllowBareMetal is a feature flag that gates BareMetal support while it is alpha
-	AlphaAllowBareMetal = featureflag.New("AlphaAllowBareMetal", featureflag.Bool(false))
 	// AlphaAllowDO is a feature flag that gates DigitalOcean support while it is alpha
 	AlphaAllowDO = featureflag.New("AlphaAllowDO", featureflag.Bool(false))
 	// AlphaAllowGCE is a feature flag that gates GCE support while it is alpha
@@ -483,15 +480,6 @@ func (c *ApplyClusterCmd) Run(ctx context.Context) error {
 			}
 		}
 
-	case kops.CloudProviderBareMetal:
-		{
-			if !AlphaAllowBareMetal.Enabled() {
-				return fmt.Errorf("BareMetal support is currently (very) alpha and is feature-gated. export KOPS_FEATURE_FLAGS=AlphaAllowBareMetal to enable it")
-			}
-
-			// No additional tasks (yet)
-		}
-
 	case kops.CloudProviderOpenstack:
 		{
 
@@ -667,9 +655,6 @@ func (c *ApplyClusterCmd) Run(ctx context.Context) error {
 					&alimodel.ExternalAccessModelBuilder{ALIModelContext: aliModelContext, Lifecycle: &clusterLifecycle},
 				)
 
-			case kops.CloudProviderBareMetal:
-				// No special settings (yet!)
-
 			case kops.CloudProviderOpenstack:
 				openstackModelContext := &openstackmodel.OpenstackModelContext{
 					KopsModelContext: modelContext,
@@ -771,9 +756,6 @@ func (c *ApplyClusterCmd) Run(ctx context.Context) error {
 			})
 		}
 
-	case kops.CloudProviderBareMetal:
-		// BareMetal tasks will go here
-
 	case kops.CloudProviderOpenstack:
 		openstackModelContext := &openstackmodel.OpenstackModelContext{
 			KopsModelContext: modelContext,
@@ -816,8 +798,6 @@ func (c *ApplyClusterCmd) Run(ctx context.Context) error {
 			target = awsup.NewAWSAPITarget(cloud.(awsup.AWSCloud))
 		case kops.CloudProviderDO:
 			target = do.NewDOAPITarget(cloud.(*digitalocean.Cloud))
-		case kops.CloudProviderBareMetal:
-			target = baremetal.NewTarget(cloud.(*baremetal.Cloud))
 		case kops.CloudProviderOpenstack:
 			target = openstack.NewOpenstackAPITarget(cloud.(openstack.OpenstackCloud))
 		case kops.CloudProviderALI:
diff --git a/upup/pkg/fi/cloudup/baremetal/BUILD.bazel b/upup/pkg/fi/cloudup/baremetal/BUILD.bazel
deleted file mode 100644
index 4d0189d893..0000000000
--- a/upup/pkg/fi/cloudup/baremetal/BUILD.bazel
+++ /dev/null
@@ -1,19 +0,0 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_library")
-
-go_library(
-    name = "go_default_library",
-    srcs = [
-        "cloud.go",
-        "target.go",
-    ],
-    importpath = "k8s.io/kops/upup/pkg/fi/cloudup/baremetal",
-    visibility = ["//visibility:public"],
-    deps = [
-        "//dnsprovider/pkg/dnsprovider:go_default_library",
-        "//pkg/apis/kops:go_default_library",
-        "//pkg/cloudinstances:go_default_library",
-        "//upup/pkg/fi:go_default_library",
-        "//vendor/k8s.io/api/core/v1:go_default_library",
-        "//vendor/k8s.io/klog:go_default_library",
-    ],
-)
diff --git a/upup/pkg/fi/cloudup/baremetal/cloud.go b/upup/pkg/fi/cloudup/baremetal/cloud.go
deleted file mode 100644
index 820816c63e..0000000000
--- a/upup/pkg/fi/cloudup/baremetal/cloud.go
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-Copyright 2019 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package baremetal
-
-import (
-	"fmt"
-
-	"k8s.io/klog"
-
-	v1 "k8s.io/api/core/v1"
-	"k8s.io/kops/dnsprovider/pkg/dnsprovider"
-	"k8s.io/kops/pkg/apis/kops"
-	"k8s.io/kops/pkg/cloudinstances"
-	"k8s.io/kops/upup/pkg/fi"
-)
-
-type Cloud struct {
-	dns dnsprovider.Interface
-}
-
-var _ fi.Cloud = &Cloud{}
-
-func NewCloud(dns dnsprovider.Interface) (*Cloud, error) {
-	return &Cloud{dns: dns}, nil
-}
-
-func (c *Cloud) ProviderID() kops.CloudProviderID {
-	return kops.CloudProviderBareMetal
-}
-
-func (c *Cloud) Region() string {
-	return ""
-}
-
-func (c *Cloud) DNS() (dnsprovider.Interface, error) {
-	return c.dns, nil
-}
-
-func (c *Cloud) FindVPCInfo(id string) (*fi.VPCInfo, error) {
-	return nil, fmt.Errorf("baremetal FindVPCInfo not supported")
-}
-
-// GetCloudGroups is not implemented yet, that needs to return the instances and groups that back a kops cluster.
-// Baremetal may not support this.
-func (c *Cloud) GetCloudGroups(cluster *kops.Cluster, instancegroups []*kops.InstanceGroup, warnUnmatched bool, nodes []v1.Node) (map[string]*cloudinstances.CloudInstanceGroup, error) {
-	klog.V(8).Infof("baremetal cloud GetCloudGroups not implemented yet")
-	return nil, fmt.Errorf("baremetal provider does not support getting cloud groups at this time")
-}
-
-// DeleteGroup is not implemented yet, is a func that needs to delete a DO instance group.
-// Baremetal may not support this.
-func (c *Cloud) DeleteGroup(g *cloudinstances.CloudInstanceGroup) error {
-	klog.V(8).Infof("baremetal cloud provider DeleteGroup not implemented yet")
-	return fmt.Errorf("baremetal cloud provider does not support deleting cloud groups at this time")
-}
-
-// DetachInstance is not implemented yet. It needs to cause a cloud instance to no longer be counted against the group's size limits.
-// Baremetal may not support this.
-func (c *Cloud) DetachInstance(i *cloudinstances.CloudInstanceGroupMember) error {
-	klog.V(8).Infof("baremetal cloud provider DetachInstance not implemented")
-	return fmt.Errorf("baremetal cloud provider does not support surging")
-}
-
-//DeleteInstance is not implemented yet, is func needs to delete a DO instance.
-//Baremetal may not support this.
-func (c *Cloud) DeleteInstance(instance *cloudinstances.CloudInstanceGroupMember) error {
-	klog.V(8).Infof("baremetal cloud provider DeleteInstance not implemented yet")
-	return fmt.Errorf("baremetal cloud provider does not support deleting cloud instances at this time")
-}
diff --git a/upup/pkg/fi/cloudup/baremetal/target.go b/upup/pkg/fi/cloudup/baremetal/target.go
deleted file mode 100644
index 6842f09960..0000000000
--- a/upup/pkg/fi/cloudup/baremetal/target.go
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-Copyright 2019 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package baremetal
-
-import (
-	"k8s.io/kops/upup/pkg/fi"
-)
-
-type Target struct {
-	cloud *Cloud
-}
-
-var _ fi.Target = &Target{}
-
-func NewTarget(cloud *Cloud) *Target {
-	return &Target{cloud: cloud}
-}
-
-func (t *Target) Finish(taskMap map[string]fi.Task) error {
-	return nil
-}
-
-func (t *Target) ProcessDeletions() bool {
-	return true
-}
diff --git a/upup/pkg/fi/cloudup/tagbuilder.go b/upup/pkg/fi/cloudup/tagbuilder.go
index bdb61aaa64..1dedb012d5 100644
--- a/upup/pkg/fi/cloudup/tagbuilder.go
+++ b/upup/pkg/fi/cloudup/tagbuilder.go
@@ -50,9 +50,6 @@ func buildCloudupTags(cluster *api.Cluster) (sets.String, error) {
 			tags.Insert("_do")
 		}
 
-	case api.CloudProviderBareMetal:
-		// No tags
-
 	case api.CloudProviderOpenstack:
 
 	case api.CloudProviderALI:
diff --git a/upup/pkg/fi/cloudup/utils.go b/upup/pkg/fi/cloudup/utils.go
index ece4fec066..ac4d9e8314 100644
--- a/upup/pkg/fi/cloudup/utils.go
+++ b/upup/pkg/fi/cloudup/utils.go
@@ -27,7 +27,6 @@ import (
 	"k8s.io/kops/upup/pkg/fi"
 	"k8s.io/kops/upup/pkg/fi/cloudup/aliup"
 	"k8s.io/kops/upup/pkg/fi/cloudup/awsup"
-	"k8s.io/kops/upup/pkg/fi/cloudup/baremetal"
 	"k8s.io/kops/upup/pkg/fi/cloudup/do"
 	"k8s.io/kops/upup/pkg/fi/cloudup/gce"
 	"k8s.io/kops/upup/pkg/fi/cloudup/openstack"
@@ -109,20 +108,6 @@ func BuildCloud(cluster *kops.Cluster) (fi.Cloud, error) {
 			cloud = doCloud
 		}
 
-	case kops.CloudProviderBareMetal:
-		{
-			// TODO: Allow dns provider to be specified
-			dns, err := dnsprovider.GetDnsProvider(route53.ProviderName, nil)
-			if err != nil {
-				return nil, fmt.Errorf("Error building (k8s) DNS provider: %v", err)
-			}
-
-			baremetalCloud, err := baremetal.NewCloud(dns)
-			if err != nil {
-				return nil, err
-			}
-			cloud = baremetalCloud
-		}
 	case kops.CloudProviderOpenstack:
 		{
 			cloudTags := map[string]string{openstack.TagClusterName: cluster.ObjectMeta.Name}


Test patch:
diff --git a/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/amazonvpc/manifest.yaml b/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/amazonvpc/manifest.yaml
index 403ee9a0d0..d3205a5e60 100644
--- a/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/amazonvpc/manifest.yaml
+++ b/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/amazonvpc/manifest.yaml
@@ -73,7 +73,7 @@ spec:
   - id: v1.15.0
     kubernetesVersion: '>=1.15.0'
     manifest: storage-aws.addons.k8s.io/v1.15.0.yaml
-    manifestHash: 00cf6e46e25b736b2da93c6025ce482474d83904
+    manifestHash: 5e829e8981470696bef2ed5e96839ea83cb36d24
     name: storage-aws.addons.k8s.io
     selector:
       k8s-addon: storage-aws.addons.k8s.io
diff --git a/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/cilium/manifest.yaml b/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/cilium/manifest.yaml
index 03fb5e0ddf..6deef0ca25 100644
--- a/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/cilium/manifest.yaml
+++ b/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/cilium/manifest.yaml
@@ -73,7 +73,7 @@ spec:
   - id: v1.15.0
     kubernetesVersion: '>=1.15.0'
     manifest: storage-aws.addons.k8s.io/v1.15.0.yaml
-    manifestHash: 00cf6e46e25b736b2da93c6025ce482474d83904
+    manifestHash: 5e829e8981470696bef2ed5e96839ea83cb36d24
     name: storage-aws.addons.k8s.io
     selector:
       k8s-addon: storage-aws.addons.k8s.io
diff --git a/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/simple/manifest.yaml b/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/simple/manifest.yaml
index 8a07c8d5ff..a6e8975649 100644
--- a/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/simple/manifest.yaml
+++ b/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/simple/manifest.yaml
@@ -73,7 +73,7 @@ spec:
   - id: v1.15.0
     kubernetesVersion: '>=1.15.0'
     manifest: storage-aws.addons.k8s.io/v1.15.0.yaml
-    manifestHash: 00cf6e46e25b736b2da93c6025ce482474d83904
+    manifestHash: 5e829e8981470696bef2ed5e96839ea83cb36d24
     name: storage-aws.addons.k8s.io
     selector:
       k8s-addon: storage-aws.addons.k8s.io
diff --git a/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/weave/manifest.yaml b/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/weave/manifest.yaml
index 6d852452ab..ffe7b56594 100644
--- a/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/weave/manifest.yaml
+++ b/upup/pkg/fi/cloudup/tests/bootstrapchannelbuilder/weave/manifest.yaml
@@ -73,7 +73,7 @@ spec:
   - id: v1.15.0
     kubernetesVersion: '>=1.15.0'
     manifest: storage-aws.addons.k8s.io/v1.15.0.yaml
-    manifestHash: 00cf6e46e25b736b2da93c6025ce482474d83904
+    manifestHash: 5e829e8981470696bef2ed5e96839ea83cb36d24
     name: storage-aws.addons.k8s.io
     selector:
       k8s-addon: storage-aws.addons.k8s.io