@@ -60,29 +60,54 @@ const (
60
60
PassHostRewrite = "rewrite"
61
61
)
62
62
63
+ type Object interface {
64
+ GetLabels () map [string ]string
65
+ }
66
+
67
+ // +k8s:deepcopy-gen=true
63
68
type Metadata struct {
64
69
ID string `json:"id,omitempty" yaml:"id,omitempty"`
65
70
Name string `json:"name,omitempty" yaml:"name,omitempty"`
66
71
Desc string `json:"description,omitempty" yaml:"description,omitempty"`
67
72
Labels map [string ]string `json:"labels,omitempty" yaml:"labels,omitempty"`
68
73
}
69
74
75
+ func (m * Metadata ) GetLabels () map [string ]string { return m .Labels }
76
+
70
77
type Resources struct {
71
78
ConsumerGroups []* ConsumerGroup `json:"consumer_groups,omitempty" yaml:"consumer_groups,omitempty"`
72
79
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"`
75
82
Services []* Service `json:"services,omitempty" yaml:"services,omitempty"`
76
83
SSLs []* SSL `json:"ssls,omitempty" yaml:"ssls,omitempty"`
77
84
}
78
85
86
+ type GlobalRule Plugins
87
+
88
+ func (g * GlobalRule ) DeepCopy () GlobalRule {
89
+ original := Plugins (* g )
90
+ copied := original .DeepCopy ()
91
+ return GlobalRule (copied )
92
+ }
93
+
94
+ type PluginMetadata Plugins
95
+
96
+ func (p * PluginMetadata ) DeepCopy () PluginMetadata {
97
+ original := Plugins (* p )
98
+ copied := original .DeepCopy ()
99
+ return PluginMetadata (copied )
100
+ }
101
+
102
+ // +k8s:deepcopy-gen=true
79
103
type ConsumerGroup struct {
80
104
Metadata `json:",inline" yaml:",inline"`
81
105
Consumers []Consumer `json:"consumers,omitempty" yaml:"consumers,omitempty"`
82
106
Name string `json:"name" yaml:"name"`
83
107
Plugins Plugins `json:"plugins" yaml:"plugins"`
84
108
}
85
109
110
+ // +k8s:deepcopy-gen=true
86
111
type Consumer struct {
87
112
Credentials []Credential `json:"credentials,omitempty" yaml:"credentials,omitempty"`
88
113
Description string `json:"description,omitempty" yaml:"description,omitempty"`
@@ -91,13 +116,15 @@ type Consumer struct {
91
116
Username string `json:"username" yaml:"username"`
92
117
}
93
118
119
+ // +k8s:deepcopy-gen=true
94
120
type Credential struct {
95
121
Metadata `json:",inline" yaml:",inline"`
96
122
97
- Config map [ string ] any `json:"config" yaml:"config"`
98
- Type string `json:"type" yaml:"type"`
123
+ Config Plugins `json:"config" yaml:"config"`
124
+ Type string `json:"type" yaml:"type"`
99
125
}
100
126
127
+ // +k8s:deepcopy-gen=true
101
128
type Service struct {
102
129
Metadata `json:",inline" yaml:",inline"`
103
130
@@ -110,6 +137,7 @@ type Service struct {
110
137
Upstream * Upstream `json:"upstream,omitempty" yaml:"upstream,omitempty"`
111
138
}
112
139
140
+ // +k8s:deepcopy-gen=true
113
141
type Route struct {
114
142
Metadata `json:",inline" yaml:",inline"`
115
143
@@ -131,6 +159,7 @@ type Timeout struct {
131
159
Send int `json:"send"`
132
160
}
133
161
162
+ // +k8s:deepcopy-gen=true
134
163
type StreamRoute struct {
135
164
Description string `json:"description,omitempty"`
136
165
ID string `json:"id,omitempty"`
@@ -143,6 +172,7 @@ type StreamRoute struct {
143
172
Sni string `json:"sni,omitempty"`
144
173
}
145
174
175
+ // +k8s:deepcopy-gen=true
146
176
type Upstream struct {
147
177
Metadata `json:",inline" yaml:",inline"`
148
178
@@ -159,13 +189,15 @@ type Upstream struct {
159
189
UpstreamHost string `json:"upstream_host,omitempty" yaml:"upstream_host,omitempty"`
160
190
}
161
191
192
+ // +k8s:deepcopy-gen=true
162
193
type TLSClass struct {
163
194
ClientCERT string `json:"client_cert,omitempty"`
164
195
ClientCERTID string `json:"client_cert_id,omitempty"`
165
196
ClientKey string `json:"client_key,omitempty"`
166
197
Verify * bool `json:"verify,omitempty"`
167
198
}
168
199
200
+ // +k8s:deepcopy-gen=true
169
201
type SSL struct {
170
202
Metadata `json:",inline" yaml:",inline"`
171
203
@@ -176,11 +208,13 @@ type SSL struct {
176
208
Type * SSLType `json:"type,omitempty" yaml:"type,omitempty"`
177
209
}
178
210
211
+ // +k8s:deepcopy-gen=true
179
212
type Certificate struct {
180
213
Certificate string `json:"certificate" yaml:"certificate"`
181
214
Key string `json:"key" yaml:"key"`
182
215
}
183
216
217
+ // +k8s:deepcopy-gen=true
184
218
type ClientClass struct {
185
219
CA string `json:"ca" yaml:"ca"`
186
220
Depth * int64 `json:"depth,omitempty" yaml:"depth,omitempty"`
@@ -517,6 +551,7 @@ func (vars *Vars) UnmarshalJSON(p []byte) error {
517
551
518
552
// StringOrSlice represents a string or a string slice.
519
553
// TODO Do not use interface{} to avoid the reflection overheads.
554
+ // +k8s:deepcopy-gen=true
520
555
type StringOrSlice struct {
521
556
StrVal string `json:"-"`
522
557
SliceVal []StringOrSlice `json:"-"`
0 commit comments