Commit Graph

97 Commits

Author SHA1 Message Date
Dan Winship
7a56b6e3f7 Add validation.IsValidCIDR
Move apivalidation.ValidateCIDR to apimachinery, and rename it and
change its return value to match the other functions.

Also, add unit tests.

(Also, while updating NetworkPolicy validation for the API change, fix
a variable name that implied that IPBlock.Except[] is IP-valued rather
than CIDR-valued.)
2024-02-07 09:48:01 -05:00
Kubernetes Prow Robot
052bce26f4
Merge pull request #122931 from danwinship/ip-validation-cleanup
consistently use IsValidIP for IP validation
2024-02-06 15:58:15 -08:00
liyuerich
e490439262 drop deprecated pointer package
Signed-off-by: liyuerich <yue.li@daocloud.io>
2024-01-24 19:44:07 +08:00
Dan Winship
1d59d6b6c6 Use validation.IsValidIP in a few more places
Rather than using netutils.ParseIPSloppy directly.

Also fix the field paths in the errors for pod.spec.hostAliases to
include the array index.
2024-01-23 09:10:35 -05:00
Antonio Ojea
c3d9b77d94 update ServiceCIDR API: replace IPv4,IPv6 fields by an array of strings
https: //docs.google.com/document/d/1-CKDPRHsG6XfnGs-Bb7ptWgDtTq9-hj8aJQpGz1CSh8/edit

Change-Id: If7134a5553b4ecc12b1d58ffc52ebb9f8594778a
2023-10-31 21:05:06 +00:00
Antonio Ojea
632081a907 add ServiceCIDR APIs
Change-Id: Ia084c5505e43033ac34449031a1d32418ca326fd

Change-Id: Iafc236d456f7185a5c89a65d7b96245e04060013
2023-10-31 21:05:04 +00:00
Antonio Ojea
16363b6fb4 fix IPAddress.Name validation message
Change-Id: Idc29166d69c1eadd6e4dac3bf16f4a6739f98be2
2023-10-31 21:05:04 +00:00
Antonio Ojea
c2d473f0d4 remove ClusterCIDR
KEP-2593 proposed to expand the existing node-ipam controller
to be configurable via a ClusterCIDR objects, however, there
were reasonable doubts on the SIG about the feature and after
several months of dicussions we decided to not move forward
with the KEP intree, hence, we are going to remove the existing
code, that is still in alpha.

https://groups.google.com/g/kubernetes-sig-network/c/nts1xEZ--gQ/m/2aTOUNFFAAAJ

Change-Id: Ieaf2007b0b23c296cde333247bfb672441fe6dfc
2023-10-14 19:06:22 +00:00
Tim Hockin
d55b67b349
Clean up brace whitespace in **/validation_test.go
This was making my eyes bleed as I read over code.

I used the following in vim.  I made them up on the fly, but they seemed
to pass manual inspection.

:g/},\n\s*{$/s//}, {/
:w
:g/{$\n\s*{$/s//{{/
:w
:g/^\(\s*\)},\n\1},$/s//}},/
:w
:g/^\(\s*\)},$\n\1}$/s//}}/
:w
2023-05-02 00:48:42 -07:00
Ricardo Katz
bff8a6cd9f Remove withdrawn feature NetworkPolicyStatus 2023-05-01 15:19:25 -03:00
Stephen Kitt
4911e9de4a
api: replace intstr.FromInt with intstr.FromInt32
This touches cases where FromInt() is used on numeric constants, or
values which are already int32s, or int variables which are defined
close by and can be changed to int32s with little impact.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2023-05-01 09:16:15 +02:00
mouuii
becf73a82b add invaild scope test case
Signed-off-by: mouuii <49775493+mouuii@users.noreply.github.com>
2023-04-14 11:55:08 +08:00
Kubernetes Prow Robot
8decaf3ae7
Merge pull request #115447 from kidddddddddddddddddddddd/ingress
[ingress] Create with ingressClass annotation and IngressClassName both set
2023-03-15 02:02:16 -07:00
Antonio Ojea
c36562dfd7 IPAddress validation
Validate IPAddress name is in canonical format
Validate ParentRef is required, and Resource and Name.
Validate IPAddress is inmutable on update.
2023-03-14 22:56:44 +00:00
kidddddddddddddddddddddd
488d7650f4 update description 2023-03-14 09:42:41 +08:00
kidddddddddddddddddddddd
113355a5a2 loosen check rules for ingress creation 2023-02-01 15:21:45 +08:00
TommyStarK
f166a52573 pkg/apis: Replace deprecated pointer function
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
2023-01-05 11:48:05 +01:00
Jordan Liggitt
fc69084bf1
Update workload selector validation 2022-11-07 20:52:02 -05:00
Manjusaka
0843c4dfca
Add extra value validation for matchExpression field in LabelSelector 2022-11-07 20:48:21 -05:00
Tim Hockin
0153bfad16
Copy LoadBalancerStatus from core to networking
This type should never have been shared between Service and Ingress.
The `ports` field is unfortunate, but it is needed to stay compatible.
2022-11-02 16:13:31 -07:00
Sarvesh Rangnekar
7093b10416 Introduce networking/v1alpha1 api, ClusterCIDR type
Introduce networking/v1alpha1 api group.

Add `ClusterCIDR` type to networking/v1alpha1 api group, this type
will enable the NodeIPAM controller to support multiple ClusterCIDRs.
2022-08-05 00:54:00 +00:00
Abirdcfly
f715e9cb24 cleanup:use copy other than for loop
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-06-28 16:29:22 +08:00
James Laverack
7d57d5c70d Revert "Introduce APIs to support multiple ClusterCIDRs (#108290)"
This reverts commit b9792a9dae.
2022-04-13 13:58:19 +01:00
Sarvesh Rangnekar
b9792a9dae
Introduce APIs to support multiple ClusterCIDRs (#108290)
* Introduce networking/v1alpha1 api, ClusterCIDRConfig type

Introduce networking/v1alpha1 api group.

Add `ClusterCIDRConfig` type to networking/v1alpha1 api group, this type
will enable the NodeIPAM controller to support multiple ClusterCIDRs.

* Change ClusterCIDRConfig.NodeSelector type in api

* Fix review comments for API

* Update ClusterCIDRConfig API Spec

Introduce PerNodeHostBits field, remove PerNodeMaskSize
2022-03-30 19:39:00 -07:00
Ricardo Katz
42a1201082
Implementation on Network Policy Status (#107963)
* Implement status subresource in NetworkPolicy

* add NetworkPolicyStatus generated files

* Fix comments in netpol status review
2022-03-29 01:52:48 -07:00
Harry Bagdi
d09a8c0a88 Graduate IngressClassNamespacedParams to GA 2021-11-10 08:58:39 -08:00
Antonio Ojea
0cd75e8fec run hack/update-netparse-cve.sh 2021-08-20 10:42:09 +02:00
Jordan Liggitt
c702dd4394 Drop legacy validation logic for networking API 2021-08-09 12:37:45 -04:00
Vikram Jadhav
a9a3c4bb9a Refactor of TestValidateIngressClass and TestValidateIngressClassUpdate methods by adding Boilerplate in helper functions #FIXES: 99005 2021-07-07 22:35:35 +05:30
Kubernetes Prow Robot
21f41b8e82
Merge pull request #101711 from hbagdi/ingressclass-namespaced-params-beta
graduate IngressClassNamespacedParams to beta
2021-06-29 17:07:03 -07:00
Harry Bagdi
60377ba1a3 graduate IngressClassNamespacedParams to beta 2021-05-03 15:00:40 -07:00
卢振兴10069964
4e447acab0 code cleanup for pkg/api and pkg/apis 2021-04-28 08:57:23 +08:00
Kubernetes Prow Robot
6409ec97e8
Merge pull request #99165 from danielamlins/test_validate_network_policy_refactor
TestValidateNetworkPolicy refactor
2021-04-08 14:27:49 -07:00
Daniela Lins
6c105c9e8a Linewrap for makePort calls and lint fixes
Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-03-25 17:12:02 +01:00
Daniela Lins
22cc8dc3a8 Specify IPV4 on tweak names
Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-03-25 16:57:11 +01:00
Daniela Lins
f4e469ee14 Standardize Namespace and Podselector tweaks
Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-03-25 16:50:28 +01:00
Daniela Lins
5f47d0e8ef Reduce vertical space
Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-03-25 16:41:06 +01:00
Daniela Lins
cb48e3cfca Handle int and string port in makePort
Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-03-25 16:35:23 +01:00
Daniela Lins
853d2a6a0a Delete not used tweak
Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-03-08 15:03:12 +01:00
Daniela Lins
36e040f86e Fix empty setter logic
Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-03-07 13:13:09 +01:00
Harry Bagdi
a7fc92089a Add namespace scoped ParametersReference to IngressClass 2021-03-07 00:45:32 +05:30
Daniela Lins
0444bdc944 Remove success case comments
Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-03-06 19:18:19 +01:00
Daniela Lins
f8e7d30e46 Make tweaks only reset slices if empty
Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-03-06 18:58:33 +01:00
Daniela Lins
6d330d9738 Refactored setIngressPorts and setEgressPorts
Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-03-06 16:51:35 +01:00
Benjamin Elder
56e092e382 hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
Daniela Lins
611f061c45 Change error msg and comments to easily find test
Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-02-24 13:09:13 +01:00
Daniela Lins
f7482a6766 Went through the review notes
- Adapt tweaks to be clearer
- Use intstr.fromInt and intstr.fromStr
- Added more tests to invalid ports

Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-02-21 12:22:17 +01:00
Daniela Lins
c9a5bf14d8 Fixed gofmt issues
Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-02-18 10:02:27 +01:00
Daniela Lins
8572c973d8 Add IPV6 IPBlock to success cases
Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-02-17 23:02:57 +01:00
Daniela Lins
77da0540e6 Add tweaks and use them to build error structs
Signed-off-by: Daniela Lins <danielamlins@gmail.com>
2021-02-16 19:46:35 +01:00