@@ -27,20 +27,6 @@ type NginxProxyList struct {
2727 Items []NginxProxy `json:"items"`
2828}
2929
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-
4430// NginxProxySpec defines the desired state of the NginxProxy.
4531type NginxProxySpec struct {
4632 // IPFamily specifies the IP family to be used by the NGINX.
@@ -154,11 +140,11 @@ type RewriteClientIP struct {
154140 // If no addresses are provided, NGINX will not rewrite the client IP information.
155141 // Sets NGINX directive set_real_ip_from: https://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
156142 // This field is required if mode is set.
157- // +kubebuilder:validation:MaxItems=16
158- // +listType=map
159- // +listMapKey=type
160143 //
161144 // +optional
145+ // +listType=map
146+ // +listMapKey=type
147+ // +kubebuilder:validation:MaxItems=16
162148 TrustedAddresses []Address `json:"trustedAddresses,omitempty"`
163149}
164150
@@ -179,27 +165,40 @@ const (
179165 RewriteClientIPModeXForwardedFor RewriteClientIPModeType = "XForwardedFor"
180166)
181167
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+
182182// Address is a struct that specifies address type and value.
183183type Address struct {
184184 // 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"`
190186
191187 // Value specifies the address value.
192- //
193- // +optional
194- Value string `json:"value,omitempty"`
188+ Value string `json:"value"`
195189}
196190
197191// AddressType specifies the type of address.
198- // +kubebuilder:validation:Enum=cidr
192+ // +kubebuilder:validation:Enum=CIDR;IPAddress;Hostname
199193type AddressType string
200194
201195const (
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"
205204)
0 commit comments