-
Notifications
You must be signed in to change notification settings - Fork 85
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
Enable backwards-compatibility with controller-runtime v0.15 #364
Enable backwards-compatibility with controller-runtime v0.15 #364
Conversation
Skipping CI for Draft Pull Request. |
/cc @yuwenma @haiyanmeng |
35fca50
to
edc1c15
Compare
edc1c15
to
db78a7d
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.
/cc @justinsb
HealthProbeBindAddress: probeAddr, | ||
LeaderElection: enableLeaderElection, | ||
LeaderElectionID: "c3cffa1a.example.org", | ||
}) | ||
} | ||
err := commonclient.SetMetricsBindAddress(&mgrOpt, "0") |
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.
Note that before controller-runtime 0.16, the manager options were
- metrics bind address:
metricsAddr
- port: 9443
Let me know if we want to replicate that behavior here.
LeaderElection: false, | ||
|
||
// MapperProvider provides the rest mapper used to map go types to Kubernetes APIs | ||
MapperProvider: restmapper.NewControllerRESTMapper, | ||
|
||
Logger: logger, | ||
}) | ||
} | ||
err = commonclient.SetMetricsBindAddress(&mgrOpt, "0") |
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.
Note that before controller-runtime 0.16, the manager options were
- metrics bind address: empty
- port: 0
Let me know if we want to replicate that behavior here.
Make kdp backwards-compatible with versions of controller-runtime before v0.16, which introduced the metrics/server package.
db78a7d
to
6fd1d76
Compare
/lgtm |
Thanks @annasong20 - this is nice! /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: annasong20, justinsb 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 |
What this PR does / why we need it:
This PR makes the code backwards-compatible with versions of controller-runtime before 0.16, which introduced the metrics/server package that kdp now uses. The PR uses
//go:build
to segregate handling of the metrics configuration depending on the version of controller-runtime.Special notes for your reviewer:
N/A
Additional documentation:
The following links may be useful references
//go:build
usage: Create abstraction layer over controller-runtime/client-go versions #342