-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Update Kubernetes and Client-Go for 1.11.0 / 8.0.0 #634
Conversation
pkg/apis/ark/v1/pod_volume_backup.go
Outdated
@@ -27,7 +27,7 @@ type PodVolumeBackupSpec struct { | |||
Node string `json:"node"` | |||
|
|||
// Pod is a reference to the pod containing the volume to be backed up. | |||
Pod corev1api.ObjectReference `json:"pod"` | |||
Pod *corev1api.ObjectReference `json:"pod"` |
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 don't think this is required. We ran into this problem when we were updating the generated code when we didn't have k8s.io/api
available on the GOPATH. How did you regenerate things? The kubernetes-1.11.x tags for k8s.io/code-generator now allow us to run the generate groups shell script from anywhere (i.e. within ark), so we can remove the k8s.io/api bind mount (see https://github.com/heptio/ark/blob/32907931e13f38ef4e055652245eeb78d20ac76e/Makefile#L101-L102).
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.
Yeah! So, hack/update-generated-crd-code.sh
calls $GOPATH/src/k8s.io/code-generator/generate-groups.sh
which also requires k8s.io/apimachinery to be in the GOPATH as well. This is described in this issue: kubernetes/code-generator#21
I have some other projects that use code generation and I add a required
stanza to my Gopkg.toml for the k8s.io/code-generator repo so that we're not relying on out-of-tree code. I tried to set this up for Ark but that would be complicated for y'all because you prune non-go files, which prunes out the scripts.
When I did run the generator, however, both code-generator and apimachinery were checked out to the release-1.11 branch.
I had to go to dinner last night before I could get this to work, but I will definitely circle back soon. |
If you run ‘make update’ it updates everything in a docker container with
the right versions of everything.
…On Sat, Jun 30, 2018 at 1:39 PM Mike Arpaia ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pkg/apis/ark/v1/pod_volume_backup.go
<#634 (comment)>:
> @@ -27,7 +27,7 @@ type PodVolumeBackupSpec struct {
Node string `json:"node"`
// Pod is a reference to the pod containing the volume to be backed up.
- Pod corev1api.ObjectReference `json:"pod"`
+ Pod *corev1api.ObjectReference `json:"pod"`
Yeah! So, hack/update-generated-crd-code.sh calls $GOPATH/src/
k8s.io/code-generator/generate-groups.sh which also requires
k8s.io/apimachinery to be in the GOPATH as well. This is described in
this issue: kubernetes/code-generator#21
<kubernetes/code-generator#21>
I have some other projects that use code generation and I add a required
stanza to my Gopkg.toml for the k8s.io/code-generator repo so that we're
not relying on out-of-tree code. I tried to set this up for Ark but that
would be complicated for y'all because you prune non-go files, which prunes
out the scripts.
When I did run the generator, however, both code-generator and
apimachinery were checked out to the release-1.11 branch.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#634 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAABYvaP5Yq2-0iXVftBqjBc3GljrzZJks5uB7fIgaJpZM4U9sHm>
.
|
@marpaia thanks for doing this! We're working to close out 0.9.0, then we'll pick up reviewing this. When you get a chance (no rush!), please split out changes to |
Signed-off-by: Mike Arpaia <mike@arpaia.co>
Signed-off-by: Mike Arpaia <mike@arpaia.co>
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.
Just one minor comment, otherwise LGTM.
|
||
# vendor/k8s.io/client-go/plugin/pkg/client/auth/azure/azure.go:300:25: | ||
# cannot call non-function spt.Token (type adal.Token) | ||
[[override]] |
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.
we already have a [[constraint]]
for this package under Cloud provider packages
- can you just update the constraint to specify this revision rather than adding an override?
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 removed the constraint below. I believe this needs to be an override instead of a constraint because we need to override the version used in k8s.io/client-go
.
We may also be able to simplify |
We created it because the upstream client had some developer UX issues. The new client is much better and we shouldn't have to provider a helper any more, hopefully. |
@nrb can you take a look at this too? I'm fine merging as-is and can follow up to address my comments. |
Thanks @marpaia. Could you add DCO signoff to that last commit? Or squash it into a previous one. |
Woops, sorry about that :) |
Testing this branch out, I'm seeing backup failures with a simple example that I don't see with master. I run I see this in the server logs:
End of backup logs:
I'll do some more debugging on this, since Steve didn't see this behavior. |
@nrb what version's your cluster? Do you not get this error if running v0.9.0 in this same cluster? |
Kube versions:
Creating with a pod running v0.9.0: pod log:
backup log:
I'm going to try with a clean cluster and this branch on top of master. |
Narrowing this down some, it looks like the nginx pod isn't getting retrieved.
Printing some debug info, I see
And
|
Hmm, okay, I'll see if I can reproduce this and dig into it some more |
pkg/client/dynamic.go
Outdated
return &dynamicResourceClient{ | ||
resourceClient: dynamicClient.Resource(&resource, namespace), | ||
resourceClient: f.dynamicClient.Resource(gv.WithResource(resource.Name)), |
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.
aha! good catch @nrb. This line needs to be:
f.dynamicClient.Resource(gv.WithResource(resource.Name)).Namespace(namespace),
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.
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.
🤦♂️ , sorry guys. Yeah, the whole instantiation of the dynamic client is pretty suspect as I'm not super familiar with the dynamic client or the context in which it's used in Ark. I definitely think that some more tests would be great. I often struggle with how to most effectively test API interactions with an API server.. y'all don't have some sort of pattern for this in Ark, do you?
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.
No worries! I think a basic test that ensures the returned client has a namespace would be sufficient for now. I'm not super familiar with the new client so I'm not sure if there's a method or field on it that we can inspect.
@nrb I dug around the dynamic interface and there is no good way as far as I can tell to interrogate the client to determine if it has a namespace set or not. I found that when a namespace isn't set, the error message for GETing an API object that doesn't exist is slightly different, which is what the test asserts now, but this is really brittle / not adding much value IMO. I'm happy to back it out if y'all think it's not worth it. |
I'd say let's leave out that test for now, get this merged, and when one of us circles back to doing some refactoring/simplification of @marpaia if @nrb is OK with that approach, then I'd drop the unit-test commit, squash each of the most recent two (removing constraint and namespace fix) into the first three, and we'll be good to go. |
Signed-off-by: Mike Arpaia <mike@arpaia.co>
@skriss Works for me - it doesn't look like there's a great test directly on the client at this point in time. |
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.
Thanks @marpaia! |
This PR contains my run at updating the revs for the Kubernetes dependencies. I had to do some refactoring to use the new dynamic client interface, which is the most noteworthy change to the Ark code in my opinion.