Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

able to run init container with client-go #149

Merged
merged 1 commit into from
May 9, 2017

Conversation

ngtuna
Copy link
Contributor

@ngtuna ngtuna commented May 5, 2017

This is a hot fix to have init container running in the case of pubsub function with dependency file. This case was running very well with the old k8s client but when I turned to use client-go this becomes a known bug. Reference issue: kubernetes/client-go#142

@sebgoa
Copy link
Contributor

sebgoa commented May 9, 2017

so that's a bit strange, since in 1.6 we don't need to put annotations for initcontainers to run.

@anguslees can you give your review here, so we can merge and get over this bump

@anguslees
Copy link
Contributor

Wow, what a mess.

It looks like the PodSpec.InitContainers element was added to k8s types.go back in 1.5 (or earlier?), even though the feature wasn't meant to exist in that form at that time. That k8s source file was automatically picked up and copied into the client-go version of types.go. So the client-go 2.0 code has something in the PodSpec type that isn't actually part of the published k8s 1.5 API, contrary to the client-go compatibility statement.

It seems there was some machinery in the k8s code that automatically moved InitContainers values to the appropriate alpha/beta annotations. This machinery doesn't exist or isn't automatically triggered in the client-go version. So kubeless init containers (which were using PodSpec.InitContainers) haven't been working since the move to client-go, when used against <<1.6 k8s. In k8s 1.6, this field suddenly becomes the officially supported way to specify init containers, just to keep things interesting.

Switching to actually using the annotation is the right thing to do, assuming we want to support k8s 1.5, 1.6 and maybe 1.7 (unsure when the beta annotation will be dropped). Yay for using beta API features.

@ngtuna
Copy link
Contributor Author

ngtuna commented May 9, 2017

Thanks @anguslees for clarifying that. Merging now.

@ngtuna ngtuna merged commit 6cbae76 into vmware-archive:master May 9, 2017
sayanh pushed a commit to sayanh/kubeless that referenced this pull request Jan 17, 2018
able to run init container with client-go
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants