mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Add httpHeaders to httpGet liveness probe
Also update existing documentation and try to steer users away from 'host'. Add validation.
This commit is contained in:
@@ -977,6 +977,16 @@ func autoConvert_api_HTTPGetAction_To_v1_HTTPGetAction(in *api.HTTPGetAction, ou
|
||||
}
|
||||
out.Host = in.Host
|
||||
out.Scheme = URIScheme(in.Scheme)
|
||||
if in.HTTPHeaders != nil {
|
||||
out.HTTPHeaders = make([]HTTPHeader, len(in.HTTPHeaders))
|
||||
for i := range in.HTTPHeaders {
|
||||
if err := Convert_api_HTTPHeader_To_v1_HTTPHeader(&in.HTTPHeaders[i], &out.HTTPHeaders[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.HTTPHeaders = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -984,6 +994,19 @@ func Convert_api_HTTPGetAction_To_v1_HTTPGetAction(in *api.HTTPGetAction, out *H
|
||||
return autoConvert_api_HTTPGetAction_To_v1_HTTPGetAction(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_api_HTTPHeader_To_v1_HTTPHeader(in *api.HTTPHeader, out *HTTPHeader, s conversion.Scope) error {
|
||||
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||
defaulting.(func(*api.HTTPHeader))(in)
|
||||
}
|
||||
out.Name = in.Name
|
||||
out.Value = in.Value
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_api_HTTPHeader_To_v1_HTTPHeader(in *api.HTTPHeader, out *HTTPHeader, s conversion.Scope) error {
|
||||
return autoConvert_api_HTTPHeader_To_v1_HTTPHeader(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_api_Handler_To_v1_Handler(in *api.Handler, out *Handler, s conversion.Scope) error {
|
||||
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||
defaulting.(func(*api.Handler))(in)
|
||||
@@ -4155,6 +4178,16 @@ func autoConvert_v1_HTTPGetAction_To_api_HTTPGetAction(in *HTTPGetAction, out *a
|
||||
}
|
||||
out.Host = in.Host
|
||||
out.Scheme = api.URIScheme(in.Scheme)
|
||||
if in.HTTPHeaders != nil {
|
||||
out.HTTPHeaders = make([]api.HTTPHeader, len(in.HTTPHeaders))
|
||||
for i := range in.HTTPHeaders {
|
||||
if err := Convert_v1_HTTPHeader_To_api_HTTPHeader(&in.HTTPHeaders[i], &out.HTTPHeaders[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.HTTPHeaders = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -4162,6 +4195,19 @@ func Convert_v1_HTTPGetAction_To_api_HTTPGetAction(in *HTTPGetAction, out *api.H
|
||||
return autoConvert_v1_HTTPGetAction_To_api_HTTPGetAction(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_HTTPHeader_To_api_HTTPHeader(in *HTTPHeader, out *api.HTTPHeader, s conversion.Scope) error {
|
||||
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||
defaulting.(func(*HTTPHeader))(in)
|
||||
}
|
||||
out.Name = in.Name
|
||||
out.Value = in.Value
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1_HTTPHeader_To_api_HTTPHeader(in *HTTPHeader, out *api.HTTPHeader, s conversion.Scope) error {
|
||||
return autoConvert_v1_HTTPHeader_To_api_HTTPHeader(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_Handler_To_api_Handler(in *Handler, out *api.Handler, s conversion.Scope) error {
|
||||
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||
defaulting.(func(*Handler))(in)
|
||||
@@ -6279,6 +6325,7 @@ func init() {
|
||||
autoConvert_api_GitRepoVolumeSource_To_v1_GitRepoVolumeSource,
|
||||
autoConvert_api_GlusterfsVolumeSource_To_v1_GlusterfsVolumeSource,
|
||||
autoConvert_api_HTTPGetAction_To_v1_HTTPGetAction,
|
||||
autoConvert_api_HTTPHeader_To_v1_HTTPHeader,
|
||||
autoConvert_api_Handler_To_v1_Handler,
|
||||
autoConvert_api_HostPathVolumeSource_To_v1_HostPathVolumeSource,
|
||||
autoConvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource,
|
||||
@@ -6405,6 +6452,7 @@ func init() {
|
||||
autoConvert_v1_GitRepoVolumeSource_To_api_GitRepoVolumeSource,
|
||||
autoConvert_v1_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource,
|
||||
autoConvert_v1_HTTPGetAction_To_api_HTTPGetAction,
|
||||
autoConvert_v1_HTTPHeader_To_api_HTTPHeader,
|
||||
autoConvert_v1_Handler_To_api_Handler,
|
||||
autoConvert_v1_HostPathVolumeSource_To_api_HostPathVolumeSource,
|
||||
autoConvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource,
|
||||
|
||||
@@ -749,6 +749,22 @@ func deepCopy_v1_HTTPGetAction(in HTTPGetAction, out *HTTPGetAction, c *conversi
|
||||
}
|
||||
out.Host = in.Host
|
||||
out.Scheme = in.Scheme
|
||||
if in.HTTPHeaders != nil {
|
||||
out.HTTPHeaders = make([]HTTPHeader, len(in.HTTPHeaders))
|
||||
for i := range in.HTTPHeaders {
|
||||
if err := deepCopy_v1_HTTPHeader(in.HTTPHeaders[i], &out.HTTPHeaders[i], c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else {
|
||||
out.HTTPHeaders = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func deepCopy_v1_HTTPHeader(in HTTPHeader, out *HTTPHeader, c *conversion.Cloner) error {
|
||||
out.Name = in.Name
|
||||
out.Value = in.Value
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -2576,6 +2592,7 @@ func init() {
|
||||
deepCopy_v1_GitRepoVolumeSource,
|
||||
deepCopy_v1_GlusterfsVolumeSource,
|
||||
deepCopy_v1_HTTPGetAction,
|
||||
deepCopy_v1_HTTPHeader,
|
||||
deepCopy_v1_Handler,
|
||||
deepCopy_v1_HostPathVolumeSource,
|
||||
deepCopy_v1_ISCSIVolumeSource,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -877,6 +877,14 @@ type SecretKeySelector struct {
|
||||
Key string `json:"key"`
|
||||
}
|
||||
|
||||
// HTTPHeader describes a custom header to be used in HTTP probes
|
||||
type HTTPHeader struct {
|
||||
// The header field name
|
||||
Name string `json:"name"`
|
||||
// The header field value
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// HTTPGetAction describes an action based on HTTP Get requests.
|
||||
type HTTPGetAction struct {
|
||||
// Path to access on the HTTP server.
|
||||
@@ -885,11 +893,14 @@ type HTTPGetAction struct {
|
||||
// Number must be in the range 1 to 65535.
|
||||
// Name must be an IANA_SVC_NAME.
|
||||
Port intstr.IntOrString `json:"port"`
|
||||
// Host name to connect to, defaults to the pod IP.
|
||||
// Host name to connect to, defaults to the pod IP. You probably want to set
|
||||
// "Host" in httpHeaders instead.
|
||||
Host string `json:"host,omitempty"`
|
||||
// Scheme to use for connecting to the host.
|
||||
// Defaults to HTTP.
|
||||
Scheme URIScheme `json:"scheme,omitempty"`
|
||||
// Custom headers to set in the request. HTTP allows repeated headers.
|
||||
HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty"`
|
||||
}
|
||||
|
||||
// URIScheme identifies the scheme used for connection to a host for Get actions
|
||||
|
||||
@@ -509,17 +509,28 @@ func (GlusterfsVolumeSource) SwaggerDoc() map[string]string {
|
||||
}
|
||||
|
||||
var map_HTTPGetAction = map[string]string{
|
||||
"": "HTTPGetAction describes an action based on HTTP Get requests.",
|
||||
"path": "Path to access on the HTTP server.",
|
||||
"port": "Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.",
|
||||
"host": "Host name to connect to, defaults to the pod IP.",
|
||||
"scheme": "Scheme to use for connecting to the host. Defaults to HTTP.",
|
||||
"": "HTTPGetAction describes an action based on HTTP Get requests.",
|
||||
"path": "Path to access on the HTTP server.",
|
||||
"port": "Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.",
|
||||
"host": "Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.",
|
||||
"scheme": "Scheme to use for connecting to the host. Defaults to HTTP.",
|
||||
"httpHeaders": "Custom headers to set in the request. HTTP allows repeated headers.",
|
||||
}
|
||||
|
||||
func (HTTPGetAction) SwaggerDoc() map[string]string {
|
||||
return map_HTTPGetAction
|
||||
}
|
||||
|
||||
var map_HTTPHeader = map[string]string{
|
||||
"": "HTTPHeader describes a custom header to be used in HTTP probes",
|
||||
"name": "The header field name",
|
||||
"value": "The header field value",
|
||||
}
|
||||
|
||||
func (HTTPHeader) SwaggerDoc() map[string]string {
|
||||
return map_HTTPHeader
|
||||
}
|
||||
|
||||
var map_Handler = map[string]string{
|
||||
"": "Handler defines a specific action that should be taken",
|
||||
"exec": "One and only one of the following should be specified. Exec specifies the action to take.",
|
||||
|
||||
Reference in New Issue
Block a user