Use the generic Set to replace deprecated methods (#5623)

This commit is contained in:
Xinzhao Xu
2023-04-07 11:15:35 +08:00
committed by GitHub
parent 634988f529
commit 708de806f8
16 changed files with 99 additions and 110 deletions

View File

@@ -86,9 +86,9 @@ func handleRootHealth(name string, firstTimeHealthy func(), checks ...HealthChec
}
}
if excluded.Len() > 0 {
fmt.Fprintf(&individualCheckOutput, "warn: some health checks cannot be excluded: no matches for %s\n", formatQuoted(excluded.List()...))
fmt.Fprintf(&individualCheckOutput, "warn: some health checks cannot be excluded: no matches for %s\n", formatQuoted(excluded.UnsortedList()...))
klog.Warningf("cannot exclude some health checks, no health checks are installed matching %s",
formatQuoted(excluded.List()...))
formatQuoted(excluded.UnsortedList()...))
}
// always be verbose on failure
if len(failedChecks) > 0 {
@@ -137,12 +137,12 @@ type HealthChecker interface {
}
// getExcludedChecks extracts the health check names to be excluded from the query param
func getExcludedChecks(r *http.Request) sets.String {
func getExcludedChecks(r *http.Request) sets.Set[string] {
checks, found := r.URL.Query()["exclude"]
if found {
return sets.NewString(checks...)
return sets.New(checks...)
}
return sets.NewString()
return sets.New[string]()
}
// PingHealthz returns true automatically when checked