-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run storage provisioner as pod #2137
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -300,6 +300,14 @@ $(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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename to |
||
|
||
.PHONY: storage-provisioner-image | ||
storage-provisioner-image: storage-provisioner-main | ||
docker build -t $(REGISTRY)/storage-provisioner:$(TAG) -f deploy/storage-provisioner/Dockerfile . | ||
gcloud docker -- push $(REGISTRY)/storage-provisioner:$(TAG) | ||
|
||
.PHONY: release-iso | ||
release-iso: minikube_iso checksum | ||
gsutil cp out/minikube.iso gs://$(ISO_BUCKET)/minikube-$(ISO_VERSION).iso | ||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,35 @@ | ||||
/* | ||||
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. | ||||
*/ | ||||
|
||||
package main | ||||
|
||||
import ( | ||||
"k8s.io/minikube/cmd/localkube/cmd" | ||||
"sync" | ||||
) | ||||
|
||||
func main() { | ||||
localkubeServer := cmd.NewLocalkubeServer() | ||||
storageProvisionerServer := localkubeServer.NewStorageProvisionerServer() | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. main should look something like
Here, instead of creating a new localkube server, change the signature to be minikube/pkg/localkube/storage_provisioner.go Line 117 in 6a53c0c
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SGTM, but we don't need the flag.Parse() in this case, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. glog (the logging library) adds some flags to set verbosity, which would be nice to have on this binary (you might want to run the container command as Unfortunately, some of the localkube dependencies also register their flags, so theres some extra crap that gets added, but thats fine. |
||||
|
||||
var wg sync.WaitGroup | ||||
wg.Add(2) | ||||
go func() { | ||||
defer wg.Done() | ||||
storageProvisionerServer.Start() | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can just call this directly, no need to put it in a waitgroup There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I tried that initially, but it didn't work. I looked it up and I think the main program ends before the server has a chance to start? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think thats due to a few things i mentioned above.
|
||||
}() | ||||
wg.Wait() | ||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# 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. | ||
|
||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: storage-provisioner | ||
namespace: kube-system | ||
labels: | ||
integration-test: storage-provisioner | ||
addonmanager.kubernetes.io/mode: EnsureExists | ||
kubernetes.io/minikube-addons: storage-provisioner | ||
spec: | ||
hostNetwork: true | ||
containers: | ||
- name: storage-provisioner | ||
image: gcr.io/k8s-minikube/storage-provisioner:v1.8.0 | ||
imagePullPolicy: IfNotPresent |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# 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 scratch | ||
COPY main main | ||
CMD ["/main"] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should technically depend on all the storage-provisioner files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not great, but you'll need do add something that computes the dependencies,
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}}'