Skip to content
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

fix: change the expectedType of the kube-client reflector to match the listWatch #720

Merged
merged 3 commits into from
Apr 18, 2019

Conversation

tariq1890
Copy link
Contributor

@tariq1890 tariq1890 commented Apr 13, 2019

Fixes #719

This PR adds what was missed in PR #652.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 13, 2019
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Apr 13, 2019
@tariq1890
Copy link
Contributor Author

This needs to be merged into the release-1.6 branch.

@brancz
Copy link
Member

brancz commented Apr 15, 2019

Do I understand correctly, that with this we're getting both appsv1 and backward compatible extensionsv1beta1 support back?

cc @mxinden

@mxinden
Copy link
Contributor

mxinden commented Apr 15, 2019

This needs to be merged into the release-1.6 branch.

In that case this pull request needs to point to the release-1.6 branch, @tariq1890 . Once merged, we can merge release-1.6 back into master, preserving git commit hashes across branches.

@tariq1890
Copy link
Contributor Author

@brancz I'll have to test with a pod created with that api Group and see if it's captures and represented properly when kube state metric queries the pod. I haven't had much time on my hands off late. Will provide an update on this as soon as I get the bandwidth.

Copy link
Member

@lilic lilic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this and it fixes the error for Deployments I was seeing as well. Thanks!

I don't think we need to downgrade the api support to appsv1beta1 for StatefulSets as according to the kube-state-metrics README only 1.10 onwards kubernetes versions are supported and StatefulSets were already out of beta in kubernetes 1.9 version.

Another thing: Would it make sense to adjust this?

@brancz
Copy link
Member

brancz commented Apr 18, 2019

I agree with @lilic let's just use v1apps for Deployments, StatefulSets and DaemonSets. It'll also be future proof.

@tariq1890
Copy link
Contributor Author

Do you want me to do that in this PR @brancz or in another one? Currently this PR is scoped to fixing #719. But that's just me saying that :).

@brancz
Copy link
Member

brancz commented Apr 18, 2019

The way I see it is this would be future proofing and fixing the bug :)

@tariq1890
Copy link
Contributor Author

I just tested a deployment manifest created with extensions/v1beta1 apiGroup with the kube-state-metrics code and I could see the metrics being exported successfully. I think it's safe to say that backwards compatibility with the deprecated extensions/v1beta1 apiGroup is preserved.

I will start implementing @lilic's suggestion now.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 18, 2019
return &metric.Family{
Metrics: ms,
Metrics: []*metric.Metric{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is merely a simplification.

@tariq1890
Copy link
Contributor Author

CI passed and ready for review.

@mxinden
Copy link
Contributor

mxinden commented Apr 18, 2019

Would you mind changing the target branch to release-1.6? See #720 (comment).

Copy link
Member

@lilic lilic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worked for me 👍 Thanks!

k8s.io/api/autoscaling/v2beta1
k8s.io/api/batch/v1
k8s.io/api/batch/v1beta1
k8s.io/api/certificates/v1beta1
k8s.io/api/core/v1
k8s.io/api/extensions/v1beta1
k8s.io/api/policy/v1beta1
k8s.io/api/apps/v1beta1
Copy link
Member

@lilic lilic Apr 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious why go mods does this change, moves the import in this file. The pkg is not used anymore in the code directly, guessing its used by one of the other deps e.g. client-go internally, but it makes me wonder if we can bump the version of client-go and in turn get rid of these dependencies. (But that might be going down the rabbit hole of solving deps, and probably falls outside of this PR :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. But yes, this definitely is out of scope for this PR. I believe we have k8s 1.14 depped into kube state metrics. We are just behind the latest by a patch release.

@tariq1890 tariq1890 changed the base branch from master to release-1.6 April 18, 2019 14:32
@tariq1890
Copy link
Contributor Author

@mxinden Done!

@brancz
Copy link
Member

brancz commented Apr 18, 2019

/lgtm

but giving @mxinden the last call

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 18, 2019
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 18, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brancz, tariq1890

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 18, 2019
@mxinden
Copy link
Contributor

mxinden commented Apr 18, 2019

Thanks for the fix @tariq1890!

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 18, 2019
@k8s-ci-robot k8s-ci-robot merged commit ceffc8e into kubernetes:release-1.6 Apr 18, 2019
@mxinden mxinden mentioned this pull request Apr 18, 2019
k8s-ci-robot added a commit that referenced this pull request Apr 18, 2019
@tariq1890 tariq1890 deleted the fix_reflector branch April 18, 2019 16:38
@AndrewDryga
Copy link

This issue has a regression, v1.9.6:

"pkg/mod/k8s.io/client-go@v0.0.0-20191109102209-3c0d1af94be5/tools/cache/reflector.go:108: expected type *v1.MutatingWebhookConfiguration, but watch event object had type *v1beta1.MutatingWebhookConfiguration"

@lizhifengones
Copy link

expected type *v1.MutatingWebhookConfiguration, but watch event object had type *v1beta1.MutatingWebhookConfiguration"

Is there any response?

@lizhifengones
Copy link

expected type *v1.MutatingWebhookConfiguration, but watch event object had type *v1beta1.MutatingWebhookConfiguration"

Is there any response?

#1142

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants