Skip to content

Commit

Permalink
remove all localkube references from code, change /var/lib/localkube …
Browse files Browse the repository at this point in the history
…to /var/lib/minikube
  • Loading branch information
aaron-prindle authored and dlorenc committed Jul 24, 2018
1 parent 236a86f commit a460658
Show file tree
Hide file tree
Showing 25 changed files with 44 additions and 646 deletions.
8 changes: 3 additions & 5 deletions Makefile
Expand Up @@ -48,14 +48,12 @@ REPOPATH ?= $(ORG)/minikube
PYTHON := $(shell command -v python || echo "docker run --rm -it -v $(shell pwd):/minikube -w /minikube python python")
BUILD_OS := $(shell uname -s)

LOCALKUBE_VERSION := $(shell $(PYTHON) hack/get_k8s_version.py --k8s-version-only 2>&1)
TAG ?= $(LOCALKUBE_VERSION)
STORAGE_PROVISIONER_TAG := v1.8.1

# Set the version information for the Kubernetes servers, and build localkube statically
# Set the version information for the Kubernetes servers
K8S_VERSION_LDFLAGS := $(shell $(PYTHON) hack/get_k8s_version.py 2>&1)
MINIKUBE_LDFLAGS := -X k8s.io/minikube/pkg/version.version=$(VERSION) -X k8s.io/minikube/pkg/version.isoVersion=$(ISO_VERSION) -X k8s.io/minikube/pkg/version.isoPath=$(ISO_BUCKET)
LOCALKUBE_LDFLAGS := "$(K8S_VERSION_LDFLAGS) $(MINIKUBE_LDFLAGS) -s -w"
PROVISIONER_LDFLAGS := "$(K8S_VERSION_LDFLAGS) $(MINIKUBE_LDFLAGS) -s -w"

MAKEDEPEND := GOPATH=$(GOPATH) ./makedepend.sh

Expand Down Expand Up @@ -292,7 +290,7 @@ out/storage-provisioner.d:

-include out/storage-provisioner.d
out/storage-provisioner:
GOOS=linux go build -o $(BUILD_DIR)/storage-provisioner -ldflags=$(LOCALKUBE_LDFLAGS) cmd/storage-provisioner/main.go
GOOS=linux go build -o $(BUILD_DIR)/storage-provisioner -ldflags=$(PROVISIONER_LDFLAGS) cmd/storage-provisioner/main.go

.PHONY: storage-provisioner-image
storage-provisioner-image: out/storage-provisioner
Expand Down
38 changes: 0 additions & 38 deletions cmd/minikube/cmd/get_kubernetes_versions.go

This file was deleted.

7 changes: 3 additions & 4 deletions cmd/minikube/cmd/start.go
Expand Up @@ -393,13 +393,12 @@ func init() {
startCmd.Flags().String(NFSSharesRoot, "/nfsshares", "Where to root the NFS Shares (defaults to /nfsshares, only supported with hyperkit now)")
startCmd.Flags().StringArrayVar(&dockerEnv, "docker-env", nil, "Environment variables to pass to the Docker daemon. (format: key=value)")
startCmd.Flags().StringArrayVar(&dockerOpt, "docker-opt", nil, "Specify arbitrary flags to pass to the Docker daemon. (format: key=value)")
startCmd.Flags().String(apiServerName, constants.APIServerName, "The apiserver name which is used in the generated certificate for localkube/kubernetes. This can be used if you want to make the apiserver available from outside the machine")
startCmd.Flags().StringArrayVar(&apiServerNames, "apiserver-names", nil, "A set of apiserver names which are used in the generated certificate for localkube/kubernetes. This can be used if you want to make the apiserver available from outside the machine")
startCmd.Flags().IPSliceVar(&apiServerIPs, "apiserver-ips", nil, "A set of apiserver IP Addresses which are used in the generated certificate for localkube/kubernetes. This can be used if you want to make the apiserver available from outside the machine")
startCmd.Flags().String(apiServerName, constants.APIServerName, "The apiserver name which is used in the generated certificate for kubernetes. This can be used if you want to make the apiserver available from outside the machine")
startCmd.Flags().StringArrayVar(&apiServerNames, "apiserver-names", nil, "A set of apiserver names which are used in the generated certificate for kubernetes. This can be used if you want to make the apiserver available from outside the machine")
startCmd.Flags().IPSliceVar(&apiServerIPs, "apiserver-ips", nil, "A set of apiserver IP Addresses which are used in the generated certificate for kubernetes. This can be used if you want to make the apiserver available from outside the machine")
startCmd.Flags().String(dnsDomain, constants.ClusterDNSDomain, "The cluster dns domain name used in the kubernetes cluster")
startCmd.Flags().StringSliceVar(&insecureRegistry, "insecure-registry", nil, "Insecure Docker registries to pass to the Docker daemon. The default service CIDR range will automatically be added.")
startCmd.Flags().StringSliceVar(&registryMirror, "registry-mirror", nil, "Registry mirrors to pass to the Docker daemon")
startCmd.Flags().String(kubernetesVersion, constants.DefaultKubernetesVersion, "The kubernetes version that the minikube VM will use (ex: v1.2.3) \n OR a URI which contains a localkube binary (ex: https://storage.googleapis.com/minikube/k8sReleases/v1.3.0/localkube-linux-amd64)")
startCmd.Flags().String(containerRuntime, "", "The container runtime to be used")
startCmd.Flags().String(networkPlugin, "", "The name of the network plugin")
startCmd.Flags().String(featureGates, "", "A set of key=value pairs that describe feature gates for alpha/experimental features.")
Expand Down
6 changes: 3 additions & 3 deletions deploy/addons/addon-manager.yaml
Expand Up @@ -28,7 +28,7 @@ spec:
image: k8s.gcr.io/kube-addon-manager:v8.6
env:
- name: KUBECONFIG
value: /var/lib/localkube/kubeconfig
value: /var/lib/minikube/kubeconfig
imagePullPolicy: IfNotPresent
resources:
requests:
Expand All @@ -38,13 +38,13 @@ spec:
- mountPath: /etc/kubernetes/
name: addons
readOnly: true
- mountPath: /var/lib/localkube/
- mountPath: /var/lib/minikube/
name: kubeconfig
readOnly: true
volumes:
- hostPath:
path: /etc/kubernetes/
name: addons
- hostPath:
path: /var/lib/localkube/
path: /var/lib/minikube/
name: kubeconfig
6 changes: 3 additions & 3 deletions deploy/iso/minikube-iso/package/automount/minikube-automount
Expand Up @@ -178,9 +178,9 @@ if [ -n "$BOOT2DOCKER_DATA" ]; then
chown -R docker:docker /home/docker/.ssh
rm -f '/home/docker/boot2docker, please format-me'

mkdir -p /mnt/$PARTNAME/var/lib/localkube
mkdir /var/lib/localkube
mount --bind /mnt/$PARTNAME/var/lib/localkube /var/lib/localkube
mkdir -p /mnt/$PARTNAME/var/lib/minikube
mkdir /var/lib/minikube
mount --bind /mnt/$PARTNAME/var/lib/minikube /var/lib/minikube

mkdir -p /mnt/$PARTNAME/var/lib/minishift
mkdir /var/lib/minishift
Expand Down
32 changes: 0 additions & 32 deletions deploy/minikube/release_sanity_test.go
Expand Up @@ -27,7 +27,6 @@ import (
"testing"

"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/kubernetes_versions"
"k8s.io/minikube/pkg/minikube/notify"
"k8s.io/minikube/pkg/util"
)
Expand Down Expand Up @@ -70,34 +69,3 @@ func TestReleasesJson(t *testing.T) {
}
}
}

func TestK8sReleases(t *testing.T) {
releases, err := kubernetes_versions.GetK8sVersionsFromURL(constants.KubernetesVersionGCSURL)
if err != nil {
t.Fatalf("Error getting k8s_releases.json: %s", err)
}

for _, r := range releases {
fmt.Printf("Checking release: %s\n", r.Version)
url, err := util.GetLocalkubeDownloadURL(r.Version, constants.LocalkubeLinuxFilename)
if err != nil {
t.Errorf("Error getting URL for %s. Error: %s", r.Version, err)
continue
}
shaURL := fmt.Sprintf("%s%s", url, constants.ShaSuffix)
expectedSha, err := util.ParseSHAFromURL(shaURL)
if err != nil {
t.Errorf("Error retrieving SHA for %s. Error: %s", r.Version, err)
continue
}
actualSha, err := getShaFromURL(url)
if err != nil {
t.Errorf("Error calculating SHA for %s. Error: %s", r.Version, err)
continue
}
if expectedSha != actualSha {
t.Errorf("ERROR: SHA does not match for version %s. Expected %s, got %s.", r.Version, expectedSha, actualSha)
continue
}
}
}
75 changes: 0 additions & 75 deletions hack/jenkins/linux_integration_tests_container.sh

This file was deleted.

4 changes: 0 additions & 4 deletions hack/jenkins/print-debug-info.sh
Expand Up @@ -26,10 +26,6 @@ ${SUDO_PREFIX} cat $KUBECONFIG
kubectl get pods --all-namespaces
kubectl cluster-info dump

# For the none driver
journalctl -u localkube -n 500
${SUDO_PREFIX}cat $KUBECONFIG

cat $HOME/.kube/config
echo $PATH

Expand Down
2 changes: 0 additions & 2 deletions hack/jenkins/release_github_page.sh
Expand Up @@ -120,8 +120,6 @@ FILES_TO_UPLOAD=(
"minikube_${DEB_VERSION}.deb"
'docker-machine-driver-kvm2'
'docker-machine-driver-hyperkit'
'localkube'
'localkube.sha256'
)

for UPLOAD in "${FILES_TO_UPLOAD[@]}"
Expand Down
44 changes: 15 additions & 29 deletions pkg/drivers/none/none.go
Expand Up @@ -29,15 +29,14 @@ import (
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/util/net"
pkgdrivers "k8s.io/minikube/pkg/drivers"
"k8s.io/minikube/pkg/minikube/constants"
)

const driverName = "none"
const dockerstopcmd = `docker kill $(docker ps -a --filter="name=k8s_" --format="{{.ID}}")`

var dockerkillcmd = fmt.Sprintf(`docker rm $(%s)`, dockerstopcmd)

// none Driver is a driver designed to run localkube w/o a VM
// none Driver is a driver designed to run kubeadm w/o a VM
type Driver struct {
*drivers.BaseDriver
*pkgdrivers.CommonDriver
Expand Down Expand Up @@ -101,16 +100,8 @@ func (d *Driver) GetURL() (string, error) {
}

func (d *Driver) GetState() (state.State, error) {
var statuscmd = fmt.Sprintf("if [[ `systemctl` =~ -\\.mount ]] &>/dev/null; "+`then
sudo systemctl is-active kubelet localkube &>/dev/null && echo "Running" || echo "Stopped"
else
if ps $(cat %s) &>/dev/null; then
echo "Running"
else
echo "Stopped"
fi
fi
`, constants.LocalkubePIDPath)
var statuscmd = fmt.Sprintf(
`sudo systemctl is-active kubelet &>/dev/null && echo "Running" || echo "Stopped"`)

out, err := runCommand(statuscmd, true)
if err != nil {
Expand All @@ -122,14 +113,14 @@ fi
} else if state.Stopped.String() == s {
return state.Stopped, nil
} else {
return state.None, fmt.Errorf("Error: Unrecognize output from GetLocalkubeStatus: %s", s)
return state.None, fmt.Errorf("Error: Unrecognize output from GetState: %s", s)
}
}

func (d *Driver) Kill() error {
for _, cmdStr := range [][]string{
{"systemctl", "stop", "localkube.service"},
{"rm", "-rf", "/var/lib/localkube"},
{"systemctl", "stop", "kubelet.service"},
{"rm", "-rf", "/var/lib/minikube"},
} {
cmd := exec.Command("sudo", cmdStr...)
if out, err := cmd.CombinedOutput(); err != nil {
Expand All @@ -140,12 +131,10 @@ func (d *Driver) Kill() error {
}

func (d *Driver) Remove() error {
rmCmd := `for svc in "localkube" "kubelet"; do
sudo systemctl stop "$svc".service
done
rmCmd := `sudo systemctl stop kubelet.service
sudo rm -rf /data/minikube
sudo rm -rf /etc/kubernetes/manifests
sudo rm -rf /var/lib/localkube || true`
sudo rm -rf /var/lib/minikube || true`

for _, cmdStr := range []string{rmCmd, dockerkillcmd} {
if out, err := runCommand(cmdStr, true); err != nil {
Expand All @@ -157,11 +146,10 @@ func (d *Driver) Remove() error {
}

func (d *Driver) Restart() error {
restartCmd := `for svc in "localkube" "kubelet"; do
if systemctl is-active $svc.service; then
sudo systemctl restart "$svc".service
fi
done`
restartCmd := `
if systemctl is-active kubelet.service; then
sudo systemctl restart kubelet.service
fi`

cmd := exec.Command(restartCmd)
if err := cmd.Start(); err != nil {
Expand All @@ -184,14 +172,12 @@ func (d *Driver) Start() error {
}

func (d *Driver) Stop() error {
var stopcmd = fmt.Sprintf("if [[ `systemctl` =~ -\\.mount ]] &>/dev/null; "+`then
for svc in "localkube" "kubelet"; do
var stopcmd = fmt.Sprintf("if [[ `systemctl` =~ -\\.mount ]] &>/dev/null; " + `then
for svc in "kubelet"; do
sudo systemctl stop "$svc".service || true
done
else
sudo kill $(cat %s)
fi
`, constants.LocalkubePIDPath)
`)
_, err := runCommand(stopcmd, false)
if err != nil {
return err
Expand Down
5 changes: 1 addition & 4 deletions pkg/minikube/bootstrapper/bootstrapper.go
Expand Up @@ -34,14 +34,11 @@ type Bootstrapper interface {
}

const (
BootstrapperTypeLocalkube = "localkube"
BootstrapperTypeKubeadm = "kubeadm"
BootstrapperTypeKubeadm = "kubeadm"
)

func GetCachedImageList(version string, bootstrapper string) []string {
switch bootstrapper {
case BootstrapperTypeLocalkube:
return constants.LocalkubeCachedImages
case BootstrapperTypeKubeadm:
return constants.GetKubeadmCachedImages(version)
default:
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/bootstrapper/certs.go
Expand Up @@ -82,7 +82,7 @@ func SetupCerts(cmd CommandRunner, k8s config.KubernetesConfig) error {
}

kubeCfgFile := assets.NewMemoryAsset(data,
util.DefaultLocalkubeDirectory, "kubeconfig", "0644")
util.DefaultMinikubeDirectory, "kubeconfig", "0644")
copyableFiles = append(copyableFiles, kubeCfgFile)

for _, f := range copyableFiles {
Expand Down
1 change: 0 additions & 1 deletion pkg/minikube/bootstrapper/kubeadm/kubeadm.go
Expand Up @@ -142,7 +142,6 @@ func (k *KubeadmBootstrapper) StartCluster(k8s config.KubernetesConfig) error {
return nil
}

//TODO(r2d4): Split out into shared function between localkube and kubeadm
func addAddons(files *[]assets.CopyableFile) error {
// add addons to file list
// custom addons
Expand Down

0 comments on commit a460658

Please sign in to comment.