-
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
Run storage provisioner as pod #2137
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://github.com/kubernetes/kubernetes/wiki/CLA-FAQ to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
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.
Code looks good so far! One final check needed
Remove the conditional here, since the test is actually being skipped on kubeadm right now.
https://github.com/kubernetes/minikube/blob/master/test/integration/functional_test.go#L39-L42
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM ubuntu:16.04 |
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.
A slimmer image would be nice. Maybe scratch
?
pkg/minikube/constants/constants.go
Outdated
@@ -206,6 +209,9 @@ func GetKubeadmCachedImages(version string) []string { | |||
"gcr.io/google_containers/kube-scheduler-amd64:" + version, | |||
"gcr.io/google_containers/kube-controller-manager-amd64:" + version, | |||
"gcr.io/google_containers/kube-apiserver-amd64:" + version, | |||
|
|||
//Storage provisioner | |||
"gcr.io/k8s-minikube/storage-provisioner:" + version, |
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.
I think you can just leave this as whatever is above. The version here is actually from the --kubernetes-version
parameter, so if you use --kubernetes-version v1.8.1
it will try to cache the 1.8.1 tag of the storage provisioner.
We probably won't publish one of these for every version of kubernetes, so make this the hardcoded
"gcr.io/k8s-minikube/storage-provisioner:v1.8.0"
namespace: kube-system | ||
labels: | ||
integration-test: storage-provisioner | ||
addonmanager.kubernetes.io/mode: Reconcile |
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.
I think you want this to be addonmanager.kubernetes.io/mode: EnsureExists
, so we can disable it.
cmd/storage-provisioner/main.go
Outdated
wg.Add(2) | ||
go func() { | ||
defer wg.Done() | ||
storageProvisionerServer.Start() |
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.
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
I think thats due to a few things i mentioned above.
Once you do that, then you can see that its actually just exiting since there are errors
$ ./main --v 10 --logtostderr
F1030 14:08:28.887110 152274 main.go:30] unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
ref #2134 |
c8ff298
to
e372b27
Compare
The other thing we'll need to think about is how we're going to test changes to the storage provisioner addon in minikube CI tests. I don't think this is super important now, but we should start thinking about it. Currently: Ideally: Challenges: At a higher level, should addons be:
One thing we've talked about for kube-dns (which also needs templating) is to remove it from go-bin-data and template it in the minikube binary itself. |
e372b27
to
71b38d1
Compare
6ef4f44
to
7098431
Compare
Makefile
Outdated
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
rename to storage-provisioner
and can you make this output to our build dir? go build ... -o $(BUILD_DIR)/storage-provisioner
Makefile
Outdated
@@ -300,6 +300,14 @@ $(ISO_BUILD_IMAGE): deploy/iso/minikube-iso/Dockerfile | |||
@echo "" | |||
@echo "$(@) successfully built" | |||
|
|||
storage-provisioner-main: cmd/storage-provisioner/main.go |
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}}'
cmd/storage-provisioner/main.go
Outdated
|
||
func main() { | ||
localkubeServer := cmd.NewLocalkubeServer() | ||
storageProvisionerServer := localkubeServer.NewStorageProvisionerServer() |
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.
main should look something like
flag.Parse()
if err := localkube.StartStorageProvisioner(); err != nil {
glog.Exit(err)
}
Here, instead of creating a new localkube server, change the signature to be func StartStorageProvisioner() error
and call that directly.
minikube/pkg/localkube/storage_provisioner.go
Line 117 in 6a53c0c
func StartStorageProvisioner(lk LocalkubeServer) func() error { |
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.
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 comment
The 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 storage-provisioner --v 10 --logtostderr
)
Unfortunately, some of the localkube dependencies also register their flags, so theres some extra crap that gets added, but thats fine.
cmd/storage-provisioner/main.go
Outdated
wg.Add(2) | ||
go func() { | ||
defer wg.Done() | ||
storageProvisionerServer.Start() |
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.
I think thats due to a few things i mentioned above.
Once you do that, then you can see that its actually just exiting since there are errors
$ ./main --v 10 --logtostderr
F1030 14:08:28.887110 152274 main.go:30] unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
Codecov Report
@@ Coverage Diff @@
## master #2137 +/- ##
=========================================
+ Coverage 28.59% 28.6% +0.01%
=========================================
Files 82 82
Lines 5372 5369 -3
=========================================
Hits 1536 1536
+ Misses 3640 3637 -3
Partials 196 196
Continue to review full report at Codecov.
|
pkg/localkube/storage_provisioner.go
Outdated
} | ||
|
||
func StartStorageProvisioner(lk LocalkubeServer) func() error { | ||
func StartStorageProvisioner() func() error { |
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.
nit: "unwrap" this, and just return an error
instead of a func() error
dd60a95
to
c342ed4
Compare
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.
LGTM, nice!
No description provided.