Skip to content
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

Add enabled flag for the CORs policy #2279

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions common-go-libs/apis/dp/v1alpha2/apipolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ type BackendJWTToken struct {

// CORSPolicy holds CORS policy information
type CORSPolicy struct {

// Enabled is to enable CORs policy for the API.
//
// +kubebuilder:default=true
// +optional
Enabled bool `json:"enabled,omitempty"`

// AllowCredentials indicates whether the request can include user credentials like
// cookies, HTTP authentication or client side SSL certificates.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ spec:
of a preflight request can be cached in a preflight result
cache.
type: integer
enabled:
default: true
description: Enabled is to enable CORs policy for the API.
type: boolean
type: object
requestInterceptors:
description: RequestInterceptors referenced to intercetor services
Expand Down Expand Up @@ -410,6 +414,10 @@ spec:
of a preflight request can be cached in a preflight result
cache.
type: integer
enabled:
default: true
description: Enabled is to enable CORs policy for the API.
type: boolean
type: object
requestInterceptors:
description: RequestInterceptors referenced to intercetor services
Expand Down
29 changes: 19 additions & 10 deletions helm-charts/crds/dp.wso2.com_apipolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.2
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.12.0
name: apipolicies.dp.wso2.com
spec:
group: dp.wso2.com
Expand Down Expand Up @@ -207,10 +206,11 @@ spec:
type: object
targetRef:
description: PolicyTargetReference identifies an API object to apply
policy to. This should be used as part of Policy resources that
can target Gateway API resources. For more information on how this
policy attachment model works, and a sample Policy resource, refer
to the policy attachment documentation for Gateway API.
a direct or inherited policy to. This should be used as part of
Policy resources that can target Gateway API resources. For more
information on how this policy attachment model works, and a sample
Policy resource, refer to the policy attachment documentation for
Gateway API.
properties:
group:
description: Group is the group of the target resource.
Expand Down Expand Up @@ -320,6 +320,10 @@ spec:
of a preflight request can be cached in a preflight result
cache.
type: integer
enabled:
default: true
description: Enabled is to enable CORs policy for the API.
type: boolean
type: object
requestInterceptors:
description: RequestInterceptors referenced to intercetor services
Expand Down Expand Up @@ -410,6 +414,10 @@ spec:
of a preflight request can be cached in a preflight result
cache.
type: integer
enabled:
default: true
description: Enabled is to enable CORs policy for the API.
type: boolean
type: object
requestInterceptors:
description: RequestInterceptors referenced to intercetor services
Expand Down Expand Up @@ -453,10 +461,11 @@ spec:
type: object
targetRef:
description: PolicyTargetReference identifies an API object to apply
policy to. This should be used as part of Policy resources that
can target Gateway API resources. For more information on how this
policy attachment model works, and a sample Policy resource, refer
to the policy attachment documentation for Gateway API.
a direct or inherited policy to. This should be used as part of
Policy resources that can target Gateway API resources. For more
information on how this policy attachment model works, and a sample
Policy resource, refer to the policy attachment documentation for
Gateway API.
properties:
group:
description: Group is the group of the target resource.
Expand Down
Loading