Skip to content

Commit beeb01d

Browse files
committed
updates based on reviews
1 parent 64547ff commit beeb01d

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

apis/v1alpha1/nginxproxy_types.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,9 @@ type RewriteClientIP struct {
155155
// Sets NGINX directive set_real_ip_from: https://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
156156
// This field is required if mode is set.
157157
// +kubebuilder:validation:MaxItems=16
158-
// +listType=map
158+
// +listType=map
159159
// +listMapKey=type
160160
//
161-
//
162161
// +optional
163162
TrustedAddresses []Address `json:"trustedAddresses,omitempty"`
164163
}
@@ -201,6 +200,6 @@ type AddressType string
201200

202201
const (
203202
// AddressTypeCIDR specifies that the address is a CIDR block.
204-
// kubebuilder:validation:Pattern=`^[\.a-zA-Z0-9::]*(\/([0-9]?[0-9]?[0-8]))$`
203+
// kubebuilder:validation:Pattern=`^[\.a-zA-Z0-9:]*(\/([0-9]?[0-9]?[0-9]))$`
205204
AddressTypeCIDR AddressType = "cidr"
206205
)

internal/mode/static/state/graph/nginxproxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func validateRewriteClientIP(npCfg *ngfAPI.NginxProxy) field.ErrorList {
186186
default:
187187
allErrs = append(
188188
allErrs,
189-
field.NotSupported(trustedAddressesPath.Child(addr.Value),
189+
field.NotSupported(trustedAddressesPath.Child("type"),
190190
addr.Type,
191191
[]string{string(ngfAPI.AddressTypeCIDR)},
192192
),

internal/mode/static/state/graph/nginxproxy_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ func TestValidateRewriteClientIP(t *testing.T) {
535535
},
536536
},
537537
expectErrCount: 1,
538-
errorString: "spec.rewriteClientIP.trustedAddresses.2001:db8::/129: " +
538+
errorString: "spec.rewriteClientIP.trustedAddresses.type: " +
539539
"Unsupported value: \"invalid\": supported values: \"cidr\"",
540540
},
541541
}

site/content/reference/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ string
533533
</thead>
534534
<tbody><tr><td><p>&#34;cidr&#34;</p></td>
535535
<td><p>AddressTypeCIDR specifies that the address is a CIDR block.
536-
kubebuilder:validation:Pattern=<code>^[\.a-zA-Z0-9::]*(\/([0-9]?[0-9]?[0-8]))$</code></p>
536+
kubebuilder:validation:Pattern=<code>^[\.a-zA-Z0-9:]*(\/([0-9]?[0-9]?[0-9]))$</code></p>
537537
</td>
538538
</tr></tbody>
539539
</table>

0 commit comments

Comments
 (0)