Skip to content

Commit acb5727

Browse files
Merge pull request #729 from Miciah/operator-slash-ingress-add-parameters-for-empty-requests
operator/ingress: Add parameters for empty requests
2 parents aa4755e + 69c7751 commit acb5727

3 files changed

+103
-0
lines changed

operator/v1/0000_50_ingress-operator_00-ingresscontroller.crd.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,28 @@ spec:
327327
required:
328328
- type
329329
type: object
330+
httpEmptyRequestsPolicy:
331+
default: Respond
332+
description: "httpEmptyRequestsPolicy describes how HTTP connections
333+
should be handled if the connection times out before a request is
334+
received. Allowed values for this field are \"Respond\" and \"Ignore\".
335+
\ If the field is set to \"Respond\", the ingress controller sends
336+
an HTTP 400 or 408 response, logs the connection (if access logging
337+
is enabled), and counts the connection in the appropriate metrics.
338+
\ If the field is set to \"Ignore\", the ingress controller closes
339+
the connection without sending a response, logging the connection,
340+
or incrementing metrics. The default value is \"Respond\". \n Typically,
341+
these connections come from load balancers' health probes or Web
342+
browsers' speculative connections (\"preconnect\") and can be safely
343+
ignored. However, these requests may also be caused by network
344+
errors, and so setting this field to \"Ignore\" may impede detection
345+
and diagnosis of problems. In addition, these requests may be caused
346+
by port scans, in which case logging empty requests may aid in detecting
347+
intrusion attempts."
348+
enum:
349+
- Respond
350+
- Ignore
351+
type: string
330352
httpErrorCodePages:
331353
description: httpErrorCodePages specifies a configmap with custom
332354
error pages. The administrator must create this configmap in the
@@ -658,6 +680,23 @@ spec:
658680
or reencrypt connections). It does not affect the log format
659681
for TLS passthrough connections."
660682
type: string
683+
logEmptyRequests:
684+
default: Log
685+
description: logEmptyRequests specifies how connections on
686+
which no request is received should be logged. Typically,
687+
these empty requests come from load balancers' health probes
688+
or Web browsers' speculative connections ("preconnect"),
689+
in which case logging these requests may be undesirable. However,
690+
these requests may also be caused by network errors, in
691+
which case logging empty requests may be useful for diagnosing
692+
the errors. In addition, these requests may be caused by
693+
port scans, in which case logging empty requests may aid
694+
in detecting intrusion attempts. Allowed values for this
695+
field are "Log" and "Ignore". The default value is "Log".
696+
enum:
697+
- Log
698+
- Ignore
699+
type: string
661700
required:
662701
- destination
663702
type: object

operator/v1/types_ingress.go

+62
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,28 @@ type IngressControllerSpec struct {
191191
// +optional
192192
HTTPHeaders *IngressControllerHTTPHeaders `json:"httpHeaders,omitempty"`
193193

194+
// httpEmptyRequestsPolicy describes how HTTP connections should be
195+
// handled if the connection times out before a request is received.
196+
// Allowed values for this field are "Respond" and "Ignore". If the
197+
// field is set to "Respond", the ingress controller sends an HTTP 400
198+
// or 408 response, logs the connection (if access logging is enabled),
199+
// and counts the connection in the appropriate metrics. If the field
200+
// is set to "Ignore", the ingress controller closes the connection
201+
// without sending a response, logging the connection, or incrementing
202+
// metrics. The default value is "Respond".
203+
//
204+
// Typically, these connections come from load balancers' health probes
205+
// or Web browsers' speculative connections ("preconnect") and can be
206+
// safely ignored. However, these requests may also be caused by
207+
// network errors, and so setting this field to "Ignore" may impede
208+
// detection and diagnosis of problems. In addition, these requests may
209+
// be caused by port scans, in which case logging empty requests may aid
210+
// in detecting intrusion attempts.
211+
//
212+
// +optional
213+
// +kubebuilder:default:="Respond"
214+
HTTPEmptyRequestsPolicy HTTPEmptyRequestsPolicy `json:"httpEmptyRequestsPolicy,omitempty"`
215+
194216
// tuningOptions defines parameters for adjusting the performance of
195217
// ingress controller pods. All fields are optional and will use their
196218
// respective defaults if not set. See specific tuningOptions fields for
@@ -905,6 +927,17 @@ type IngressControllerCaptureHTTPCookieUnion struct {
905927
NamePrefix string `json:"namePrefix"`
906928
}
907929

930+
// LoggingPolicy indicates how an event should be logged.
931+
// +kubebuilder:validation:Enum=Log;Ignore
932+
type LoggingPolicy string
933+
934+
const (
935+
// LoggingPolicyLog indicates that an event should be logged.
936+
LoggingPolicyLog LoggingPolicy = "Log"
937+
// LoggingPolicyIgnore indicates that an event should not be logged.
938+
LoggingPolicyIgnore LoggingPolicy = "Ignore"
939+
)
940+
908941
// AccessLogging describes how client requests should be logged.
909942
type AccessLogging struct {
910943
// destination is where access logs go.
@@ -949,6 +982,21 @@ type AccessLogging struct {
949982
// +optional
950983
// +kubebuilder:validation:MaxItems=1
951984
HTTPCaptureCookies []IngressControllerCaptureHTTPCookie `json:"httpCaptureCookies,omitempty"`
985+
986+
// logEmptyRequests specifies how connections on which no request is
987+
// received should be logged. Typically, these empty requests come from
988+
// load balancers' health probes or Web browsers' speculative
989+
// connections ("preconnect"), in which case logging these requests may
990+
// be undesirable. However, these requests may also be caused by
991+
// network errors, in which case logging empty requests may be useful
992+
// for diagnosing the errors. In addition, these requests may be caused
993+
// by port scans, in which case logging empty requests may aid in
994+
// detecting intrusion attempts. Allowed values for this field are
995+
// "Log" and "Ignore". The default value is "Log".
996+
//
997+
// +optional
998+
// +kubebuilder:default:="Log"
999+
LogEmptyRequests LoggingPolicy `json:"logEmptyRequests,omitempty"`
9521000
}
9531001

9541002
// IngressControllerLogging describes what should be logged where.
@@ -1135,6 +1183,20 @@ type IngressControllerTuningOptions struct {
11351183
ThreadCount int32 `json:"threadCount,omitempty"`
11361184
}
11371185

1186+
// HTTPEmptyRequestsPolicy indicates how HTTP connections for which no request
1187+
// is received should be handled.
1188+
// +kubebuilder:validation:Enum=Respond;Ignore
1189+
type HTTPEmptyRequestsPolicy string
1190+
1191+
const (
1192+
// HTTPEmptyRequestsPolicyRespond indicates that the ingress controller
1193+
// should respond to empty requests.
1194+
HTTPEmptyRequestsPolicyRespond HTTPEmptyRequestsPolicy = "Respond"
1195+
// HTTPEmptyRequestsPolicyIgnore indicates that the ingress controller
1196+
// should ignore empty requests.
1197+
HTTPEmptyRequestsPolicyIgnore HTTPEmptyRequestsPolicy = "Ignore"
1198+
)
1199+
11381200
var (
11391201
// Available indicates the ingress controller deployment is available.
11401202
IngressControllerAvailableConditionType = "Available"

operator/v1/zz_generated.swagger_doc_generated.go

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)