@@ -27,20 +27,6 @@ type NginxProxyList struct {
27
27
Items []NginxProxy `json:"items"`
28
28
}
29
29
30
- // IPFamilyType specifies the IP family to be used by NGINX.
31
- //
32
- // +kubebuilder:validation:Enum=dual;ipv4;ipv6
33
- type IPFamilyType string
34
-
35
- const (
36
- // Dual specifies that NGINX will use both IPv4 and IPv6.
37
- Dual IPFamilyType = "dual"
38
- // IPv4 specifies that NGINX will use only IPv4.
39
- IPv4 IPFamilyType = "ipv4"
40
- // IPv6 specifies that NGINX will use only IPv6.
41
- IPv6 IPFamilyType = "ipv6"
42
- )
43
-
44
30
// NginxProxySpec defines the desired state of the NginxProxy.
45
31
type NginxProxySpec struct {
46
32
// IPFamily specifies the IP family to be used by the NGINX.
@@ -154,11 +140,11 @@ type RewriteClientIP struct {
154
140
// If no addresses are provided, NGINX will not rewrite the client IP information.
155
141
// Sets NGINX directive set_real_ip_from: https://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
156
142
// This field is required if mode is set.
157
- // +kubebuilder:validation:MaxItems=16
158
- // +listType=map
159
- // +listMapKey=type
160
143
//
161
144
// +optional
145
+ // +listType=map
146
+ // +listMapKey=type
147
+ // +kubebuilder:validation:MaxItems=16
162
148
TrustedAddresses []Address `json:"trustedAddresses,omitempty"`
163
149
}
164
150
@@ -179,27 +165,40 @@ const (
179
165
RewriteClientIPModeXForwardedFor RewriteClientIPModeType = "XForwardedFor"
180
166
)
181
167
168
+ // IPFamilyType specifies the IP family to be used by NGINX.
169
+ //
170
+ // +kubebuilder:validation:Enum=dual;ipv4;ipv6
171
+ type IPFamilyType string
172
+
173
+ const (
174
+ // Dual specifies that NGINX will use both IPv4 and IPv6.
175
+ Dual IPFamilyType = "dual"
176
+ // IPv4 specifies that NGINX will use only IPv4.
177
+ IPv4 IPFamilyType = "ipv4"
178
+ // IPv6 specifies that NGINX will use only IPv6.
179
+ IPv6 IPFamilyType = "ipv6"
180
+ )
181
+
182
182
// Address is a struct that specifies address type and value.
183
183
type Address struct {
184
184
// Type specifies the type of address.
185
- // Default is "cidr" which specifies that the address is a CIDR block.
186
- //
187
- // +optional
188
- // +kubebuilder:default:=cidr
189
- Type AddressType `json:"type,omitempty"`
185
+ Type AddressType `json:"type"`
190
186
191
187
// Value specifies the address value.
192
- //
193
- // +optional
194
- Value string `json:"value,omitempty"`
188
+ Value string `json:"value"`
195
189
}
196
190
197
191
// AddressType specifies the type of address.
198
- // +kubebuilder:validation:Enum=cidr
192
+ // +kubebuilder:validation:Enum=CIDR;IPAddress;Hostname
199
193
type AddressType string
200
194
201
195
const (
202
- // AddressTypeCIDR specifies that the address is a CIDR block.
203
- // kubebuilder:validation:Pattern=`^[\.a-zA-Z0-9:]*(\/([0-9]?[0-9]?[0-9]))$`
204
- AddressTypeCIDR AddressType = "cidr"
196
+ // CIDRAddressType specifies that the address is a CIDR block.
197
+ CIDRAddressType AddressType = "CIDR"
198
+
199
+ // IPAddressType specifies that the address is an IP address.
200
+ IPAddressType AddressType = "IPAddress"
201
+
202
+ // HostnameAddressType specifies that the address is a Hostname.
203
+ HostnameAddressType AddressType = "Hostname"
205
204
)
0 commit comments