-
Notifications
You must be signed in to change notification settings - Fork 601
NE-2117: Add httpsLogFormat and tcpLogFormat to API #2773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this | ||
| name: "IngressController" | ||
| crdName: ingresscontrollers.operator.openshift.io | ||
| featureGates: | ||
| - IngressControllerHTTPSLogFormat | ||
| tests: | ||
| onCreate: | ||
| - name: Should be able to create a minimal ingresscontroller with tcpLogFormat | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: IngressController | ||
| metadata: | ||
| name: default | ||
| namespace: openshift-ingress-operator | ||
| spec: | ||
| logging: | ||
| access: | ||
| destination: | ||
| type: Container | ||
| logEmptyRequests: "Ignore" | ||
| tcpLogFormat: "%ci:%cp [%t] %ft %b/%s %Tw/%Tc/%Tt %B %ts" | ||
| expected: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: IngressController | ||
| metadata: | ||
| name: default | ||
| namespace: openshift-ingress-operator | ||
| spec: | ||
| httpEmptyRequestsPolicy: Respond | ||
| idleConnectionTerminationPolicy: Immediate | ||
| closedClientConnectionPolicy: Continue | ||
| logging: | ||
| access: | ||
| destination: | ||
| type: Container | ||
| logEmptyRequests: "Ignore" | ||
| tcpLogFormat: "%ci:%cp [%t] %ft %b/%s %Tw/%Tc/%Tt %B %ts" | ||
| - name: Should be able to create a minimal ingresscontroller with httpsLogFormat | ||
| initial: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: IngressController | ||
| metadata: | ||
| name: default | ||
| namespace: openshift-ingress-operator | ||
| spec: | ||
| logging: | ||
| access: | ||
| destination: | ||
| type: Container | ||
| logEmptyRequests: "Ignore" | ||
| httpsLogFormat: "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC" | ||
| expected: | | ||
| apiVersion: operator.openshift.io/v1 | ||
| kind: IngressController | ||
| metadata: | ||
| name: default | ||
| namespace: openshift-ingress-operator | ||
| spec: | ||
| httpEmptyRequestsPolicy: Respond | ||
| idleConnectionTerminationPolicy: Immediate | ||
| closedClientConnectionPolicy: Continue | ||
| logging: | ||
| access: | ||
| destination: | ||
| type: Container | ||
| logEmptyRequests: "Ignore" | ||
| httpsLogFormat: "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1495,13 +1495,35 @@ type AccessLogging struct { | |
| // +required | ||
| Destination LoggingDestination `json:"destination"` | ||
|
|
||
| // tcpLogFormat specifies the format of the log message for a TCP | ||
| // connection. | ||
| // | ||
| // If this field is empty, log messages use the implementation's default | ||
| // TCP log format. When set, the value must be between 1 and 1024 | ||
| // characters long.For HAProxy's default TCP log format, see the | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a few inconsistencies in the godoc (no space between |
||
| // HAProxy documentation: | ||
| // http://docs.haproxy.org/2.8/configuration.html#8.2.2 | ||
| // | ||
| // Note that this log message is used for the initial TCP connection | ||
| // associated with a TLS session. Note that for edge-terminated and | ||
| // reencrypt routes, you may see a second log message for the HTTP | ||
| // request in addition to the log message for the TCP connection. Use | ||
| // the httpsLogFormat option to customize the log format for the HTTPS | ||
| // request. | ||
| // | ||
| // +kubebuilder:validation:MinLength=1 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For validations such as these, please have their corresponding requirements explicit in the godoc (example: |
||
| // +kubebuilder:validation:MaxLength=1024 | ||
| // +openshift:enable:FeatureGate=IngressControllerHTTPSLogFormat | ||
| // +optional | ||
| TcpLogFormat string `json:"tcpLogFormat,omitempty"` | ||
|
|
||
| // httpLogFormat specifies the format of the log message for an HTTP | ||
| // request. | ||
| // | ||
| // If this field is empty, log messages use the implementation's default | ||
| // HTTP log format. For HAProxy's default HTTP log format, see the | ||
| // HAProxy documentation: | ||
| // http://cbonte.github.io/haproxy-dconv/2.0/configuration.html#8.2.3 | ||
| // http://docs.haproxy.org/2.8/configuration.html#8.2.3 | ||
| // | ||
| // Note that this format only applies to cleartext HTTP connections | ||
| // and to secure HTTP connections for which the ingress controller | ||
|
|
@@ -1512,6 +1534,26 @@ type AccessLogging struct { | |
| // +optional | ||
| HttpLogFormat string `json:"httpLogFormat,omitempty"` | ||
|
|
||
| // httpsLogFormat specifies the format of the log message for an HTTPS | ||
| // request. | ||
| // | ||
| // If this field is empty, log messages use the implementation's default | ||
| // HTTPS log format. When set, the value must be between 1 and 1024 | ||
| // characters long.For HAProxy's default HTTPS log format, see the | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same spacing inconsistency as above |
||
| // HAProxy documentation: | ||
| // http://docs.haproxy.org/2.8/configuration.html#8.2.4 | ||
| // | ||
| // Note that this format only applies to HTTPS connections for which the | ||
| // ingress controller terminates encryption (that is, edge-terminated or | ||
| // reencrypt connections). It does not affect the log format for TLS | ||
| // passthrough connections. | ||
| // | ||
| // +kubebuilder:validation:MinLength=1 | ||
| // +kubebuilder:validation:MaxLength=1024 | ||
| // +openshift:enable:FeatureGate=IngressControllerHTTPSLogFormat | ||
| // +optional | ||
| HttpsLogFormat string `json:"httpsLogFormat,omitempty"` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically, this should be HTTPSLogFormat (and TcpLogFormat should be TCPLogFormat) based on naming conventions, which generally is followed in this file, except for some reason the existing I think the best behaviour is probably make the new fields formatted correct, even if it's not "consistent" |
||
|
|
||
| // httpCaptureHeaders defines HTTP headers that should be captured in | ||
| // access logs. If this field is empty, no headers are captured. | ||
| // | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, did something automatically add extra spaces here?