@@ -60,29 +60,48 @@ const (
6060 PassHostRewrite = "rewrite"
6161)
6262
63+ type Object interface {
64+ GetLabels () map [string ]string
65+ }
66+
67+ // +k8s:deepcopy-gen=true
6368type Metadata struct {
6469 ID string `json:"id,omitempty" yaml:"id,omitempty"`
6570 Name string `json:"name,omitempty" yaml:"name,omitempty"`
6671 Desc string `json:"description,omitempty" yaml:"description,omitempty"`
6772 Labels map [string ]string `json:"labels,omitempty" yaml:"labels,omitempty"`
6873}
6974
75+ func (m * Metadata ) GetLabels () map [string ]string { return m .Labels }
76+
7077type Resources struct {
7178 ConsumerGroups []* ConsumerGroup `json:"consumer_groups,omitempty" yaml:"consumer_groups,omitempty"`
7279 Consumers []* Consumer `json:"consumers,omitempty" yaml:"consumers,omitempty"`
73- GlobalRules Plugins `json:"global_rules,omitempty" yaml:"global_rules,omitempty"`
74- PluginMetadata Plugins `json:"plugin_metadata,omitempty" yaml:"plugin_metadata,omitempty"`
80+ GlobalRules GlobalRule `json:"global_rules,omitempty" yaml:"global_rules,omitempty"`
81+ PluginMetadata PluginMetadata `json:"plugin_metadata,omitempty" yaml:"plugin_metadata,omitempty"`
7582 Services []* Service `json:"services,omitempty" yaml:"services,omitempty"`
7683 SSLs []* SSL `json:"ssls,omitempty" yaml:"ssls,omitempty"`
7784}
7885
86+ // +k8s:deepcopy-gen=true
87+ type GlobalRule struct {
88+ Plugins `json:"plugins,omitempty" yaml:"plugins,omitempty"`
89+ }
90+
91+ // +k8s:deepcopy-gen=true
92+ type PluginMetadata struct {
93+ Plugins `json:"plugins,omitempty" yaml:"plugins,omitempty"`
94+ }
95+
96+ // +k8s:deepcopy-gen=true
7997type ConsumerGroup struct {
8098 Metadata `json:",inline" yaml:",inline"`
8199 Consumers []Consumer `json:"consumers,omitempty" yaml:"consumers,omitempty"`
82100 Name string `json:"name" yaml:"name"`
83101 Plugins Plugins `json:"plugins" yaml:"plugins"`
84102}
85103
104+ // +k8s:deepcopy-gen=true
86105type Consumer struct {
87106 Credentials []Credential `json:"credentials,omitempty" yaml:"credentials,omitempty"`
88107 Description string `json:"description,omitempty" yaml:"description,omitempty"`
@@ -91,13 +110,15 @@ type Consumer struct {
91110 Username string `json:"username" yaml:"username"`
92111}
93112
113+ // +k8s:deepcopy-gen=true
94114type Credential struct {
95115 Metadata `json:",inline" yaml:",inline"`
96116
97- Config map [ string ] any `json:"config" yaml:"config"`
98- Type string `json:"type" yaml:"type"`
117+ Config Plugins `json:"config" yaml:"config"`
118+ Type string `json:"type" yaml:"type"`
99119}
100120
121+ // +k8s:deepcopy-gen=true
101122type Service struct {
102123 Metadata `json:",inline" yaml:",inline"`
103124
@@ -110,6 +131,7 @@ type Service struct {
110131 Upstream * Upstream `json:"upstream,omitempty" yaml:"upstream,omitempty"`
111132}
112133
134+ // +k8s:deepcopy-gen=true
113135type Route struct {
114136 Metadata `json:",inline" yaml:",inline"`
115137
@@ -131,6 +153,7 @@ type Timeout struct {
131153 Send int `json:"send"`
132154}
133155
156+ // +k8s:deepcopy-gen=true
134157type StreamRoute struct {
135158 Description string `json:"description,omitempty"`
136159 ID string `json:"id,omitempty"`
@@ -143,6 +166,7 @@ type StreamRoute struct {
143166 Sni string `json:"sni,omitempty"`
144167}
145168
169+ // +k8s:deepcopy-gen=true
146170type Upstream struct {
147171 Metadata `json:",inline" yaml:",inline"`
148172
@@ -159,13 +183,15 @@ type Upstream struct {
159183 UpstreamHost string `json:"upstream_host,omitempty" yaml:"upstream_host,omitempty"`
160184}
161185
186+ // +k8s:deepcopy-gen=true
162187type TLSClass struct {
163188 ClientCERT string `json:"client_cert,omitempty"`
164189 ClientCERTID string `json:"client_cert_id,omitempty"`
165190 ClientKey string `json:"client_key,omitempty"`
166191 Verify * bool `json:"verify,omitempty"`
167192}
168193
194+ // +k8s:deepcopy-gen=true
169195type SSL struct {
170196 Metadata `json:",inline" yaml:",inline"`
171197
@@ -176,11 +202,13 @@ type SSL struct {
176202 Type * SSLType `json:"type,omitempty" yaml:"type,omitempty"`
177203}
178204
205+ // +k8s:deepcopy-gen=true
179206type Certificate struct {
180207 Certificate string `json:"certificate" yaml:"certificate"`
181208 Key string `json:"key" yaml:"key"`
182209}
183210
211+ // +k8s:deepcopy-gen=true
184212type ClientClass struct {
185213 CA string `json:"ca" yaml:"ca"`
186214 Depth * int64 `json:"depth,omitempty" yaml:"depth,omitempty"`
@@ -517,6 +545,7 @@ func (vars *Vars) UnmarshalJSON(p []byte) error {
517545
518546// StringOrSlice represents a string or a string slice.
519547// TODO Do not use interface{} to avoid the reflection overheads.
548+ // +k8s:deepcopy-gen=true
520549type StringOrSlice struct {
521550 StrVal string `json:"-"`
522551 SliceVal []StringOrSlice `json:"-"`
0 commit comments