diff --git a/Makefile b/Makefile index dab6533fbd51..ef76a4ab058a 100755 --- a/Makefile +++ b/Makefile @@ -300,6 +300,16 @@ $(ISO_BUILD_IMAGE): deploy/iso/minikube-iso/Dockerfile @echo "" @echo "$(@) successfully built" +out/storage-provisioner-main: cmd/storage-provisioner/main.go + go build cmd/storage-provisioner/main.go + +.PHONY: storage-provisioner-image +storage-provisioner-image: out/storage-provisioner-main + docker build -t $(REGISTRY)/storage-provisioner:$(TAG) -f deploy/storage-provisioner/Dockerfile . + gcloud docker -- push $(REGISTRY)/storage-provisioner:$(TAG) + # docker build -t gcr.io/priya-wadhwa/storage-provisioner:$(TAG) -f deploy/storage-provisioner/Dockerfile . + # gcloud docker -- push gcr.io/priya-wadhwa/storage-provisioner:$(TAG) + .PHONY: release-iso release-iso: minikube_iso checksum gsutil cp out/minikube.iso gs://$(ISO_BUCKET)/minikube-$(ISO_VERSION).iso diff --git a/cmd/storage-provisioner/main.go b/cmd/storage-provisioner/main.go new file mode 100644 index 000000000000..9ee043583bee --- /dev/null +++ b/cmd/storage-provisioner/main.go @@ -0,0 +1,19 @@ +package main + +import ( + "k8s.io/minikube/cmd/localkube/cmd" + "sync" +) + +func main() { + localkubeServer := cmd.NewLocalkubeServer() + storageProvisionerServer := localkubeServer.NewStorageProvisionerServer() + + var wg sync.WaitGroup + wg.Add(2) + go func() { + defer wg.Done() + storageProvisionerServer.Start() + }() + wg.Wait() +} diff --git a/deploy/storage-provisioner/Dockerfile b/deploy/storage-provisioner/Dockerfile new file mode 100644 index 000000000000..e14d211ea01c --- /dev/null +++ b/deploy/storage-provisioner/Dockerfile @@ -0,0 +1,20 @@ +# Copyright 2016 The Kubernetes Authors All rights reserved. +# +# 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. + +FROM ubuntu:16.04 + +COPY main main + +CMD ["/main"] + diff --git a/pkg/localkube/storage_provisioner.go b/pkg/localkube/storage_provisioner.go index 46d3af277595..5d22f81845fd 100644 --- a/pkg/localkube/storage_provisioner.go +++ b/pkg/localkube/storage_provisioner.go @@ -30,8 +30,7 @@ import ( "k8s.io/apimachinery/pkg/util/uuid" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/kubernetes" - "k8s.io/client-go/tools/clientcmd" - "k8s.io/minikube/pkg/util" + restclient "k8s.io/client-go/rest" ) const provisionerName = "k8s.io/minikube-hostpath" @@ -115,9 +114,8 @@ func (lk LocalkubeServer) NewStorageProvisionerServer() Server { } func StartStorageProvisioner(lk LocalkubeServer) func() error { - return func() error { - config, err := clientcmd.BuildConfigFromFlags("", util.DefaultKubeConfigPath) + config, err := restclient.InClusterConfig() if err != nil { return err } @@ -141,6 +139,7 @@ func StartStorageProvisioner(lk LocalkubeServer) func() error { // PVs pc := controller.NewProvisionController(clientset, provisionerName, hostPathProvisioner, serverVersion.GitVersion) + fmt.Println("wait never stop") pc.Run(wait.NeverStop) return nil }