mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 16:06:51 +00:00
Add networking fuzzer
Signed-off-by: Christopher M. Luciano <cmluciano@us.ibm.com>
This commit is contained in:
@@ -17,10 +17,24 @@ limitations under the License.
|
||||
package fuzzer
|
||||
|
||||
import (
|
||||
fuzz "github.com/google/gofuzz"
|
||||
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
"k8s.io/kubernetes/pkg/apis/networking"
|
||||
)
|
||||
|
||||
// Funcs returns the fuzzer functions for the networking api group.
|
||||
var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
return []interface{}{}
|
||||
return []interface{}{
|
||||
func(np *networking.NetworkPolicyPeer, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(np) // fuzz self without calling this function again
|
||||
// TODO: Implement a fuzzer to generate valid keys, values and operators for
|
||||
// selector requirements.
|
||||
if np.IPBlock != nil {
|
||||
np.IPBlock = &networking.IPBlock{
|
||||
CIDR: "192.168.1.0/24",
|
||||
Except: []string{"192.168.1.1/24", "192.168.1.2/24"},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user