From 9a755499e7e6f242134f5c94553b9f31b687f46a Mon Sep 17 00:00:00 2001 From: shawnh2 Date: Mon, 29 Apr 2024 14:55:48 +0800 Subject: [PATCH] add append '.' to err message for xpolicy Signed-off-by: shawnh2 --- .../testdata/backendtlspolicy-invalid-ca.out.yaml | 2 +- .../backendtlspolicy-without-referencegrant.out.yaml | 2 +- ...ckendtrafficpolicy-with-circuitbreakers-error.out.yaml | 6 +++--- ...olicy-with-local-ratelimit-invalid-limit-unit.out.yaml | 2 +- ...olicy-with-local-ratelimit-invalid-match-type.out.yaml | 2 +- ...ratelimit-invalid-multiple-route-level-limits.out.yaml | 2 +- ...endtrafficpolicy-with-ratelimit-invalid-regex.out.yaml | 2 +- .../backendtrafficpolicy-with-timeout-error.out.yaml | 2 +- ...ttrafficpolicy-buffer-limit-with-format-error.out.yaml | 2 +- ...icpolicy-buffer-limit-with-out-of-range-error.out.yaml | 2 +- .../clienttrafficpolicy-connection-limit-error.out.yaml | 2 +- .../testdata/clienttrafficpolicy-http10.out.yaml | 2 +- .../testdata/clienttrafficpolicy-http2.out.yaml | 2 +- .../clienttrafficpolicy-idle-timeout-with-error.out.yaml | 2 +- .../clienttrafficpolicy-timeout-with-error.out.yaml | 2 +- .../gatewayapi/testdata/conflicting-policies.out.yaml | 2 +- ...npolicy-with-extproc-invalid-no-matching-port.out.yaml | 2 +- ...yextensionpolicy-with-extproc-invalid-no-port.out.yaml | 2 +- ...olicy-with-extproc-invalid-no-reference-grant.out.yaml | 2 +- ...tensionpolicy-with-extproc-invalid-no-service.out.yaml | 2 +- ...e-and-backendtrafficpolicy-with-timeout-error.out.yaml | 2 +- .../testdata/httproute-with-invalid-regex.out.yaml | 2 +- ...ttproute-with-single-rule-with-multiple-rules.out.yaml | 2 +- .../testdata/merge-with-isolated-policies-2.out.yaml | 2 +- ...ypolicy-with-extauth-invalid-no-matching-port.out.yaml | 2 +- .../securitypolicy-with-extauth-invalid-no-port.out.yaml | 2 +- ...olicy-with-extauth-invalid-no-reference-grant.out.yaml | 2 +- ...ecuritypolicy-with-extauth-invalid-no-service.out.yaml | 2 +- .../securitypolicy-with-jwt-and-invalid-oidc.out.yaml | 4 ++-- .../securitypolicy-with-oidc-invalid-issuer.out.yaml | 2 +- .../securitypolicy-with-oidc-invalid-secretref.out.yaml | 6 +++--- internal/status/conditions.go | 8 +++++++- internal/status/conditions_test.go | 2 +- 33 files changed, 44 insertions(+), 38 deletions(-) diff --git a/internal/gatewayapi/testdata/backendtlspolicy-invalid-ca.out.yaml b/internal/gatewayapi/testdata/backendtlspolicy-invalid-ca.out.yaml index 47e7c66c07e..fcb2a79f73b 100644 --- a/internal/gatewayapi/testdata/backendtlspolicy-invalid-ca.out.yaml +++ b/internal/gatewayapi/testdata/backendtlspolicy-invalid-ca.out.yaml @@ -26,7 +26,7 @@ backendTLSPolicies: sectionName: http conditions: - lastTransitionTime: null - message: No ca found in configmap no-ca-cmap + message: No ca found in configmap no-ca-cmap. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/backendtlspolicy-without-referencegrant.out.yaml b/internal/gatewayapi/testdata/backendtlspolicy-without-referencegrant.out.yaml index 6922e60d7c8..b8e9bc4b51f 100755 --- a/internal/gatewayapi/testdata/backendtlspolicy-without-referencegrant.out.yaml +++ b/internal/gatewayapi/testdata/backendtlspolicy-without-referencegrant.out.yaml @@ -27,7 +27,7 @@ backendTLSPolicies: conditions: - lastTransitionTime: null message: Target ref to Service backends/http-backend not permitted by any - ReferenceGrant + ReferenceGrant. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-circuitbreakers-error.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-circuitbreakers-error.out.yaml index 45d95e8aaf9..3d767a9d58f 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-circuitbreakers-error.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-circuitbreakers-error.out.yaml @@ -23,7 +23,7 @@ backendTrafficPolicies: sectionName: http conditions: - lastTransitionTime: null - message: 'CircuitBreaker: invalid MaxRequestsPerConnection value -1' + message: 'CircuitBreaker: invalid MaxRequestsPerConnection value -1.' reason: Invalid status: "False" type: Accepted @@ -52,7 +52,7 @@ backendTrafficPolicies: sectionName: http conditions: - lastTransitionTime: null - message: 'CircuitBreaker: invalid MaxParallelRetries value -1' + message: 'CircuitBreaker: invalid MaxParallelRetries value -1.' reason: Invalid status: "False" type: Accepted @@ -80,7 +80,7 @@ backendTrafficPolicies: namespace: envoy-gateway conditions: - lastTransitionTime: null - message: 'CircuitBreaker: invalid MaxConnections value -1' + message: 'CircuitBreaker: invalid MaxConnections value -1.' reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-local-ratelimit-invalid-limit-unit.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-local-ratelimit-invalid-limit-unit.out.yaml index 0b81c2dd0de..936a1465391 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-local-ratelimit-invalid-limit-unit.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-local-ratelimit-invalid-limit-unit.out.yaml @@ -48,7 +48,7 @@ backendTrafficPolicies: conditions: - lastTransitionTime: null message: 'RateLimit: local rateLimit rule limit unit must be a multiple of - the default limit unit' + the default limit unit.' reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-local-ratelimit-invalid-match-type.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-local-ratelimit-invalid-match-type.out.yaml index 68ed3affde6..7130794e502 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-local-ratelimit-invalid-match-type.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-local-ratelimit-invalid-match-type.out.yaml @@ -44,7 +44,7 @@ backendTrafficPolicies: namespace: envoy-gateway conditions: - lastTransitionTime: null - message: 'RateLimit: local rateLimit does not support distinct HeaderMatch' + message: 'RateLimit: local rateLimit does not support distinct HeaderMatch.' reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-local-ratelimit-invalid-multiple-route-level-limits.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-local-ratelimit-invalid-multiple-route-level-limits.out.yaml index 32d1661ea55..fbb90cd518c 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-local-ratelimit-invalid-multiple-route-level-limits.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-local-ratelimit-invalid-multiple-route-level-limits.out.yaml @@ -51,7 +51,7 @@ backendTrafficPolicies: conditions: - lastTransitionTime: null message: 'RateLimit: local rateLimit can not have more than one rule without - clientSelectors' + clientSelectors.' reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-ratelimit-invalid-regex.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-ratelimit-invalid-regex.out.yaml index 360544da250..4231fc42432 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-ratelimit-invalid-regex.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-ratelimit-invalid-regex.out.yaml @@ -35,7 +35,7 @@ backendTrafficPolicies: conditions: - lastTransitionTime: null message: 'RateLimit: regex "*.illegal.regex" is invalid: error parsing regexp: - missing argument to repetition operator: `*`' + missing argument to repetition operator: `*`.' reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-timeout-error.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-timeout-error.out.yaml index 3adff744df7..b97572801f3 100644 --- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-timeout-error.out.yaml +++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-timeout-error.out.yaml @@ -26,7 +26,7 @@ backendTrafficPolicies: namespace: envoy-gateway conditions: - lastTransitionTime: null - message: 'Timeout: invalid MaxConnectionDuration value 22mib' + message: 'Timeout: invalid MaxConnectionDuration value 22mib.' reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/clienttrafficpolicy-buffer-limit-with-format-error.out.yaml b/internal/gatewayapi/testdata/clienttrafficpolicy-buffer-limit-with-format-error.out.yaml index f82580ce39f..c4b852ea8f3 100755 --- a/internal/gatewayapi/testdata/clienttrafficpolicy-buffer-limit-with-format-error.out.yaml +++ b/internal/gatewayapi/testdata/clienttrafficpolicy-buffer-limit-with-format-error.out.yaml @@ -24,7 +24,7 @@ clientTrafficPolicies: sectionName: http-1 conditions: - lastTransitionTime: null - message: Invalid BufferLimit value 500m + message: Invalid BufferLimit value 500m. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/clienttrafficpolicy-buffer-limit-with-out-of-range-error.out.yaml b/internal/gatewayapi/testdata/clienttrafficpolicy-buffer-limit-with-out-of-range-error.out.yaml index 08c7f6dbbd9..c1831d14c7a 100755 --- a/internal/gatewayapi/testdata/clienttrafficpolicy-buffer-limit-with-out-of-range-error.out.yaml +++ b/internal/gatewayapi/testdata/clienttrafficpolicy-buffer-limit-with-out-of-range-error.out.yaml @@ -24,7 +24,7 @@ clientTrafficPolicies: sectionName: http-1 conditions: - lastTransitionTime: null - message: BufferLimit value 100G is out of range, must be between 0 and 4294967295 + message: BufferLimit value 100G is out of range, must be between 0 and 4294967295. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/clienttrafficpolicy-connection-limit-error.out.yaml b/internal/gatewayapi/testdata/clienttrafficpolicy-connection-limit-error.out.yaml index 2dfb99f691e..09f893c7149 100755 --- a/internal/gatewayapi/testdata/clienttrafficpolicy-connection-limit-error.out.yaml +++ b/internal/gatewayapi/testdata/clienttrafficpolicy-connection-limit-error.out.yaml @@ -26,7 +26,7 @@ clientTrafficPolicies: sectionName: http-1 conditions: - lastTransitionTime: null - message: Invalid CloseDelay value 10mib + message: Invalid CloseDelay value 10mib. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/clienttrafficpolicy-http10.out.yaml b/internal/gatewayapi/testdata/clienttrafficpolicy-http10.out.yaml index df2e0592b6b..cc5a14de0a3 100644 --- a/internal/gatewayapi/testdata/clienttrafficpolicy-http10.out.yaml +++ b/internal/gatewayapi/testdata/clienttrafficpolicy-http10.out.yaml @@ -86,7 +86,7 @@ clientTrafficPolicies: sectionName: http-3 conditions: - lastTransitionTime: null - message: Can't set http10 default host on listener with only wildcard hostnames + message: Can't set http10 default host on listener with only wildcard hostnames. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/clienttrafficpolicy-http2.out.yaml b/internal/gatewayapi/testdata/clienttrafficpolicy-http2.out.yaml index 96d1fc82fec..9dd9e04037e 100755 --- a/internal/gatewayapi/testdata/clienttrafficpolicy-http2.out.yaml +++ b/internal/gatewayapi/testdata/clienttrafficpolicy-http2.out.yaml @@ -60,7 +60,7 @@ clientTrafficPolicies: - lastTransitionTime: null message: |- InitialStreamWindowSize value 1Ki is out of range, must be between 65535 and 2147483647 - InitialConnectionWindowSize value 1Ti is out of range, must be between 65535 and 2147483647 + InitialConnectionWindowSize value 1Ti is out of range, must be between 65535 and 2147483647. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/clienttrafficpolicy-idle-timeout-with-error.out.yaml b/internal/gatewayapi/testdata/clienttrafficpolicy-idle-timeout-with-error.out.yaml index 0854e41ef4d..e52a5b34bc9 100755 --- a/internal/gatewayapi/testdata/clienttrafficpolicy-idle-timeout-with-error.out.yaml +++ b/internal/gatewayapi/testdata/clienttrafficpolicy-idle-timeout-with-error.out.yaml @@ -23,7 +23,7 @@ clientTrafficPolicies: namespace: envoy-gateway conditions: - lastTransitionTime: null - message: 'Time: unknown unit "sec" in duration "10sec"' + message: 'Time: unknown unit "sec" in duration "10sec".' reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/clienttrafficpolicy-timeout-with-error.out.yaml b/internal/gatewayapi/testdata/clienttrafficpolicy-timeout-with-error.out.yaml index eaf13c0af18..1670495493f 100644 --- a/internal/gatewayapi/testdata/clienttrafficpolicy-timeout-with-error.out.yaml +++ b/internal/gatewayapi/testdata/clienttrafficpolicy-timeout-with-error.out.yaml @@ -23,7 +23,7 @@ clientTrafficPolicies: namespace: envoy-gateway conditions: - lastTransitionTime: null - message: 'Time: unknown unit "sec" in duration "5sec"' + message: 'Time: unknown unit "sec" in duration "5sec".' reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/conflicting-policies.out.yaml b/internal/gatewayapi/testdata/conflicting-policies.out.yaml index 3f2a1d53418..657c99672fe 100644 --- a/internal/gatewayapi/testdata/conflicting-policies.out.yaml +++ b/internal/gatewayapi/testdata/conflicting-policies.out.yaml @@ -24,7 +24,7 @@ clientTrafficPolicies: conditions: - lastTransitionTime: null message: ClientTrafficPolicy is being applied to multiple http (non https) - listeners (default/gateway-1/http) on the same port, which is not allowed + listeners (default/gateway-1/http) on the same port, which is not allowed. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-matching-port.out.yaml b/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-matching-port.out.yaml index 55e0b661896..3fd66d99178 100755 --- a/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-matching-port.out.yaml +++ b/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-matching-port.out.yaml @@ -24,7 +24,7 @@ envoyExtensionPolicies: namespace: default conditions: - lastTransitionTime: null - message: TCP Port 4000 not found on service default/grpc-backend + message: TCP Port 4000 not found on service default/grpc-backend. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-port.out.yaml b/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-port.out.yaml index 05db4b4438c..d571707aecc 100755 --- a/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-port.out.yaml +++ b/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-port.out.yaml @@ -24,7 +24,7 @@ envoyExtensionPolicies: conditions: - lastTransitionTime: null message: A valid port number corresponding to a port on the Service must be - specified + specified. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-reference-grant.out.yaml b/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-reference-grant.out.yaml index c4ad278a6c4..a3d0820b067 100755 --- a/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-reference-grant.out.yaml +++ b/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-reference-grant.out.yaml @@ -26,7 +26,7 @@ envoyExtensionPolicies: conditions: - lastTransitionTime: null message: Backend ref to Service envoy-gateway/grpc-backend not permitted by - any ReferenceGrant + any ReferenceGrant. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-service.out.yaml b/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-service.out.yaml index 7155bfe7243..0f1032195d6 100755 --- a/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-service.out.yaml +++ b/internal/gatewayapi/testdata/envoyextensionpolicy-with-extproc-invalid-no-service.out.yaml @@ -25,7 +25,7 @@ envoyExtensionPolicies: namespace: default conditions: - lastTransitionTime: null - message: Service envoy-gateway/grpc-backend not found + message: Service envoy-gateway/grpc-backend not found. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/httproute-and-backendtrafficpolicy-with-timeout-error.out.yaml b/internal/gatewayapi/testdata/httproute-and-backendtrafficpolicy-with-timeout-error.out.yaml index 88becd8a82a..49a6d1cc5d9 100644 --- a/internal/gatewayapi/testdata/httproute-and-backendtrafficpolicy-with-timeout-error.out.yaml +++ b/internal/gatewayapi/testdata/httproute-and-backendtrafficpolicy-with-timeout-error.out.yaml @@ -26,7 +26,7 @@ backendTrafficPolicies: sectionName: http conditions: - lastTransitionTime: null - message: 'Timeout: invalid ConnectTimeout value 20kib' + message: 'Timeout: invalid ConnectTimeout value 20kib.' reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/httproute-with-invalid-regex.out.yaml b/internal/gatewayapi/testdata/httproute-with-invalid-regex.out.yaml index a8e06b4fa54..c8285fb3ee8 100644 --- a/internal/gatewayapi/testdata/httproute-with-invalid-regex.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-invalid-regex.out.yaml @@ -103,7 +103,7 @@ httpRoutes: - conditions: - lastTransitionTime: null message: 'Regex "*.foo.bar.com" is invalid: error parsing regexp: missing - argument to repetition operator: `*`' + argument to repetition operator: `*`.' reason: UnsupportedValue status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/httproute-with-single-rule-with-multiple-rules.out.yaml b/internal/gatewayapi/testdata/httproute-with-single-rule-with-multiple-rules.out.yaml index 7cae3475b67..2b3440d9a60 100644 --- a/internal/gatewayapi/testdata/httproute-with-single-rule-with-multiple-rules.out.yaml +++ b/internal/gatewayapi/testdata/httproute-with-single-rule-with-multiple-rules.out.yaml @@ -93,7 +93,7 @@ httpRoutes: - conditions: - lastTransitionTime: null message: 'Regex "*regex*" is invalid: error parsing regexp: missing argument - to repetition operator: `*`' + to repetition operator: `*`.' reason: UnsupportedValue status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/merge-with-isolated-policies-2.out.yaml b/internal/gatewayapi/testdata/merge-with-isolated-policies-2.out.yaml index f8797d895ca..7bedafa6241 100755 --- a/internal/gatewayapi/testdata/merge-with-isolated-policies-2.out.yaml +++ b/internal/gatewayapi/testdata/merge-with-isolated-policies-2.out.yaml @@ -57,7 +57,7 @@ clientTrafficPolicies: conditions: - lastTransitionTime: null message: ClientTrafficPolicy is being applied to multiple http (non https) - listeners (default/gateway-2/http-2) on the same port, which is not allowed + listeners (default/gateway-2/http-2) on the same port, which is not allowed. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-matching-port.out.yaml b/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-matching-port.out.yaml index d23b2a7d8f7..aabb54434f4 100644 --- a/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-matching-port.out.yaml +++ b/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-matching-port.out.yaml @@ -126,7 +126,7 @@ securityPolicies: namespace: default conditions: - lastTransitionTime: null - message: TCP Port 80 not found on service default/http-backend + message: TCP Port 80 not found on service default/http-backend. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-port.out.yaml b/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-port.out.yaml index fb8d90097a0..1ef304673d8 100755 --- a/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-port.out.yaml +++ b/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-port.out.yaml @@ -126,7 +126,7 @@ securityPolicies: conditions: - lastTransitionTime: null message: A valid port number corresponding to a port on the Service must be - specified + specified. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-reference-grant.out.yaml b/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-reference-grant.out.yaml index 5d31bd10a9b..0dc44875c47 100644 --- a/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-reference-grant.out.yaml +++ b/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-reference-grant.out.yaml @@ -127,7 +127,7 @@ securityPolicies: conditions: - lastTransitionTime: null message: Backend ref to Service envoy-gateway/http-backend not permitted by - any ReferenceGrant + any ReferenceGrant. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-service.out.yaml b/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-service.out.yaml index da185ff74a0..de2e3010da3 100644 --- a/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-service.out.yaml +++ b/internal/gatewayapi/testdata/securitypolicy-with-extauth-invalid-no-service.out.yaml @@ -126,7 +126,7 @@ securityPolicies: namespace: default conditions: - lastTransitionTime: null - message: Service default/http-backend not found + message: Service default/http-backend not found. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/securitypolicy-with-jwt-and-invalid-oidc.out.yaml b/internal/gatewayapi/testdata/securitypolicy-with-jwt-and-invalid-oidc.out.yaml index b4e2932f294..f2af5bd857a 100644 --- a/internal/gatewayapi/testdata/securitypolicy-with-jwt-and-invalid-oidc.out.yaml +++ b/internal/gatewayapi/testdata/securitypolicy-with-jwt-and-invalid-oidc.out.yaml @@ -174,7 +174,7 @@ securityPolicies: sectionName: http conditions: - lastTransitionTime: null - message: Secret default/client2-secret does not exist + message: Secret default/client2-secret does not exist. reason: Invalid status: "False" type: Accepted @@ -219,7 +219,7 @@ securityPolicies: namespace: envoy-gateway conditions: - lastTransitionTime: null - message: Secret envoy-gateway/client1-secret does not exist + message: Secret envoy-gateway/client1-secret does not exist. reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/securitypolicy-with-oidc-invalid-issuer.out.yaml b/internal/gatewayapi/testdata/securitypolicy-with-oidc-invalid-issuer.out.yaml index d2a6d6afab3..34cdbe793ff 100644 --- a/internal/gatewayapi/testdata/securitypolicy-with-oidc-invalid-issuer.out.yaml +++ b/internal/gatewayapi/testdata/securitypolicy-with-oidc-invalid-issuer.out.yaml @@ -86,7 +86,7 @@ securityPolicies: conditions: - lastTransitionTime: null message: 'Error fetching endpoints from issuer: invalid character ''<'' looking - for beginning of value' + for beginning of value.' reason: Invalid status: "False" type: Accepted diff --git a/internal/gatewayapi/testdata/securitypolicy-with-oidc-invalid-secretref.out.yaml b/internal/gatewayapi/testdata/securitypolicy-with-oidc-invalid-secretref.out.yaml index 2ea3ac2420d..18d499d849c 100644 --- a/internal/gatewayapi/testdata/securitypolicy-with-oidc-invalid-secretref.out.yaml +++ b/internal/gatewayapi/testdata/securitypolicy-with-oidc-invalid-secretref.out.yaml @@ -197,7 +197,7 @@ securityPolicies: namespace: default conditions: - lastTransitionTime: null - message: Secret default/client1-secret does not exist + message: Secret default/client1-secret does not exist. reason: Invalid status: "False" type: Accepted @@ -234,7 +234,7 @@ securityPolicies: namespace: default conditions: - lastTransitionTime: null - message: Secret ref namespace must be unspecified/empty or default + message: Secret ref namespace must be unspecified/empty or default. reason: Invalid status: "False" type: Accepted @@ -270,7 +270,7 @@ securityPolicies: namespace: default conditions: - lastTransitionTime: null - message: Client secret not found in secret default/client3-secret + message: Client secret not found in secret default/client3-secret. reason: Invalid status: "False" type: Accepted diff --git a/internal/status/conditions.go b/internal/status/conditions.go index 092513184bb..036a59d1309 100644 --- a/internal/status/conditions.go +++ b/internal/status/conditions.go @@ -142,7 +142,7 @@ func conditionChanged(a, b metav1.Condition) bool { // Error2ConditionMsg format the error string to a Status condition message. // * Convert the first letter to capital -// * Append "." to the string if it doesn't exit +// * Append "." to the string if it doesn't exist func Error2ConditionMsg(err error) string { if err == nil { return "" @@ -161,6 +161,12 @@ func Error2ConditionMsg(err error) string { runes[0] = unicode.ToUpper(runes[0]) } + // Check if the last rune is a punctuation '.' and append it if not + last := runes[len(runes)-1] + if !unicode.IsPunct(last) || last != '.' { + runes = append(runes, '.') + } + // Convert the rune slice back to a string return string(runes) } diff --git a/internal/status/conditions_test.go b/internal/status/conditions_test.go index a1181b89b98..88620b7aa0c 100644 --- a/internal/status/conditions_test.go +++ b/internal/status/conditions_test.go @@ -356,7 +356,7 @@ func TestError2ConditionMsg(t *testing.T) { { name: "error with message", err: errors.New("something is wrong"), - expect: "Something is wrong", + expect: "Something is wrong.", }, } for _, tt := range testCases {