mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-05 19:21:37 +00:00
Use IntOrString for HTTP health check ports
Clean up code to be more testable. Add test cases for named and numeric ports in HTTP health checks. Improve tests.
This commit is contained in:
@@ -83,6 +83,16 @@ const (
|
||||
IntstrString // The IntOrString holds a string.
|
||||
)
|
||||
|
||||
// MakeIntOrStringFromInt creates an IntOrString object with an int value.
|
||||
func MakeIntOrStringFromInt(val int) IntOrString {
|
||||
return IntOrString{Kind: IntstrInt, IntVal: val}
|
||||
}
|
||||
|
||||
// MakeIntOrStringFromInt creates an IntOrString object with a string value.
|
||||
func MakeIntOrStringFromString(val string) IntOrString {
|
||||
return IntOrString{Kind: IntstrString, StrVal: val}
|
||||
}
|
||||
|
||||
// SetYAML implements the yaml.Setter interface.
|
||||
func (intstr *IntOrString) SetYAML(tag string, value interface{}) bool {
|
||||
switch v := value.(type) {
|
||||
|
Reference in New Issue
Block a user