-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable controller-runtime backwards-compatibility
Make kdp backwards-compatible with versions of controller-runtime before v0.16, which introduced the metrics/server package.
- Loading branch information
1 parent
d7eaf43
commit 6fd1d76
Showing
5 changed files
with
61 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//go:build controllerruntime_11 || controllerruntime_12 || controllerruntime_13 || controllerruntime_14 || controllerruntime_15 | ||
|
||
package commonclient | ||
|
||
import ( | ||
"fmt" | ||
|
||
ctrl "sigs.k8s.io/controller-runtime" | ||
) | ||
|
||
// SetMetricsBindAddress sets the metrics address on options independent of | ||
// manager options version | ||
func SetMetricsBindAddress(options *ctrl.Options, bindAddress string) error { | ||
if options == nil { | ||
return fmt.Errorf("unable to set metrics bind address on non-existent manager options") | ||
} | ||
options.MetricsBindAddress = bindAddress | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//go:build !(controllerruntime_11 || controllerruntime_12 || controllerruntime_13 || controllerruntime_14 || controllerruntime_15) | ||
|
||
package commonclient | ||
|
||
import ( | ||
"fmt" | ||
|
||
ctrl "sigs.k8s.io/controller-runtime" | ||
) | ||
|
||
// SetMetricsBindAddress sets the metrics address on options independent of | ||
// manager options version | ||
func SetMetricsBindAddress(options *ctrl.Options, bindAddress string) error { | ||
if options == nil { | ||
return fmt.Errorf("unable to set metrics bind address on non-existent manager options") | ||
} | ||
options.Metrics.BindAddress = bindAddress | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters