mirror of https://github.com/k3s-io/k3s
Avoid annoying logs in integration tests
parent
0523e54ea6
commit
925ba42507
|
@ -51,6 +51,7 @@ import (
|
||||||
"k8s.io/kubernetes/pkg/master"
|
"k8s.io/kubernetes/pkg/master"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/storage/storagebackend"
|
"k8s.io/kubernetes/pkg/storage/storagebackend"
|
||||||
|
utilnet "k8s.io/kubernetes/pkg/util/net"
|
||||||
"k8s.io/kubernetes/plugin/pkg/admission/admit"
|
"k8s.io/kubernetes/plugin/pkg/admission/admit"
|
||||||
|
|
||||||
"github.com/pborman/uuid"
|
"github.com/pborman/uuid"
|
||||||
|
@ -152,6 +153,14 @@ func startMasterOrDie(masterConfig *master.Config) (*master.Master, *httptest.Se
|
||||||
return m, s
|
return m, s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func parseCIDROrDie(cidr string) *net.IPNet {
|
||||||
|
_, parsed, err := net.ParseCIDR(cidr)
|
||||||
|
if err != nil {
|
||||||
|
glog.Fatalf("error while parsing CIDR: %s", cidr)
|
||||||
|
}
|
||||||
|
return parsed
|
||||||
|
}
|
||||||
|
|
||||||
// Returns a basic master config.
|
// Returns a basic master config.
|
||||||
func NewMasterConfig() *master.Config {
|
func NewMasterConfig() *master.Config {
|
||||||
config := storagebackend.Config{
|
config := storagebackend.Config{
|
||||||
|
@ -208,6 +217,9 @@ func NewMasterConfig() *master.Config {
|
||||||
AdmissionControl: admit.NewAlwaysAdmit(),
|
AdmissionControl: admit.NewAlwaysAdmit(),
|
||||||
Serializer: api.Codecs,
|
Serializer: api.Codecs,
|
||||||
EnableWatchCache: true,
|
EnableWatchCache: true,
|
||||||
|
// Set those values to avoid annoying warnings in logs.
|
||||||
|
ServiceClusterIPRange: parseCIDROrDie("10.0.0.0/24"),
|
||||||
|
ServiceNodePortRange: utilnet.PortRange{Base: 30000, Size: 2768},
|
||||||
},
|
},
|
||||||
KubeletClient: kubeletclient.FakeKubeletClient{},
|
KubeletClient: kubeletclient.FakeKubeletClient{},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue