Skip to content

Commit

Permalink
Merge pull request #2279 from pubudu538/cc-redis
Browse files Browse the repository at this point in the history
Add enabled flag for the CORs policy
  • Loading branch information
CrowleyRajapakse authored Apr 5, 2024
2 parents 1e180d5 + 7cedb27 commit e53299f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
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
8 changes: 8 additions & 0 deletions common-go-libs/config/crd/bases/dp.wso2.com_apipolicies.yaml
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

0 comments on commit e53299f

Please sign in to comment.