mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
pkg/apis/core: fixup package names
This commit is contained in:
@@ -29,16 +29,16 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/apis/core"
|
||||
)
|
||||
|
||||
// Funcs returns the fuzzer functions for the core api group.
|
||||
// Funcs returns the fuzzer functions for the core core group.
|
||||
var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
return []interface{}{
|
||||
func(q *resource.Quantity, c fuzz.Continue) {
|
||||
*q = *resource.NewQuantity(c.Int63n(1000), resource.DecimalExponent)
|
||||
},
|
||||
func(j *api.ObjectReference, c fuzz.Continue) {
|
||||
func(j *core.ObjectReference, c fuzz.Continue) {
|
||||
// We have to customize the randomization of TypeMetas because their
|
||||
// APIVersion and Kind must remain blank in memory.
|
||||
j.APIVersion = c.RandString()
|
||||
@@ -48,21 +48,21 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
j.ResourceVersion = strconv.FormatUint(c.RandUint64(), 10)
|
||||
j.FieldPath = c.RandString()
|
||||
},
|
||||
func(j *api.ListOptions, c fuzz.Continue) {
|
||||
func(j *core.ListOptions, c fuzz.Continue) {
|
||||
label, _ := labels.Parse("a=b")
|
||||
j.LabelSelector = label
|
||||
field, _ := fields.ParseSelector("a=b")
|
||||
j.FieldSelector = field
|
||||
},
|
||||
func(j *api.PodExecOptions, c fuzz.Continue) {
|
||||
func(j *core.PodExecOptions, c fuzz.Continue) {
|
||||
j.Stdout = true
|
||||
j.Stderr = true
|
||||
},
|
||||
func(j *api.PodAttachOptions, c fuzz.Continue) {
|
||||
func(j *core.PodAttachOptions, c fuzz.Continue) {
|
||||
j.Stdout = true
|
||||
j.Stderr = true
|
||||
},
|
||||
func(j *api.PodPortForwardOptions, c fuzz.Continue) {
|
||||
func(j *core.PodPortForwardOptions, c fuzz.Continue) {
|
||||
if c.RandBool() {
|
||||
j.Ports = make([]int32, c.Intn(10))
|
||||
for i := range j.Ports {
|
||||
@@ -70,7 +70,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
}
|
||||
}
|
||||
},
|
||||
func(s *api.PodSpec, c fuzz.Continue) {
|
||||
func(s *core.PodSpec, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(s)
|
||||
// has a default value
|
||||
ttl := int64(30)
|
||||
@@ -82,35 +82,35 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
c.Fuzz(s.SecurityContext)
|
||||
|
||||
if s.SecurityContext == nil {
|
||||
s.SecurityContext = new(api.PodSecurityContext)
|
||||
s.SecurityContext = new(core.PodSecurityContext)
|
||||
}
|
||||
if s.Affinity == nil {
|
||||
s.Affinity = new(api.Affinity)
|
||||
s.Affinity = new(core.Affinity)
|
||||
}
|
||||
if s.SchedulerName == "" {
|
||||
s.SchedulerName = api.DefaultSchedulerName
|
||||
s.SchedulerName = core.DefaultSchedulerName
|
||||
}
|
||||
},
|
||||
func(j *api.PodPhase, c fuzz.Continue) {
|
||||
statuses := []api.PodPhase{api.PodPending, api.PodRunning, api.PodFailed, api.PodUnknown}
|
||||
func(j *core.PodPhase, c fuzz.Continue) {
|
||||
statuses := []core.PodPhase{core.PodPending, core.PodRunning, core.PodFailed, core.PodUnknown}
|
||||
*j = statuses[c.Rand.Intn(len(statuses))]
|
||||
},
|
||||
func(j *api.Binding, c fuzz.Continue) {
|
||||
func(j *core.Binding, c fuzz.Continue) {
|
||||
c.Fuzz(&j.ObjectMeta)
|
||||
j.Target.Name = c.RandString()
|
||||
},
|
||||
func(j *api.ReplicationControllerSpec, c fuzz.Continue) {
|
||||
func(j *core.ReplicationControllerSpec, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(j) // fuzz self without calling this function again
|
||||
//j.TemplateRef = nil // this is required for round trip
|
||||
},
|
||||
func(j *api.List, c fuzz.Continue) {
|
||||
func(j *core.List, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(j) // fuzz self without calling this function again
|
||||
// TODO: uncomment when round trip starts from a versioned object
|
||||
if false { //j.Items == nil {
|
||||
j.Items = []runtime.Object{}
|
||||
}
|
||||
},
|
||||
func(q *api.ResourceRequirements, c fuzz.Continue) {
|
||||
func(q *core.ResourceRequirements, c fuzz.Continue) {
|
||||
randomQuantity := func() resource.Quantity {
|
||||
var q resource.Quantity
|
||||
c.Fuzz(&q)
|
||||
@@ -118,52 +118,52 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
_ = q.String()
|
||||
return q
|
||||
}
|
||||
q.Limits = make(api.ResourceList)
|
||||
q.Requests = make(api.ResourceList)
|
||||
q.Limits = make(core.ResourceList)
|
||||
q.Requests = make(core.ResourceList)
|
||||
cpuLimit := randomQuantity()
|
||||
q.Limits[api.ResourceCPU] = *cpuLimit.Copy()
|
||||
q.Requests[api.ResourceCPU] = *cpuLimit.Copy()
|
||||
q.Limits[core.ResourceCPU] = *cpuLimit.Copy()
|
||||
q.Requests[core.ResourceCPU] = *cpuLimit.Copy()
|
||||
memoryLimit := randomQuantity()
|
||||
q.Limits[api.ResourceMemory] = *memoryLimit.Copy()
|
||||
q.Requests[api.ResourceMemory] = *memoryLimit.Copy()
|
||||
q.Limits[core.ResourceMemory] = *memoryLimit.Copy()
|
||||
q.Requests[core.ResourceMemory] = *memoryLimit.Copy()
|
||||
storageLimit := randomQuantity()
|
||||
q.Limits[api.ResourceStorage] = *storageLimit.Copy()
|
||||
q.Requests[api.ResourceStorage] = *storageLimit.Copy()
|
||||
q.Limits[core.ResourceStorage] = *storageLimit.Copy()
|
||||
q.Requests[core.ResourceStorage] = *storageLimit.Copy()
|
||||
},
|
||||
func(q *api.LimitRangeItem, c fuzz.Continue) {
|
||||
func(q *core.LimitRangeItem, c fuzz.Continue) {
|
||||
var cpuLimit resource.Quantity
|
||||
c.Fuzz(&cpuLimit)
|
||||
|
||||
q.Type = api.LimitTypeContainer
|
||||
q.Default = make(api.ResourceList)
|
||||
q.Default[api.ResourceCPU] = *(cpuLimit.Copy())
|
||||
q.Type = core.LimitTypeContainer
|
||||
q.Default = make(core.ResourceList)
|
||||
q.Default[core.ResourceCPU] = *(cpuLimit.Copy())
|
||||
|
||||
q.DefaultRequest = make(api.ResourceList)
|
||||
q.DefaultRequest[api.ResourceCPU] = *(cpuLimit.Copy())
|
||||
q.DefaultRequest = make(core.ResourceList)
|
||||
q.DefaultRequest[core.ResourceCPU] = *(cpuLimit.Copy())
|
||||
|
||||
q.Max = make(api.ResourceList)
|
||||
q.Max[api.ResourceCPU] = *(cpuLimit.Copy())
|
||||
q.Max = make(core.ResourceList)
|
||||
q.Max[core.ResourceCPU] = *(cpuLimit.Copy())
|
||||
|
||||
q.Min = make(api.ResourceList)
|
||||
q.Min[api.ResourceCPU] = *(cpuLimit.Copy())
|
||||
q.Min = make(core.ResourceList)
|
||||
q.Min[core.ResourceCPU] = *(cpuLimit.Copy())
|
||||
|
||||
q.MaxLimitRequestRatio = make(api.ResourceList)
|
||||
q.MaxLimitRequestRatio[api.ResourceCPU] = resource.MustParse("10")
|
||||
q.MaxLimitRequestRatio = make(core.ResourceList)
|
||||
q.MaxLimitRequestRatio[core.ResourceCPU] = resource.MustParse("10")
|
||||
},
|
||||
func(p *api.PullPolicy, c fuzz.Continue) {
|
||||
policies := []api.PullPolicy{api.PullAlways, api.PullNever, api.PullIfNotPresent}
|
||||
func(p *core.PullPolicy, c fuzz.Continue) {
|
||||
policies := []core.PullPolicy{core.PullAlways, core.PullNever, core.PullIfNotPresent}
|
||||
*p = policies[c.Rand.Intn(len(policies))]
|
||||
},
|
||||
func(rp *api.RestartPolicy, c fuzz.Continue) {
|
||||
policies := []api.RestartPolicy{api.RestartPolicyAlways, api.RestartPolicyNever, api.RestartPolicyOnFailure}
|
||||
func(rp *core.RestartPolicy, c fuzz.Continue) {
|
||||
policies := []core.RestartPolicy{core.RestartPolicyAlways, core.RestartPolicyNever, core.RestartPolicyOnFailure}
|
||||
*rp = policies[c.Rand.Intn(len(policies))]
|
||||
},
|
||||
// api.DownwardAPIVolumeFile needs to have a specific func since FieldRef has to be
|
||||
// core.DownwardAPIVolumeFile needs to have a specific func since FieldRef has to be
|
||||
// defaulted to a version otherwise roundtrip will fail
|
||||
func(m *api.DownwardAPIVolumeFile, c fuzz.Continue) {
|
||||
func(m *core.DownwardAPIVolumeFile, c fuzz.Continue) {
|
||||
m.Path = c.RandString()
|
||||
versions := []string{"v1"}
|
||||
m.FieldRef = &api.ObjectFieldSelector{}
|
||||
m.FieldRef = &core.ObjectFieldSelector{}
|
||||
m.FieldRef.APIVersion = versions[c.Rand.Intn(len(versions))]
|
||||
m.FieldRef.FieldPath = c.RandString()
|
||||
c.Fuzz(m.Mode)
|
||||
@@ -171,7 +171,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
*m.Mode &= 0777
|
||||
}
|
||||
},
|
||||
func(s *api.SecretVolumeSource, c fuzz.Continue) {
|
||||
func(s *core.SecretVolumeSource, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(s) // fuzz self without calling this function again
|
||||
|
||||
if c.RandBool() {
|
||||
@@ -185,7 +185,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
mode &= 0777
|
||||
s.DefaultMode = &mode
|
||||
},
|
||||
func(cm *api.ConfigMapVolumeSource, c fuzz.Continue) {
|
||||
func(cm *core.ConfigMapVolumeSource, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(cm) // fuzz self without calling this function again
|
||||
|
||||
if c.RandBool() {
|
||||
@@ -199,7 +199,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
mode &= 0777
|
||||
cm.DefaultMode = &mode
|
||||
},
|
||||
func(d *api.DownwardAPIVolumeSource, c fuzz.Continue) {
|
||||
func(d *core.DownwardAPIVolumeSource, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(d) // fuzz self without calling this function again
|
||||
|
||||
// DefaultMode should always be set, it has a default
|
||||
@@ -209,7 +209,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
mode &= 0777
|
||||
d.DefaultMode = &mode
|
||||
},
|
||||
func(s *api.ProjectedVolumeSource, c fuzz.Continue) {
|
||||
func(s *core.ProjectedVolumeSource, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(s) // fuzz self without calling this function again
|
||||
|
||||
// DefaultMode should always be set, it has a default
|
||||
@@ -219,7 +219,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
mode &= 0777
|
||||
s.DefaultMode = &mode
|
||||
},
|
||||
func(k *api.KeyToPath, c fuzz.Continue) {
|
||||
func(k *core.KeyToPath, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(k) // fuzz self without calling this function again
|
||||
k.Key = c.RandString()
|
||||
k.Path = c.RandString()
|
||||
@@ -230,7 +230,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
*k.Mode &= 0777
|
||||
}
|
||||
},
|
||||
func(vs *api.VolumeSource, c fuzz.Continue) {
|
||||
func(vs *core.VolumeSource, c fuzz.Continue) {
|
||||
// Exactly one of the fields must be set.
|
||||
v := reflect.ValueOf(vs).Elem()
|
||||
i := int(c.RandUint64() % uint64(v.NumField()))
|
||||
@@ -239,38 +239,38 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
c.Fuzz(t.Interface())
|
||||
}
|
||||
},
|
||||
func(i *api.ISCSIVolumeSource, c fuzz.Continue) {
|
||||
func(i *core.ISCSIVolumeSource, c fuzz.Continue) {
|
||||
i.ISCSIInterface = c.RandString()
|
||||
if i.ISCSIInterface == "" {
|
||||
i.ISCSIInterface = "default"
|
||||
}
|
||||
},
|
||||
func(d *api.DNSPolicy, c fuzz.Continue) {
|
||||
policies := []api.DNSPolicy{api.DNSClusterFirst, api.DNSDefault}
|
||||
func(d *core.DNSPolicy, c fuzz.Continue) {
|
||||
policies := []core.DNSPolicy{core.DNSClusterFirst, core.DNSDefault}
|
||||
*d = policies[c.Rand.Intn(len(policies))]
|
||||
},
|
||||
func(p *api.Protocol, c fuzz.Continue) {
|
||||
protocols := []api.Protocol{api.ProtocolTCP, api.ProtocolUDP}
|
||||
func(p *core.Protocol, c fuzz.Continue) {
|
||||
protocols := []core.Protocol{core.ProtocolTCP, core.ProtocolUDP}
|
||||
*p = protocols[c.Rand.Intn(len(protocols))]
|
||||
},
|
||||
func(p *api.ServiceAffinity, c fuzz.Continue) {
|
||||
types := []api.ServiceAffinity{api.ServiceAffinityClientIP, api.ServiceAffinityNone}
|
||||
func(p *core.ServiceAffinity, c fuzz.Continue) {
|
||||
types := []core.ServiceAffinity{core.ServiceAffinityClientIP, core.ServiceAffinityNone}
|
||||
*p = types[c.Rand.Intn(len(types))]
|
||||
},
|
||||
func(p *api.ServiceType, c fuzz.Continue) {
|
||||
types := []api.ServiceType{api.ServiceTypeClusterIP, api.ServiceTypeNodePort, api.ServiceTypeLoadBalancer}
|
||||
func(p *core.ServiceType, c fuzz.Continue) {
|
||||
types := []core.ServiceType{core.ServiceTypeClusterIP, core.ServiceTypeNodePort, core.ServiceTypeLoadBalancer}
|
||||
*p = types[c.Rand.Intn(len(types))]
|
||||
},
|
||||
func(p *api.ServiceExternalTrafficPolicyType, c fuzz.Continue) {
|
||||
types := []api.ServiceExternalTrafficPolicyType{api.ServiceExternalTrafficPolicyTypeCluster, api.ServiceExternalTrafficPolicyTypeLocal}
|
||||
func(p *core.ServiceExternalTrafficPolicyType, c fuzz.Continue) {
|
||||
types := []core.ServiceExternalTrafficPolicyType{core.ServiceExternalTrafficPolicyTypeCluster, core.ServiceExternalTrafficPolicyTypeLocal}
|
||||
*p = types[c.Rand.Intn(len(types))]
|
||||
},
|
||||
func(ct *api.Container, c fuzz.Continue) {
|
||||
func(ct *core.Container, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(ct) // fuzz self without calling this function again
|
||||
ct.TerminationMessagePath = "/" + ct.TerminationMessagePath // Must be non-empty
|
||||
ct.TerminationMessagePolicy = "File"
|
||||
},
|
||||
func(p *api.Probe, c fuzz.Continue) {
|
||||
func(p *core.Probe, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(p)
|
||||
// These fields have default values.
|
||||
intFieldsWithDefaults := [...]string{"TimeoutSeconds", "PeriodSeconds", "SuccessThreshold", "FailureThreshold"}
|
||||
@@ -282,13 +282,13 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
}
|
||||
}
|
||||
},
|
||||
func(ev *api.EnvVar, c fuzz.Continue) {
|
||||
func(ev *core.EnvVar, c fuzz.Continue) {
|
||||
ev.Name = c.RandString()
|
||||
if c.RandBool() {
|
||||
ev.Value = c.RandString()
|
||||
} else {
|
||||
ev.ValueFrom = &api.EnvVarSource{}
|
||||
ev.ValueFrom.FieldRef = &api.ObjectFieldSelector{}
|
||||
ev.ValueFrom = &core.EnvVarSource{}
|
||||
ev.ValueFrom.FieldRef = &core.ObjectFieldSelector{}
|
||||
|
||||
versions := []schema.GroupVersion{
|
||||
{Group: "admission.k8s.io", Version: "v1alpha1"},
|
||||
@@ -301,7 +301,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
ev.ValueFrom.FieldRef.FieldPath = c.RandString()
|
||||
}
|
||||
},
|
||||
func(ev *api.EnvFromSource, c fuzz.Continue) {
|
||||
func(ev *core.EnvFromSource, c fuzz.Continue) {
|
||||
if c.RandBool() {
|
||||
ev.Prefix = "p_"
|
||||
}
|
||||
@@ -311,17 +311,17 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
c.Fuzz(&ev.SecretRef)
|
||||
}
|
||||
},
|
||||
func(cm *api.ConfigMapEnvSource, c fuzz.Continue) {
|
||||
func(cm *core.ConfigMapEnvSource, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(cm) // fuzz self without calling this function again
|
||||
if c.RandBool() {
|
||||
opt := c.RandBool()
|
||||
cm.Optional = &opt
|
||||
}
|
||||
},
|
||||
func(s *api.SecretEnvSource, c fuzz.Continue) {
|
||||
func(s *core.SecretEnvSource, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(s) // fuzz self without calling this function again
|
||||
},
|
||||
func(sc *api.SecurityContext, c fuzz.Continue) {
|
||||
func(sc *core.SecurityContext, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(sc) // fuzz self without calling this function again
|
||||
if c.RandBool() {
|
||||
priv := c.RandBool()
|
||||
@@ -329,19 +329,19 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
}
|
||||
|
||||
if c.RandBool() {
|
||||
sc.Capabilities = &api.Capabilities{
|
||||
Add: make([]api.Capability, 0),
|
||||
Drop: make([]api.Capability, 0),
|
||||
sc.Capabilities = &core.Capabilities{
|
||||
Add: make([]core.Capability, 0),
|
||||
Drop: make([]core.Capability, 0),
|
||||
}
|
||||
c.Fuzz(&sc.Capabilities.Add)
|
||||
c.Fuzz(&sc.Capabilities.Drop)
|
||||
}
|
||||
},
|
||||
func(s *api.Secret, c fuzz.Continue) {
|
||||
func(s *core.Secret, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(s) // fuzz self without calling this function again
|
||||
s.Type = api.SecretTypeOpaque
|
||||
s.Type = core.SecretTypeOpaque
|
||||
},
|
||||
func(r *api.RBDVolumeSource, c fuzz.Continue) {
|
||||
func(r *core.RBDVolumeSource, c fuzz.Continue) {
|
||||
r.RBDPool = c.RandString()
|
||||
if r.RBDPool == "" {
|
||||
r.RBDPool = "rbd"
|
||||
@@ -355,7 +355,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
r.Keyring = "/etc/ceph/keyring"
|
||||
}
|
||||
},
|
||||
func(r *api.RBDPersistentVolumeSource, c fuzz.Continue) {
|
||||
func(r *core.RBDPersistentVolumeSource, c fuzz.Continue) {
|
||||
r.RBDPool = c.RandString()
|
||||
if r.RBDPool == "" {
|
||||
r.RBDPool = "rbd"
|
||||
@@ -369,36 +369,36 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
r.Keyring = "/etc/ceph/keyring"
|
||||
}
|
||||
},
|
||||
func(obj *api.HostPathVolumeSource, c fuzz.Continue) {
|
||||
func(obj *core.HostPathVolumeSource, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(obj)
|
||||
types := []api.HostPathType{api.HostPathUnset, api.HostPathDirectoryOrCreate, api.HostPathDirectory,
|
||||
api.HostPathFileOrCreate, api.HostPathFile, api.HostPathSocket, api.HostPathCharDev, api.HostPathBlockDev}
|
||||
types := []core.HostPathType{core.HostPathUnset, core.HostPathDirectoryOrCreate, core.HostPathDirectory,
|
||||
core.HostPathFileOrCreate, core.HostPathFile, core.HostPathSocket, core.HostPathCharDev, core.HostPathBlockDev}
|
||||
typeVol := types[c.Rand.Intn(len(types))]
|
||||
if obj.Type == nil {
|
||||
obj.Type = &typeVol
|
||||
}
|
||||
},
|
||||
func(pv *api.PersistentVolume, c fuzz.Continue) {
|
||||
func(pv *core.PersistentVolume, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(pv) // fuzz self without calling this function again
|
||||
types := []api.PersistentVolumePhase{api.VolumeAvailable, api.VolumePending, api.VolumeBound, api.VolumeReleased, api.VolumeFailed}
|
||||
types := []core.PersistentVolumePhase{core.VolumeAvailable, core.VolumePending, core.VolumeBound, core.VolumeReleased, core.VolumeFailed}
|
||||
pv.Status.Phase = types[c.Rand.Intn(len(types))]
|
||||
pv.Status.Message = c.RandString()
|
||||
reclamationPolicies := []api.PersistentVolumeReclaimPolicy{api.PersistentVolumeReclaimRecycle, api.PersistentVolumeReclaimRetain}
|
||||
reclamationPolicies := []core.PersistentVolumeReclaimPolicy{core.PersistentVolumeReclaimRecycle, core.PersistentVolumeReclaimRetain}
|
||||
pv.Spec.PersistentVolumeReclaimPolicy = reclamationPolicies[c.Rand.Intn(len(reclamationPolicies))]
|
||||
},
|
||||
func(pvc *api.PersistentVolumeClaim, c fuzz.Continue) {
|
||||
func(pvc *core.PersistentVolumeClaim, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(pvc) // fuzz self without calling this function again
|
||||
types := []api.PersistentVolumeClaimPhase{api.ClaimBound, api.ClaimPending, api.ClaimLost}
|
||||
types := []core.PersistentVolumeClaimPhase{core.ClaimBound, core.ClaimPending, core.ClaimLost}
|
||||
pvc.Status.Phase = types[c.Rand.Intn(len(types))]
|
||||
},
|
||||
func(obj *api.AzureDiskVolumeSource, c fuzz.Continue) {
|
||||
func(obj *core.AzureDiskVolumeSource, c fuzz.Continue) {
|
||||
if obj.CachingMode == nil {
|
||||
obj.CachingMode = new(api.AzureDataDiskCachingMode)
|
||||
*obj.CachingMode = api.AzureDataDiskCachingReadWrite
|
||||
obj.CachingMode = new(core.AzureDataDiskCachingMode)
|
||||
*obj.CachingMode = core.AzureDataDiskCachingReadWrite
|
||||
}
|
||||
if obj.Kind == nil {
|
||||
obj.Kind = new(api.AzureDataDiskKind)
|
||||
*obj.Kind = api.AzureSharedBlobDisk
|
||||
obj.Kind = new(core.AzureDataDiskKind)
|
||||
*obj.Kind = core.AzureSharedBlobDisk
|
||||
}
|
||||
if obj.FSType == nil {
|
||||
obj.FSType = new(string)
|
||||
@@ -409,7 +409,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
*obj.ReadOnly = false
|
||||
}
|
||||
},
|
||||
func(sio *api.ScaleIOVolumeSource, c fuzz.Continue) {
|
||||
func(sio *core.ScaleIOVolumeSource, c fuzz.Continue) {
|
||||
sio.StorageMode = c.RandString()
|
||||
if sio.StorageMode == "" {
|
||||
sio.StorageMode = "ThinProvisioned"
|
||||
@@ -419,7 +419,7 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
sio.FSType = "xfs"
|
||||
}
|
||||
},
|
||||
func(sio *api.ScaleIOPersistentVolumeSource, c fuzz.Continue) {
|
||||
func(sio *core.ScaleIOPersistentVolumeSource, c fuzz.Continue) {
|
||||
sio.StorageMode = c.RandString()
|
||||
if sio.StorageMode == "" {
|
||||
sio.StorageMode = "ThinProvisioned"
|
||||
@@ -429,22 +429,22 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
sio.FSType = "xfs"
|
||||
}
|
||||
},
|
||||
func(s *api.NamespaceSpec, c fuzz.Continue) {
|
||||
s.Finalizers = []api.FinalizerName{api.FinalizerKubernetes}
|
||||
func(s *core.NamespaceSpec, c fuzz.Continue) {
|
||||
s.Finalizers = []core.FinalizerName{core.FinalizerKubernetes}
|
||||
},
|
||||
func(s *api.NamespaceStatus, c fuzz.Continue) {
|
||||
s.Phase = api.NamespaceActive
|
||||
func(s *core.NamespaceStatus, c fuzz.Continue) {
|
||||
s.Phase = core.NamespaceActive
|
||||
},
|
||||
func(http *api.HTTPGetAction, c fuzz.Continue) {
|
||||
func(http *core.HTTPGetAction, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(http) // fuzz self without calling this function again
|
||||
http.Path = "/" + http.Path // can't be blank
|
||||
http.Scheme = "x" + http.Scheme // can't be blank
|
||||
},
|
||||
func(ss *api.ServiceSpec, c fuzz.Continue) {
|
||||
func(ss *core.ServiceSpec, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(ss) // fuzz self without calling this function again
|
||||
if len(ss.Ports) == 0 {
|
||||
// There must be at least 1 port.
|
||||
ss.Ports = append(ss.Ports, api.ServicePort{})
|
||||
ss.Ports = append(ss.Ports, core.ServicePort{})
|
||||
c.Fuzz(&ss.Ports[0])
|
||||
}
|
||||
for i := range ss.Ports {
|
||||
@@ -455,25 +455,25 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
ss.Ports[i].TargetPort.StrVal = "x" + ss.Ports[i].TargetPort.StrVal // non-empty
|
||||
}
|
||||
}
|
||||
types := []api.ServiceAffinity{api.ServiceAffinityNone, api.ServiceAffinityClientIP}
|
||||
types := []core.ServiceAffinity{core.ServiceAffinityNone, core.ServiceAffinityClientIP}
|
||||
ss.SessionAffinity = types[c.Rand.Intn(len(types))]
|
||||
switch ss.SessionAffinity {
|
||||
case api.ServiceAffinityClientIP:
|
||||
timeoutSeconds := int32(c.Rand.Intn(int(api.MaxClientIPServiceAffinitySeconds)))
|
||||
ss.SessionAffinityConfig = &api.SessionAffinityConfig{
|
||||
ClientIP: &api.ClientIPConfig{
|
||||
case core.ServiceAffinityClientIP:
|
||||
timeoutSeconds := int32(c.Rand.Intn(int(core.MaxClientIPServiceAffinitySeconds)))
|
||||
ss.SessionAffinityConfig = &core.SessionAffinityConfig{
|
||||
ClientIP: &core.ClientIPConfig{
|
||||
TimeoutSeconds: &timeoutSeconds,
|
||||
},
|
||||
}
|
||||
case api.ServiceAffinityNone:
|
||||
case core.ServiceAffinityNone:
|
||||
ss.SessionAffinityConfig = nil
|
||||
}
|
||||
},
|
||||
func(n *api.Node, c fuzz.Continue) {
|
||||
func(n *core.Node, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(n)
|
||||
n.Spec.ExternalID = "external"
|
||||
},
|
||||
func(s *api.NodeStatus, c fuzz.Continue) {
|
||||
func(s *core.NodeStatus, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(s)
|
||||
s.Allocatable = s.Capacity
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user