mirror of https://github.com/k3s-io/k3s
kubeadm: fix central api tests
parent
a00db0a32f
commit
030cb6927b
|
@ -53,44 +53,48 @@ func TestVerifyDefaulting(t *testing.T) {
|
||||||
func TestDefaulting(t *testing.T) {
|
func TestDefaulting(t *testing.T) {
|
||||||
// these are the known types with defaulters - you must add to this list if you add a top level defaulter
|
// these are the known types with defaulters - you must add to this list if you add a top level defaulter
|
||||||
typesWithDefaulting := map[unversioned.GroupVersionKind]struct{}{
|
typesWithDefaulting := map[unversioned.GroupVersionKind]struct{}{
|
||||||
{Group: "", Version: "v1", Kind: "ConfigMap"}: {},
|
{Group: "", Version: "v1", Kind: "ConfigMap"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "ConfigMapList"}: {},
|
{Group: "", Version: "v1", Kind: "ConfigMapList"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "Endpoints"}: {},
|
{Group: "", Version: "v1", Kind: "Endpoints"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "EndpointsList"}: {},
|
{Group: "", Version: "v1", Kind: "EndpointsList"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "Namespace"}: {},
|
{Group: "", Version: "v1", Kind: "Namespace"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "NamespaceList"}: {},
|
{Group: "", Version: "v1", Kind: "NamespaceList"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "Node"}: {},
|
{Group: "", Version: "v1", Kind: "Node"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "NodeList"}: {},
|
{Group: "", Version: "v1", Kind: "NodeList"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "PersistentVolume"}: {},
|
{Group: "", Version: "v1", Kind: "PersistentVolume"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "PersistentVolumeList"}: {},
|
{Group: "", Version: "v1", Kind: "PersistentVolumeList"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "PersistentVolumeClaim"}: {},
|
{Group: "", Version: "v1", Kind: "PersistentVolumeClaim"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "PersistentVolumeClaimList"}: {},
|
{Group: "", Version: "v1", Kind: "PersistentVolumeClaimList"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "PodAttachOptions"}: {},
|
{Group: "", Version: "v1", Kind: "PodAttachOptions"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "PodExecOptions"}: {},
|
{Group: "", Version: "v1", Kind: "PodExecOptions"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "Pod"}: {},
|
{Group: "", Version: "v1", Kind: "Pod"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "PodList"}: {},
|
{Group: "", Version: "v1", Kind: "PodList"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "PodTemplate"}: {},
|
{Group: "", Version: "v1", Kind: "PodTemplate"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "PodTemplateList"}: {},
|
{Group: "", Version: "v1", Kind: "PodTemplateList"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "ReplicationController"}: {},
|
{Group: "", Version: "v1", Kind: "ReplicationController"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "ReplicationControllerList"}: {},
|
{Group: "", Version: "v1", Kind: "ReplicationControllerList"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "Secret"}: {},
|
{Group: "", Version: "v1", Kind: "Secret"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "SecretList"}: {},
|
{Group: "", Version: "v1", Kind: "SecretList"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "Service"}: {},
|
{Group: "", Version: "v1", Kind: "Service"}: {},
|
||||||
{Group: "", Version: "v1", Kind: "ServiceList"}: {},
|
{Group: "", Version: "v1", Kind: "ServiceList"}: {},
|
||||||
{Group: "apps", Version: "v1alpha1", Kind: "StatefulSet"}: {},
|
{Group: "apps", Version: "v1alpha1", Kind: "StatefulSet"}: {},
|
||||||
{Group: "apps", Version: "v1alpha1", Kind: "StatefulSetList"}: {},
|
{Group: "apps", Version: "v1alpha1", Kind: "StatefulSetList"}: {},
|
||||||
{Group: "autoscaling", Version: "v1", Kind: "HorizontalPodAutoscaler"}: {},
|
{Group: "autoscaling", Version: "v1", Kind: "HorizontalPodAutoscaler"}: {},
|
||||||
{Group: "autoscaling", Version: "v1", Kind: "HorizontalPodAutoscalerList"}: {},
|
{Group: "autoscaling", Version: "v1", Kind: "HorizontalPodAutoscalerList"}: {},
|
||||||
{Group: "batch", Version: "v1", Kind: "Job"}: {},
|
{Group: "batch", Version: "v1", Kind: "Job"}: {},
|
||||||
{Group: "batch", Version: "v1", Kind: "JobList"}: {},
|
{Group: "batch", Version: "v1", Kind: "JobList"}: {},
|
||||||
{Group: "batch", Version: "v2alpha1", Kind: "Job"}: {},
|
{Group: "batch", Version: "v2alpha1", Kind: "Job"}: {},
|
||||||
{Group: "batch", Version: "v2alpha1", Kind: "JobList"}: {},
|
{Group: "batch", Version: "v2alpha1", Kind: "JobList"}: {},
|
||||||
{Group: "batch", Version: "v2alpha1", Kind: "JobTemplate"}: {},
|
{Group: "batch", Version: "v2alpha1", Kind: "JobTemplate"}: {},
|
||||||
{Group: "batch", Version: "v2alpha1", Kind: "ScheduledJob"}: {},
|
{Group: "batch", Version: "v2alpha1", Kind: "ScheduledJob"}: {},
|
||||||
{Group: "batch", Version: "v2alpha1", Kind: "ScheduledJobList"}: {},
|
{Group: "batch", Version: "v2alpha1", Kind: "ScheduledJobList"}: {},
|
||||||
{Group: "componentconfig", Version: "v1alpha1", Kind: "KubeProxyConfiguration"}: {},
|
{Group: "componentconfig", Version: "v1alpha1", Kind: "KubeProxyConfiguration"}: {},
|
||||||
{Group: "componentconfig", Version: "v1alpha1", Kind: "KubeSchedulerConfiguration"}: {},
|
{Group: "componentconfig", Version: "v1alpha1", Kind: "KubeSchedulerConfiguration"}: {},
|
||||||
{Group: "componentconfig", Version: "v1alpha1", Kind: "KubeletConfiguration"}: {},
|
{Group: "componentconfig", Version: "v1alpha1", Kind: "KubeletConfiguration"}: {},
|
||||||
|
{Group: "kubeadm.k8s.io", Version: "v1alpha1", Kind: "MasterConfiguration"}: {},
|
||||||
|
// This object contains only int fields which currently breaks the defaulting test because
|
||||||
|
// it's pretty stupid. Once we add non integer fields, we should uncomment this.
|
||||||
|
// {Group: "kubeadm.k8s.io", Version: "v1alpha1", Kind: "NodeConfiguration"}: {},
|
||||||
{Group: "extensions", Version: "v1beta1", Kind: "DaemonSet"}: {},
|
{Group: "extensions", Version: "v1beta1", Kind: "DaemonSet"}: {},
|
||||||
{Group: "extensions", Version: "v1beta1", Kind: "DaemonSetList"}: {},
|
{Group: "extensions", Version: "v1beta1", Kind: "DaemonSetList"}: {},
|
||||||
{Group: "extensions", Version: "v1beta1", Kind: "Deployment"}: {},
|
{Group: "extensions", Version: "v1beta1", Kind: "Deployment"}: {},
|
||||||
|
|
|
@ -19,6 +19,7 @@ go_library(
|
||||||
],
|
],
|
||||||
tags = ["automanaged"],
|
tags = ["automanaged"],
|
||||||
deps = [
|
deps = [
|
||||||
|
"//cmd/kubeadm/app/apis/kubeadm:go_default_library",
|
||||||
"//pkg/api:go_default_library",
|
"//pkg/api:go_default_library",
|
||||||
"//pkg/api/resource:go_default_library",
|
"//pkg/api/resource:go_default_library",
|
||||||
"//pkg/api/testapi:go_default_library",
|
"//pkg/api/testapi:go_default_library",
|
||||||
|
|
|
@ -23,6 +23,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
@ -538,6 +539,19 @@ func FuzzerFor(t *testing.T, version unversioned.GroupVersion, src rand.Source)
|
||||||
// Set the bytes field on the RawExtension
|
// Set the bytes field on the RawExtension
|
||||||
r.Raw = bytes
|
r.Raw = bytes
|
||||||
},
|
},
|
||||||
|
func(obj *kubeadm.MasterConfiguration, c fuzz.Continue) {
|
||||||
|
c.FuzzNoCustom(obj)
|
||||||
|
obj.KubernetesVersion = "v10"
|
||||||
|
obj.API.BindPort = 20
|
||||||
|
obj.Discovery.BindPort = 20
|
||||||
|
obj.Networking.ServiceSubnet = "foo"
|
||||||
|
obj.Networking.DNSDomain = "foo"
|
||||||
|
},
|
||||||
|
func(obj *kubeadm.NodeConfiguration, c fuzz.Continue) {
|
||||||
|
c.FuzzNoCustom(obj)
|
||||||
|
obj.APIPort = 20
|
||||||
|
obj.DiscoveryPort = 20
|
||||||
|
},
|
||||||
)
|
)
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue