Create main file for storage provisioner

pull/2137/head
Priya Wadhwa 2017-10-30 13:07:48 -07:00
parent bb9b7b1385
commit a8fedc86e1
4 changed files with 52 additions and 4 deletions

View File

@ -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

View File

@ -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()
}

View File

@ -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"]

View File

@ -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
}