-
Notifications
You must be signed in to change notification settings - Fork 3.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
rework addon-resizer to use client-go #1859
rework addon-resizer to use client-go #1859
Conversation
Assuming the switch to |
3debf66
to
23534a8
Compare
In general, huge, huge thank you for taking the time and the effort! Seeing core Kubernetes moving to go mod (https://groups.google.com/forum/#!topic/kubernetes-dev/ECejidBCELI) I think it's the right thing to move addon resizer too. I have one request, can you split the go mod change from the client-go one? It will make it way easier for me to remove the code that actually changed. |
Crap, I squashed my commits - I can't easily separate them now. But if we remove |
There are several problems:
I can try to review this as a whole but I'll need time. I also need to consult someone around the license thing, I'll get back to you next week. |
Well, dependencies have changed, that's for sure. As for version mismatch - my mistake, I forgot to switch everything to 1.12. Will fix in a minute. |
I talked a bit more with other sig-autoscaling members and it seems like we need a common answer for autoscaler components and go modules. It will take us a couple of weeks probably to flesh it out. |
OK, I'll try to rework using |
eedf74b
to
a61786a
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.
Nits only, otherwise lgtm, thanks!
addon-resizer/Makefile
Outdated
@@ -65,9 +65,9 @@ container: .container-$(ARCH) | |||
docker run --rm -it -v $(TEMP_DIR):$(TEMP_DIR):Z -v `pwd`:/go/src/k8s.io/autoscaler/addon-resizer/:Z \ | |||
golang:${GOLANG_VERSION} \ | |||
/bin/bash -c "\ | |||
go get github.com/tools/godep && \ | |||
go get github.com/tools/godep && \ |
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.
Not sure where the whitespace changes come from.
func (k *kubernetesClient) ContainerResources() (*apiv1.ResourceRequirements, error) { | ||
pod, err := k.clientset.CoreClient.Pods(k.namespace).Get(k.pod) | ||
func (k *kubernetesClient) Stop() { | ||
for i := 0; i < 3; i++ { |
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.
The i < 3 seems really error prone - if someone adds another lister, no way they will know thay have to increase it. Can you add a stopChan per lister instead?
wait "k8s.io/kubernetes/pkg/util/wait" | ||
watch "k8s.io/kubernetes/pkg/watch" | ||
apps "k8s.io/api/apps/v1" | ||
api "k8s.io/api/core/v1" |
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: s/api/core/
addon-resizer/main.go
Outdated
} | ||
|
||
// GetClientOutOfCluster returns a k8s clientset to the request from outside of cluster | ||
func GetClientOutOfCluster() kubernetes.Interface { |
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: GetClientOutOfClusterOrDie() (here and below)
@bskiba please check now |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bskiba The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @bskiba , do you have any time frame for releasing this? |
Also where can we find newer tagged images of this addon-resizer docker image? |
@piontec I'll try to release in the next two weeks. |
@bskiba - note that we're still using 1.8.* releases, as there were some issues with 2.* releases |
@wojtek-t Thanks! I wasn't planning on changing the default, and I think that there are folks successfully using the 2.X releases so it still makes sense to release. But it's good to note that maybe this fix should go to the 1.8 release as well. @piontec are you interested in porting to 1.8 or is the master branch satisfactory? |
The addon-resizer code doesn't modify attributes other than limits/requests, so it seems the bug is in libraries used. This is causing problems like #1858 and probably also #1799 and #1457 . To solve that, I upgraded libraries to more recent ones.
Changes include:
godep
in favor ofgo mod
- I was becoming sick trying to do that usinggodep
client-go
(version v8.0.0) and api libs (from 1.11 k8s release)Makefile
builds docker image OKTesting:
addon-scaler
works OK running against an already provisioned cluster withkube-state-metrics
pod.