expectErr:`error building cluster "foo": user cannot specify the TLSVolumeName field`,
},
"node/no name":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{{
Kind:NodeKindServer,
}},
}},
},
expectErr:`error building cluster "foo": error compiling node "": cluster "foo" node has no name`,
},
"node/invalid name":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{{
Kind:NodeKindServer,
Name:"-123",
}},
}},
},
expectErr:`error building cluster "foo": error compiling node "-123": node name is not valid: -123`,
},
"node/bad kind":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{{
Name:"zim",
}},
}},
},
expectErr:`error building cluster "foo": error compiling node "zim": cluster "foo" node "zim" has invalid kind`,
},
"node/invalid partition":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{{
Kind:NodeKindServer,
Name:"zim",
Partition:"-123",
}},
}},
},
expectErr:`error building cluster "foo": error compiling node "zim": node partition is not valid: -123`,
},
"node/invalid usedPorts":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{{
Kind:NodeKindServer,
Name:"zim",
usedPorts:map[int]int{5:6},
}},
}},
},
expectErr:`error building cluster "foo": error compiling node "zim": user cannot specify the usedPorts field`,
},
"node/invalid index":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{{
Kind:NodeKindServer,
Name:"zim",
Index:99,
}},
}},
},
expectErr:`error building cluster "foo": error compiling node "zim": user cannot specify the node index`,
},
"node/missing address network":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{{
Kind:NodeKindServer,
Name:"zim",
Addresses:[]*Address{{
//
}},
}},
}},
},
expectErr:`error building cluster "foo": error compiling node "zim": cluster "foo" node "zim" has invalid address`,
},
"node/invalid address type":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{{
Kind:NodeKindServer,
Name:"zim",
Addresses:[]*Address{{
Network:"foo",
Type:"lan",
}},
}},
}},
},
expectErr:`error building cluster "foo": error compiling node "zim": user cannot specify the address type directly`,
},
"node/address network does not exist":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{{
Kind:NodeKindServer,
Name:"zim",
Addresses:[]*Address{{
Network:"bar",
}},
}},
}},
},
expectErr:`error building cluster "foo": error compiling node "zim": cluster "foo" node "zim" uses network name "bar" that does not exist`,
},
"node/no local addresses":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
{Name:"bar",Type:"wan"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{{
Kind:NodeKindServer,
Name:"zim",
Addresses:[]*Address{{
Network:"bar",
}},
}},
}},
},
expectErr:`error building cluster "foo": error compiling node "zim": cluster "foo" node "zim" has no local addresses`,
},
"node/too many public addresses":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
{Name:"bar",Type:"wan"},
{Name:"baz",Type:"wan"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{{
Kind:NodeKindServer,
Name:"zim",
Addresses:[]*Address{
{Network:"foo"},
{Network:"bar"},
{Network:"baz"},
},
}},
}},
},
expectErr:`error building cluster "foo": error compiling node "zim": cluster "foo" node "zim" has more than one public address`,
},
"node/dataplane with more than one workload":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{
{
Kind:NodeKindServer,
Name:"server1",
Addresses:[]*Address{
{Network:"foo"},
},
},
{
Kind:NodeKindDataplane,
Name:"mesh1",
Addresses:[]*Address{
{Network:"foo"},
},
Workloads:[]*Workload{
{ID:NewID("zim","default","default")},
{ID:NewID("gir","default","default")},
},
},
},
}},
},
expectErr:`error building cluster "foo": error compiling node "mesh1": cluster "foo" node "mesh1" uses dataplane, but has more than one service`,
},
"workload/invalid partition":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{
{
Kind:NodeKindServer,
Name:"server1",
Addresses:[]*Address{
{Network:"foo"},
},
},
{
Kind:NodeKindDataplane,
Name:"mesh1",
Addresses:[]*Address{{Network:"foo"}},
Workloads:[]*Workload{{
ID:ID{
Name:"zim",
Namespace:"default",
Partition:"-123",
},
Image:"busybox",
}},
},
},
}},
},
expectErr:`error building cluster "foo": error compiling node "mesh1": service partition is not valid: -123`,
},
"workload/invalid namespace":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{
{
Kind:NodeKindServer,
Name:"server1",
Addresses:[]*Address{
{Network:"foo"},
},
},
{
Kind:NodeKindDataplane,
Name:"mesh1",
Addresses:[]*Address{{Network:"foo"}},
Workloads:[]*Workload{{
ID:ID{
Name:"zim",
Namespace:"-123",
Partition:"default",
},
Image:"busybox",
}},
},
},
}},
},
expectErr:`error building cluster "foo": error compiling node "mesh1": service namespace is not valid: -123`,
},
"workload/invalid name":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{
{
Kind:NodeKindServer,
Name:"server1",
Addresses:[]*Address{
{Network:"foo"},
},
},
{
Kind:NodeKindDataplane,
Name:"mesh1",
Addresses:[]*Address{{Network:"foo"}},
Workloads:[]*Workload{{
ID:ID{
Name:"-123",
Namespace:"default",
Partition:"default",
},
Image:"busybox",
}},
},
},
}},
},
expectErr:`error building cluster "foo": error compiling node "mesh1": service name is not valid: -123`,
},
"workload/mismatched partitions":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{
{
Kind:NodeKindServer,
Name:"server1",
Addresses:[]*Address{
{Network:"foo"},
},
},
{
Kind:NodeKindDataplane,
Name:"mesh1",
Addresses:[]*Address{{Network:"foo"}},
Workloads:[]*Workload{{
ID:ID{
Name:"zim",
Namespace:"default",
Partition:"ap1",
},
Image:"busybox",
}},
},
},
}},
},
expectErr:`error building cluster "foo": error compiling node "mesh1": service zim on node mesh1 has mismatched partitions: ap1 != default`,
},
"workload/node collision":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{
{
Kind:NodeKindServer,
Name:"server1",
Addresses:[]*Address{
{Network:"foo"},
},
},
{
Kind:NodeKindClient,
Name:"mesh1",
Addresses:[]*Address{{Network:"foo"}},
Workloads:[]*Workload{
{
ID:NewID("zim","",""),
Image:"busybox",
Port:8080,
EnvoyAdminPort:19000,
},
{
ID:NewID("zim","",""),
Image:"busybox",
Port:9090,
EnvoyAdminPort:19001,
},
},
},
},
}},
},
expectErr:`error building cluster "foo": error compiling node "mesh1": cannot have two services on the same node "default/mesh1" in the same cluster "foo" with the same name "default/default/zim"`,
expectErr:`error building cluster "foo": error compiling node "mesh1": cluster "foo" node "mesh1" service "default/default/zim" is not valid: service image is required`,
expectErr:`error building cluster "foo": error compiling node "mesh1": cluster "foo" node "mesh1" service "default/default/zim" is not valid: service has invalid port`,
},
"workload/validate/mesh with no admin port":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{
{
Kind:NodeKindServer,
Name:"server1",
Addresses:[]*Address{
{Network:"foo"},
},
},
{
Kind:NodeKindDataplane,
Name:"mesh1",
Addresses:[]*Address{{Network:"foo"}},
Workloads:[]*Workload{{
ID:NewID("zim","",""),
Image:"busybox",
Port:999,
}},
},
},
}},
},
expectErr:`error building cluster "foo": error compiling node "mesh1": cluster "foo" node "mesh1" service "default/default/zim" is not valid: envoy admin port is required`,
},
"workload/validate/no mesh with admin port":{
in:&Config{
Networks:[]*Network{
{Name:"foo"},
},
Clusters:[]*Cluster{{
Name:"foo",
Nodes:[]*Node{
{
Kind:NodeKindServer,
Name:"server1",
Addresses:[]*Address{
{Network:"foo"},
},
},
{
Kind:NodeKindDataplane,
Name:"mesh1",
Addresses:[]*Address{{Network:"foo"}},
Workloads:[]*Workload{{
ID:NewID("zim","",""),
EnvoyAdminPort:19000,
DisableServiceMesh:true,
Image:"busybox",
Port:999,
}},
},
},
}},
},
expectErr:`error building cluster "foo": error compiling node "mesh1": cluster "foo" node "mesh1" service "default/default/zim" is not valid: cannot use envoy admin port without a service mesh`,
expectErr:`error building cluster "foo": error compiling node "mesh1": cluster "foo" node "mesh1" service "default/default/zim" is not valid: upstream service name is required`,
expectErr:`error building cluster "foo": error compiling node "mesh1": cluster "foo" node "mesh1" service "default/default/zim" is not valid: upstream local port is required`,
expectErr:`error building cluster "foo": error compiling node "mesh1": cluster "foo" node "mesh1" service "default/default/zim" is not valid: upstream local address is invalid: clown@address`,
expectErr:`error building cluster "foo": error compiling node "mesh1": cluster "foo" node "mesh1" service "default/default/zim" is not valid: cannot disable service mesh and still run a mesh gateway`,
expectErr:`error building cluster "foo": error compiling node "mesh1": cluster "foo" node "mesh1" service "default/default/zim" is not valid: cannot disable service mesh and configure upstreams`,
expectErr:`error building cluster "foo": error compiling node "mesh1": cluster "foo" node "mesh1" service "default/default/zim" is not valid: cannot use envoy admin port without a service mesh`,
expectErr:`error building cluster "foo": error compiling node "mesh1": cluster "foo" node "mesh1" service "default/default/zim" is not valid: envoy admin port is required`,
},
// TODO: OK: v2 mesh gateway port defaulting
// TODO: collect tenancies from all places (cluster, initialconfigs, initialres, nodes, services, ...)