Skip to content

Commit 325253d

Browse files
committed
Simplify Vars field in HTTPRoutePolicy
Removed unnecessary descriptions and complex types for the `Vars` field, replacing them with a simpler `[]apiextensionsv1.JSON` type. Also, updated the deep copy logic to handle the new type, and removed unused imports.
1 parent b623982 commit 325253d

File tree

3 files changed

+6
-24
lines changed

3 files changed

+6
-24
lines changed

api/v1alpha1/httproutepolicy_types.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20+
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
22-
23-
"github.com/api7/api7-ingress-controller/api/common"
2423
)
2524

2625
// HTTPRoutePolicySpec defines the desired state of HTTPRoutePolicy.
@@ -36,8 +35,8 @@ type HTTPRoutePolicySpec struct {
3635
// +kubebuilder:validation:MaxItems=16
3736
TargetRefs []gatewayv1alpha2.LocalPolicyTargetReferenceWithSectionName `json:"targetRefs"`
3837

39-
Priority *int64 `json:"priority,omitempty" yaml:"priority,omitempty"`
40-
Vars Vars `json:"vars,omitempty" yaml:"vars,omitempty"`
38+
Priority *int64 `json:"priority,omitempty" yaml:"priority,omitempty"`
39+
Vars []apiextensionsv1.JSON `json:"vars,omitempty" yaml:"vars,omitempty"`
4140
}
4241

4342
// +kubebuilder:object:root=true
@@ -61,10 +60,6 @@ type HTTPRoutePolicyList struct {
6160
Items []HTTPRoutePolicy `json:"items"`
6261
}
6362

64-
// Vars represents the route match expressions of APISIX.
65-
// +kubebuilder:object:generate=false
66-
type Vars = common.Vars
67-
6863
func init() {
6964
SchemeBuilder.Register(&HTTPRoutePolicy{}, &HTTPRoutePolicyList{})
7065
}

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 2 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/gateway.apisix.io_httproutepolicies.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,8 @@ spec:
110110
- name
111111
x-kubernetes-list-type: map
112112
vars:
113-
description: Vars represents the route match expressions of APISIX.
114113
items:
115-
items:
116-
description: |-
117-
StringOrSlice represents a string or a string slice.
118-
TODO Do not use interface{} to avoid the reflection overheads.
119-
type: object
120-
type: array
114+
x-kubernetes-preserve-unknown-fields: true
121115
type: array
122116
required:
123117
- targetRefs

0 commit comments

Comments
 (0)