-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Use canonical meta types in prowjobs #6199
Use canonical meta types in prowjobs #6199
Conversation
My latest try with
There are still some dependencies that are updated but seem unrelated to the apimachinery repo which I am investigating. |
|
Not sure how to debug the bazel failure. |
@Kargakis I am going to try to get dependencies working this morning |
Even more reasonable diff now. I just skipped |
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cjwagner, kargakis The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/hold |
Still used by pods. I am planning on moving pods to use the canonical types in a follow-up and then we can remove our types. |
Try hack/update-deps.sh? You may need to add some drop dep lines (I haven't yet automated this part of the script just yet) to this script |
The issue seems to be that some proto rules in the generated BUILD files inside apimachinery don't include
And here is the generated rule:
If May it be an issue with how we use bazel? @ixdy @BenTheElder |
I did some digging today and came up with a couple of different issues:
|
Any idea why/how we generate |
At least somewhat related to the We might be running into issues with k/k (and thus apimachinery) using gazelle's "legacy" proto mode, while test-infra now uses the "normal" mode. I will investigate that theory. What are |
@BenTheElder what are these mysterious |
Fixed the remaining issues since kazel is updated. Hoping for green tests now 🙏 🙏 🙏 |
prow/kube/prowjob.go
Outdated
Metadata ObjectMeta `json:"metadata,omitempty"` | ||
Spec ProwJobSpec `json:"spec,omitempty"` | ||
Status ProwJobStatus `json:"status,omitempty"` | ||
metav1.TypeMeta `json:",inline"` |
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.
Hrm, I just realized this is not supported in Go yet: golang/go#6213
k8s is using a forked version of the json package.
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.
Seems that k8s is using https://github.com/json-iterator/go for JSON marshalling/unmarshalling.
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.
Or this is something I shouldn't care about since it's supposedly handled by client-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.
I didn't have a lot of courage to deal with bazel this morning so I ended up creating a prowjob controller that uses client-go and informers in a separate repo to play around: https://github.com/kargakis/prowjob-controller
|
Also, the binary size of the controller, including k8s/api, k8s/apimachinery, and k8s/client-go is 34MB. Go seems to compile only what's actually used. |
@ixdy I am updating gazelle to pick up bazel-contrib/bazel-gazelle#78, ptal |
Finally green tests! 🎉 |
ObjectMeta ObjectMeta `json:"metadata,omitempty"` | ||
Spec ProwJobSpec `json:"spec,omitempty"` | ||
Status ProwJobStatus `json:"status,omitempty"` | ||
APIVersion string `json:"apiVersion,omitempty"` |
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 am leaving type meta as is for now. I will change to metav1.TypeMeta once we switch to use client-go (otherwise, it won't work).
@spxtr fyi |
I endorse this PR.
Unfortunately, because the |
Do not switch type meta yet since struct inlining does not work with Go's encoding/json.
Rebased |
Green light on updating gazelle at #6388 (comment) @fejta hopefully this won't break your update-deps.sh change. /hold cancel |
Happy to deal with the fallout :) |
thanks for getting this in! |
whoo! thanks @Kargakis! 🎉 |
I guess "happy" would be more accurate here 😉 |
This PR vendors k8s/apimachinery and updates the prowjob API to use the canonical meta types. I will follow-up with vendoring k8s/api and k8s/client-go so we can drop the core k8s APIs that we maintain in test-infra and start generating prowjob informers.
Part of #1986