Skip to content

Commit

Permalink
Create main file for storage provisioner
Browse files Browse the repository at this point in the history
  • Loading branch information
Priya Wadhwa committed Oct 30, 2017
1 parent bb9b7b1 commit a8fedc8
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions cmd/storage-provisioner/main.go
Original file line number Diff line number Diff line change
@@ -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()
}
20 changes: 20 additions & 0 deletions deploy/storage-provisioner/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

7 changes: 3 additions & 4 deletions pkg/localkube/storage_provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down

0 comments on commit a8fedc8

Please sign in to comment.