Skip to content

Commit

Permalink
Added storage prov deps to Makefile and rewrote main file
Browse files Browse the repository at this point in the history
  • Loading branch information
Priya Wadhwa committed Nov 1, 2017
1 parent 7098431 commit dd60a95
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 26 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ LOCALKUBE_LDFLAGS := "$(K8S_VERSION_LDFLAGS) $(MINIKUBE_LDFLAGS) -s -w -extldfla
LOCALKUBEFILES := GOPATH=$(GOPATH) go list -f '{{join .Deps "\n"}}' ./cmd/localkube/ | grep k8s.io | GOPATH=$(GOPATH) xargs go list -f '{{ range $$file := .GoFiles }} {{$$.Dir}}/{{$$file}}{{"\n"}}{{end}}'
MINIKUBEFILES := GOPATH=$(GOPATH) go list -f '{{join .Deps "\n"}}' ./cmd/minikube/ | grep k8s.io | GOPATH=$(GOPATH) xargs go list -f '{{ range $$file := .GoFiles }} {{$$.Dir}}/{{$$file}}{{"\n"}}{{end}}'
HYPERKIT_FILES := GOPATH=$(GOPATH) go list -f '{{join .Deps "\n"}}' k8s.io/minikube/cmd/drivers/hyperkit | grep k8s.io | GOPATH=$(GOPATH) xargs go list -f '{{ range $$file := .GoFiles }} {{$$.Dir}}/{{$$file}}{{"\n"}}{{end}}'

STORAGE_PROVISIONER_FILES := GOPATH=$(GOPATH) go list -f '{{join .Deps "\n"}}' k8s.io/minikube/cmd/storage-provisioner | grep k8s.io | GOPATH=$(GOPATH) xargs go list -f '{{ range $$file := .GoFiles }} {{$$.Dir}}/{{$$file}}{{"\n"}}{{end}}'
MINIKUBE_TEST_FILES := go list -f '{{ if .TestGoFiles }} {{.ImportPath}} {{end}}' ./... | grep k8s.io | GOPATH=$(GOPATH) xargs go list -f '{{ range $$file := .GoFiles }} {{$$.Dir}}/{{$$file}}{{"\n"}}{{end}}'

KVM_DRIVER_FILES := $(shell go list -f '{{join .Deps "\n"}}' ./cmd/drivers/kvm/ | grep k8s.io | xargs go list -f '{{ range $$file := .GoFiles }} {{$$.Dir}}/{{$$file}}{{"\n"}}{{end}}')
Expand Down Expand Up @@ -300,11 +300,11 @@ $(ISO_BUILD_IMAGE): deploy/iso/minikube-iso/Dockerfile
@echo ""
@echo "$(@) successfully built"

storage-provisioner-main: cmd/storage-provisioner/main.go
go build cmd/storage-provisioner/main.go
out/storage-provisioner: $(shell $(STORAGE_PROVISIONER_FILES))
go build -o $(BUILD_DIR)/storage-provisioner cmd/storage-provisioner/main.go

.PHONY: storage-provisioner-image
storage-provisioner-image: storage-provisioner-main
storage-provisioner-image: out/storage-provisioner
docker build -t $(REGISTRY)/storage-provisioner:$(TAG) -f deploy/storage-provisioner/Dockerfile .
gcloud docker -- push $(REGISTRY)/storage-provisioner:$(TAG)

Expand Down
22 changes: 10 additions & 12 deletions cmd/storage-provisioner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,17 @@ limitations under the License.
package main

import (
"k8s.io/minikube/cmd/localkube/cmd"
"sync"
"flag"
"github.com/golang/glog"
"k8s.io/minikube/pkg/localkube"
)

func main() {
localkubeServer := cmd.NewLocalkubeServer()
storageProvisionerServer := localkubeServer.NewStorageProvisionerServer()

var wg sync.WaitGroup
wg.Add(2)
go func() {
defer wg.Done()
storageProvisionerServer.Start()
}()
wg.Wait()
flag.Parse()
storageProvisionerFunction := localkube.StartStorageProvisioner()

if err := storageProvisionerFunction(); err != nil {
glog.Exit(err)
}

}
1 change: 0 additions & 1 deletion deploy/addons/storage-provisioner/storage-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ metadata:
labels:
integration-test: storage-provisioner
addonmanager.kubernetes.io/mode: EnsureExists
kubernetes.io/minikube-addons: storage-provisioner
spec:
hostNetwork: true
containers:
Expand Down
5 changes: 2 additions & 3 deletions deploy/storage-provisioner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
# limitations under the License.

FROM scratch
COPY main main
CMD ["/main"]

COPY out/storage-provisioner storage-provisioner
CMD ["/storage-provisioner"]
8 changes: 2 additions & 6 deletions pkg/localkube/storage_provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,7 @@ func (p *hostPathProvisioner) Delete(volume *v1.PersistentVolume) error {
return nil
}

func (lk LocalkubeServer) NewStorageProvisionerServer() Server {
return NewSimpleServer("storage-provisioner", serverInterval, StartStorageProvisioner(lk), noop)
}

func StartStorageProvisioner(lk LocalkubeServer) func() error {
func StartStorageProvisioner() func() error {
return func() error {
config, err := restclient.InClusterConfig()
if err != nil {
Expand All @@ -139,7 +135,7 @@ func StartStorageProvisioner(lk LocalkubeServer) func() error {
// PVs
pc := controller.NewProvisionController(clientset, provisionerName, hostPathProvisioner, serverVersion.GitVersion)

fmt.Println("wait never stop")
glog.Info("Starting storage provisioner server")
pc.Run(wait.NeverStop)
return nil
}
Expand Down

0 comments on commit dd60a95

Please sign in to comment.