From 4af6a406f9e2c366599c9b42024947f3cd062877 Mon Sep 17 00:00:00 2001 From: Billy Schulze Date: Tue, 26 Nov 2024 15:46:48 +1100 Subject: [PATCH] Update HTTPRequestRedirectPolicy StatusCode Use RedirectResponseCode instead of just 301/302 for HTTPRequestRedirectPolicy StatusCode Fixes #6788 Signed-off-by: Billy Schulze --- apis/projectcontour/v1/httpproxy.go | 3 +-- changelogs/unreleased/6789-billyjs-small.md | 1 + examples/contour/01-crds.yaml | 4 ++++ examples/render/contour-deployment.yaml | 4 ++++ examples/render/contour-gateway-provisioner.yaml | 4 ++++ examples/render/contour-gateway.yaml | 4 ++++ examples/render/contour.yaml | 4 ++++ site/content/docs/main/config/api-reference.html | 7 +++++-- 8 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 changelogs/unreleased/6789-billyjs-small.md diff --git a/apis/projectcontour/v1/httpproxy.go b/apis/projectcontour/v1/httpproxy.go index 72ff28096d2..c173e0dd11f 100644 --- a/apis/projectcontour/v1/httpproxy.go +++ b/apis/projectcontour/v1/httpproxy.go @@ -714,8 +714,7 @@ type HTTPRequestRedirectPolicy struct { // StatusCode is the HTTP status code to be used in response. // +optional // +kubebuilder:default=302 - // +kubebuilder:validation:Enum=301;302 - StatusCode *int `json:"statusCode,omitempty"` + StatusCode *RedirectResponseCode `json:"statusCode,omitempty"` // Path allows for redirection to a different path from the // original on the request. The path must start with a diff --git a/changelogs/unreleased/6789-billyjs-small.md b/changelogs/unreleased/6789-billyjs-small.md new file mode 100644 index 00000000000..1beceb9ebba --- /dev/null +++ b/changelogs/unreleased/6789-billyjs-small.md @@ -0,0 +1 @@ +Use RedirectResponseCode instead of just 301/302 for HTTPRequestRedirectPolicy StatusCode diff --git a/examples/contour/01-crds.yaml b/examples/contour/01-crds.yaml index 2319e19c962..00103d3de92 100644 --- a/examples/contour/01-crds.yaml +++ b/examples/contour/01-crds.yaml @@ -6632,6 +6632,10 @@ spec: enum: - 301 - 302 + - 303 + - 307 + - 308 + format: int32 type: integer type: object responseHeadersPolicy: diff --git a/examples/render/contour-deployment.yaml b/examples/render/contour-deployment.yaml index a2db3e69e2a..5d3e2cc1acd 100644 --- a/examples/render/contour-deployment.yaml +++ b/examples/render/contour-deployment.yaml @@ -6852,6 +6852,10 @@ spec: enum: - 301 - 302 + - 303 + - 307 + - 308 + format: int32 type: integer type: object responseHeadersPolicy: diff --git a/examples/render/contour-gateway-provisioner.yaml b/examples/render/contour-gateway-provisioner.yaml index ec9255a644d..27218a1bbf1 100644 --- a/examples/render/contour-gateway-provisioner.yaml +++ b/examples/render/contour-gateway-provisioner.yaml @@ -6643,6 +6643,10 @@ spec: enum: - 301 - 302 + - 303 + - 307 + - 308 + format: int32 type: integer type: object responseHeadersPolicy: diff --git a/examples/render/contour-gateway.yaml b/examples/render/contour-gateway.yaml index a121a0e0872..f051eebfa66 100644 --- a/examples/render/contour-gateway.yaml +++ b/examples/render/contour-gateway.yaml @@ -6668,6 +6668,10 @@ spec: enum: - 301 - 302 + - 303 + - 307 + - 308 + format: int32 type: integer type: object responseHeadersPolicy: diff --git a/examples/render/contour.yaml b/examples/render/contour.yaml index 190b4c5999a..4c2c5400901 100644 --- a/examples/render/contour.yaml +++ b/examples/render/contour.yaml @@ -6852,6 +6852,10 @@ spec: enum: - 301 - 302 + - 303 + - 307 + - 308 + format: int32 type: integer type: object responseHeadersPolicy: diff --git a/site/content/docs/main/config/api-reference.html b/site/content/docs/main/config/api-reference.html index 57bc87795fd..ea317ba3b1a 100644 --- a/site/content/docs/main/config/api-reference.html +++ b/site/content/docs/main/config/api-reference.html @@ -1767,7 +1767,9 @@

HTTPRequestRedirectPolic statusCode
-int + +RedirectResponseCode + @@ -3085,7 +3087,8 @@

RedirectResponseCode (uint32 alias)

(Appears on: -HTTPInternalRedirectPolicy) +HTTPInternalRedirectPolicy, +HTTPRequestRedirectPolicy)

RedirectResponseCode is a uint32 type alias with validation to ensure that the value is valid.