mirror of
https://github.com/outbackdingo/matchbox.git
synced 2026-01-27 10:19:35 +00:00
Rename Group field requirements to selector
* Use label/selector terms for machine attribute labels and group selectors requirements since it is familiar to many users
This commit is contained in:
@@ -15,7 +15,8 @@
|
||||
* Groups
|
||||
- Move Groups to JSON files under `/var/lib/bootcfg/groups`
|
||||
- Require Group metadata to be valid JSON
|
||||
- Rename groups field `spec` to `profile`
|
||||
- Rename Group field `spec` to `profile`
|
||||
- Rename Group field `require` to `selector`
|
||||
* Allow asset serving to be disabled with `-assets-path=""`
|
||||
* Change default `-data-path` to `/var/lib/bootcfg`
|
||||
* Change default `-assets-path` to `/var/lib/bootcfg/assets`
|
||||
|
||||
@@ -78,15 +78,13 @@ To use Ignition, set the `coreos.config.url` kernel option to reference the `boo
|
||||
|
||||
Groups define selectors which match zero or more machines. Machine(s) matching a group will boot and provision according to the group's `Profile` and `metadata`.
|
||||
|
||||
Create a group definition with a `Profile` to be applied, selectors for matching machines, and any `metadata` needed to render the Ignition or Cloud config templates.
|
||||
|
||||
For example `/var/lib/bootcfg/groups/node1.json` matches a single machine with MAC address `52:54:00:89:d8:10`.
|
||||
Create a group definition with a `Profile` to be applied, selectors for matching machines, and any `metadata` needed to render the Ignition or Cloud config templates. For example `/var/lib/bootcfg/groups/node1.json` matches a single machine with MAC address `52:54:00:89:d8:10`.
|
||||
|
||||
# /var/lib/bootcfg/groups/node1.json
|
||||
{
|
||||
"name": "node1",
|
||||
"profile": "etcd",
|
||||
"require": {
|
||||
"selector": {
|
||||
"mac": "52:54:00:89:d8:10"
|
||||
},
|
||||
"metadata": {
|
||||
|
||||
@@ -36,5 +36,5 @@ func runGroupDescribeCmd(cmd *cobra.Command, args []string) {
|
||||
return
|
||||
}
|
||||
g := resp.Group
|
||||
fmt.Fprintf(tw, "%s\t%s\t%s\t%#v\t%s\n", g.Id, g.Name, g.Requirements, g.Profile, g.Metadata)
|
||||
fmt.Fprintf(tw, "%s\t%s\t%s\t%#v\t%s\n", g.Id, g.Name, g.Selector, g.Profile, g.Metadata)
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@ func runGroupListCmd(cmd *cobra.Command, args []string) {
|
||||
return
|
||||
}
|
||||
for _, group := range resp.Groups {
|
||||
fmt.Fprintf(tw, "%s\t%s\t%#v\t%s\n", group.Id, group.Name, group.Requirements, group.Profile)
|
||||
fmt.Fprintf(tw, "%s\t%s\t%#v\t%s\n", group.Id, group.Name, group.Selector, group.Profile)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ var (
|
||||
}
|
||||
|
||||
testGroupWithMAC = &storagepb.Group{
|
||||
Id: "test-group",
|
||||
Name: "test group",
|
||||
Profile: "g1h2i3j4",
|
||||
Requirements: map[string]string{"mac": validMACStr},
|
||||
Id: "test-group",
|
||||
Name: "test group",
|
||||
Profile: "g1h2i3j4",
|
||||
Selector: map[string]string{"mac": validMACStr},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -41,10 +41,10 @@ func (g *Group) AssertValid() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Matches returns true if the given labels satisfy all the requirements,
|
||||
// false otherwise.
|
||||
// Matches returns true if the given labels satisfy all the selector
|
||||
// requirements, false otherwise.
|
||||
func (g *Group) Matches(labels map[string]string) bool {
|
||||
for key, val := range g.Requirements {
|
||||
for key, val := range g.Selector {
|
||||
if labels == nil || labels[key] != val {
|
||||
return false
|
||||
}
|
||||
@@ -55,7 +55,7 @@ func (g *Group) Matches(labels map[string]string) bool {
|
||||
// Normalize normalizes Group selectors according to reserved selector rules
|
||||
// which require "mac" addresses to be valid, normalized MAC addresses.
|
||||
func (g *Group) Normalize() error {
|
||||
for key, val := range g.Requirements {
|
||||
for key, val := range g.Selector {
|
||||
switch strings.ToLower(key) {
|
||||
case "mac":
|
||||
macAddr, err := net.ParseMAC(val)
|
||||
@@ -63,17 +63,17 @@ func (g *Group) Normalize() error {
|
||||
return err
|
||||
}
|
||||
// range iteration copy with mutable map
|
||||
g.Requirements[key] = macAddr.String()
|
||||
g.Selector[key] = macAddr.String()
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// requirementString returns Group requirements as a string of sorted key
|
||||
// value pairs for comparisons.
|
||||
func (g *Group) requirementString() string {
|
||||
reqs := make([]string, 0, len(g.Requirements))
|
||||
for key, value := range g.Requirements {
|
||||
// selectorString returns Group selectors as a string of sorted key value
|
||||
// pairs for comparisons.
|
||||
func (g *Group) selectorString() string {
|
||||
reqs := make([]string, 0, len(g.Selector))
|
||||
for key, value := range g.Selector {
|
||||
reqs = append(reqs, key+"="+value)
|
||||
}
|
||||
// sort by "key=value" pairs for a deterministic ordering
|
||||
@@ -92,11 +92,11 @@ func (g *Group) ToRichGroup() (*RichGroup, error) {
|
||||
}
|
||||
}
|
||||
return &RichGroup{
|
||||
Id: g.Id,
|
||||
Name: g.Name,
|
||||
Profile: g.Profile,
|
||||
Requirements: g.Requirements,
|
||||
Metadata: metadata,
|
||||
Id: g.Id,
|
||||
Name: g.Name,
|
||||
Profile: g.Profile,
|
||||
Selector: g.Selector,
|
||||
Metadata: metadata,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -115,10 +115,10 @@ func (groups ByReqs) Swap(i, j int) {
|
||||
}
|
||||
|
||||
func (groups ByReqs) Less(i, j int) bool {
|
||||
if len(groups[i].Requirements) == len(groups[j].Requirements) {
|
||||
return groups[i].requirementString() < groups[j].requirementString()
|
||||
if len(groups[i].Selector) == len(groups[j].Selector) {
|
||||
return groups[i].selectorString() < groups[j].selectorString()
|
||||
}
|
||||
return len(groups[i].Requirements) < len(groups[j].Requirements)
|
||||
return len(groups[i].Selector) < len(groups[j].Selector)
|
||||
}
|
||||
|
||||
// RichGroup is a user provided Group definition.
|
||||
@@ -129,8 +129,8 @@ type RichGroup struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
// Profile id
|
||||
Profile string `json:"profile,omitempty"`
|
||||
// tags required to match the group
|
||||
Requirements map[string]string `json:"requirements,omitempty"`
|
||||
// Selectors to match machines
|
||||
Selector map[string]string `json:"selector,omitempty"`
|
||||
// Metadata
|
||||
Metadata map[string]interface{} `json:"metadata,omitempty"`
|
||||
}
|
||||
@@ -147,10 +147,10 @@ func (rg *RichGroup) ToGroup() (*Group, error) {
|
||||
}
|
||||
}
|
||||
return &Group{
|
||||
Id: rg.Id,
|
||||
Name: rg.Name,
|
||||
Profile: rg.Profile,
|
||||
Requirements: rg.Requirements,
|
||||
Metadata: metadata,
|
||||
Id: rg.Id,
|
||||
Name: rg.Name,
|
||||
Profile: rg.Profile,
|
||||
Selector: rg.Selector,
|
||||
Metadata: metadata,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -13,16 +13,16 @@ var (
|
||||
Id: "node1",
|
||||
Name: "test group",
|
||||
Profile: "g1h2i3j4",
|
||||
Requirements: map[string]string{
|
||||
Selector: map[string]string{
|
||||
"uuid": "a1b2c3d4",
|
||||
"mac": "52:da:00:89:d8:10",
|
||||
},
|
||||
Metadata: []byte(`{"some-key":"some-val"}`),
|
||||
}
|
||||
testGroupWithoutProfile = &Group{
|
||||
Name: "test group without profile",
|
||||
Profile: "",
|
||||
Requirements: map[string]string{"uuid": "a1b2c3d4"},
|
||||
Name: "test group without profile",
|
||||
Profile: "",
|
||||
Selector: map[string]string{"uuid": "a1b2c3d4"},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -31,7 +31,7 @@ func TestGroupParse(t *testing.T) {
|
||||
json string
|
||||
group *Group
|
||||
}{
|
||||
{`{"id":"node1","name":"test group","profile":"g1h2i3j4","requirements":{"uuid":"a1b2c3d4","mac":"52:da:00:89:d8:10"},"metadata":{"some-key":"some-val"}}`, testGroup},
|
||||
{`{"id":"node1","name":"test group","profile":"g1h2i3j4","selector":{"uuid":"a1b2c3d4","mac":"52:da:00:89:d8:10"},"metadata":{"some-key":"some-val"}}`, testGroup},
|
||||
}
|
||||
for _, c := range cases {
|
||||
group, _ := ParseGroup([]byte(c.json))
|
||||
@@ -72,13 +72,13 @@ func TestNormalize(t *testing.T) {
|
||||
{map[string]string{"mac": "not-a-mac"}, map[string]string{"mac": "not-a-mac"}, expectedInvalidMAC},
|
||||
}
|
||||
for _, c := range cases {
|
||||
group := &Group{Id: "id", Requirements: c.selectors}
|
||||
group := &Group{Id: "id", Selector: c.selectors}
|
||||
err := group.Normalize()
|
||||
// assert that:
|
||||
// - Group selectors (MAC addresses) are normalized
|
||||
// - Invalid MAC addresses cause a normalization error
|
||||
assert.Equal(t, c.err, err)
|
||||
assert.Equal(t, c.normalized, group.Requirements)
|
||||
assert.Equal(t, c.normalized, group.Selector)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,39 +97,39 @@ func TestGroupMatches(t *testing.T) {
|
||||
// - Group selectors must be satisfied for a match
|
||||
// - labels may provide additional key/value pairs
|
||||
for _, c := range cases {
|
||||
group := &Group{Requirements: c.selectors}
|
||||
group := &Group{Selector: c.selectors}
|
||||
assert.Equal(t, c.expected, group.Matches(c.labels))
|
||||
}
|
||||
}
|
||||
|
||||
func TestRequirementString(t *testing.T) {
|
||||
func TestSelectorString(t *testing.T) {
|
||||
group := Group{
|
||||
Requirements: map[string]string{
|
||||
Selector: map[string]string{
|
||||
"a": "b",
|
||||
"c": "d",
|
||||
},
|
||||
}
|
||||
expected := "a=b,c=d"
|
||||
assert.Equal(t, expected, group.requirementString())
|
||||
assert.Equal(t, expected, group.selectorString())
|
||||
}
|
||||
|
||||
func TestGroupSort(t *testing.T) {
|
||||
oneCondition := &Group{
|
||||
Name: "group with one requirement",
|
||||
Requirements: map[string]string{
|
||||
Name: "group with one selector",
|
||||
Selector: map[string]string{
|
||||
"region": "a",
|
||||
},
|
||||
}
|
||||
twoConditions := &Group{
|
||||
Name: "group with two requirements",
|
||||
Requirements: map[string]string{
|
||||
Name: "group with two selectors",
|
||||
Selector: map[string]string{
|
||||
"region": "a",
|
||||
"zone": "z",
|
||||
},
|
||||
}
|
||||
dualConditions := &Group{
|
||||
Name: "group with two requirements",
|
||||
Requirements: map[string]string{
|
||||
Name: "group with two selectors",
|
||||
Selector: map[string]string{
|
||||
"region": "b",
|
||||
"zone": "z",
|
||||
},
|
||||
@@ -144,8 +144,8 @@ func TestGroupSort(t *testing.T) {
|
||||
}
|
||||
// assert that
|
||||
// - Group ordering is deterministic
|
||||
// - Groups are sorted by increasing Requirements length
|
||||
// - when Requirements are equal in length, sort by key=value strings.
|
||||
// - Groups are sorted by increasing Selector length
|
||||
// - when Selectors are equal in length, sort by key=value strings.
|
||||
for _, c := range cases {
|
||||
sort.Sort(ByReqs(c.input))
|
||||
assert.Equal(t, c.expected, c.input)
|
||||
|
||||
@@ -36,9 +36,9 @@ type Group struct {
|
||||
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
|
||||
// Profile id
|
||||
Profile string `protobuf:"bytes,3,opt,name=profile" json:"profile,omitempty"`
|
||||
// tags required to match the group
|
||||
Requirements map[string]string `protobuf:"bytes,4,rep,name=requirements" json:"requirements,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
// JSON encoded metadata (with restrictions)
|
||||
// Selectors to match machines
|
||||
Selector map[string]string `protobuf:"bytes,4,rep,name=selector" json:"selector,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
// JSON encoded metadata
|
||||
Metadata []byte `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
@@ -47,9 +47,9 @@ func (m *Group) String() string { return proto.CompactTextString(m) }
|
||||
func (*Group) ProtoMessage() {}
|
||||
func (*Group) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func (m *Group) GetRequirements() map[string]string {
|
||||
func (m *Group) GetSelector() map[string]string {
|
||||
if m != nil {
|
||||
return m.Requirements
|
||||
return m.Selector
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -109,26 +109,26 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 331 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x52, 0xcd, 0x4e, 0xf2, 0x40,
|
||||
0x14, 0x4d, 0x69, 0xf9, 0xbb, 0xf0, 0x7d, 0xd1, 0x1b, 0x63, 0x2a, 0x1b, 0x48, 0x17, 0x86, 0x55,
|
||||
0x17, 0xb8, 0x51, 0x36, 0x26, 0x1a, 0x35, 0x6e, 0x8c, 0xe9, 0x0b, 0x98, 0xc2, 0x8c, 0x64, 0x42,
|
||||
0x3b, 0x83, 0xc3, 0xd4, 0x84, 0xc7, 0xf0, 0x4d, 0x7c, 0x2e, 0x9f, 0xc2, 0xf9, 0x2b, 0xa9, 0x61,
|
||||
0xa3, 0xbb, 0x7b, 0xce, 0xb9, 0xc3, 0x39, 0xf7, 0x50, 0xf8, 0xb7, 0x55, 0x42, 0xe6, 0x2b, 0x9a,
|
||||
0x6e, 0xa4, 0x50, 0x02, 0xfb, 0x1e, 0x6e, 0x16, 0xc9, 0x57, 0x00, 0xed, 0x07, 0x29, 0xaa, 0x0d,
|
||||
0xfe, 0x87, 0x16, 0x23, 0x71, 0x30, 0x09, 0xa6, 0xfd, 0x4c, 0x4f, 0x88, 0x10, 0xf1, 0xbc, 0xa4,
|
||||
0x71, 0xcb, 0x32, 0x76, 0xc6, 0x18, 0xba, 0xfa, 0x17, 0x5e, 0x59, 0x41, 0xe3, 0xd0, 0xd2, 0x35,
|
||||
0xc4, 0x7b, 0x18, 0x4a, 0xfa, 0x56, 0x31, 0x49, 0x4b, 0xca, 0xd5, 0x36, 0x8e, 0x26, 0xe1, 0x74,
|
||||
0x30, 0x4b, 0xd2, 0xbd, 0x53, 0x6a, 0x5d, 0xd2, 0xac, 0xb1, 0x74, 0xc7, 0x95, 0xdc, 0x65, 0x3f,
|
||||
0xde, 0xe1, 0x08, 0x7a, 0x25, 0x55, 0x39, 0xc9, 0x55, 0x1e, 0xb7, 0xb5, 0xc5, 0x30, 0xdb, 0xe3,
|
||||
0xd1, 0x35, 0x1c, 0x1f, 0x3c, 0xc7, 0x23, 0x08, 0xd7, 0x74, 0xe7, 0x73, 0x9b, 0x11, 0x4f, 0xa0,
|
||||
0xfd, 0x9e, 0x17, 0x55, 0x9d, 0xdc, 0x81, 0x79, 0xeb, 0x32, 0x48, 0x3e, 0x02, 0xe8, 0x3e, 0xfb,
|
||||
0xc0, 0xbf, 0x39, 0x77, 0x0c, 0x03, 0xb6, 0xe2, 0x4c, 0x31, 0xc1, 0x5f, 0xf4, 0xb2, 0x3b, 0x19,
|
||||
0x6a, 0xea, 0x91, 0xe0, 0x19, 0xf4, 0x96, 0x85, 0xa8, 0x88, 0x51, 0x23, 0x57, 0x88, 0xc5, 0x5a,
|
||||
0x3a, 0x87, 0x68, 0x21, 0x84, 0xb2, 0x47, 0x0c, 0x66, 0xd8, 0x28, 0xe2, 0x89, 0xaa, 0x1b, 0xad,
|
||||
0x64, 0x56, 0x4f, 0x3e, 0x75, 0x26, 0xcf, 0xe0, 0x29, 0x74, 0xd6, 0x54, 0x72, 0x5a, 0xf8, 0x5c,
|
||||
0x1e, 0x19, 0x9e, 0x69, 0x4f, 0x49, 0x74, 0xba, 0xd0, 0xf0, 0x0e, 0xe1, 0x15, 0x74, 0x97, 0x25,
|
||||
0x29, 0x18, 0x37, 0x7f, 0x87, 0xe9, 0x7b, 0x7c, 0x68, 0x93, 0xde, 0xba, 0x0d, 0x57, 0x76, 0xbd,
|
||||
0x3f, 0x9a, 0xc3, 0xb0, 0x29, 0xfc, 0xa5, 0xc6, 0x45, 0xc7, 0x7e, 0x45, 0x17, 0xdf, 0x01, 0x00,
|
||||
0x00, 0xff, 0xff, 0xd7, 0x24, 0xba, 0x3a, 0x56, 0x02, 0x00, 0x00,
|
||||
// 325 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x52, 0xcb, 0x4e, 0x02, 0x31,
|
||||
0x14, 0xcd, 0x30, 0xc3, 0xeb, 0x02, 0xc6, 0xdc, 0x18, 0x33, 0xb2, 0x10, 0xc2, 0xc2, 0xb0, 0x9a,
|
||||
0x05, 0x6e, 0x14, 0x77, 0x1a, 0x63, 0xdc, 0x18, 0x33, 0x7e, 0x80, 0x29, 0xb4, 0x92, 0x86, 0xd2,
|
||||
0x92, 0x52, 0x4c, 0xf8, 0x0c, 0xff, 0xc4, 0xef, 0xf1, 0x6b, 0xec, 0x6b, 0x08, 0xc6, 0x8d, 0xee,
|
||||
0x7a, 0x1e, 0x73, 0xef, 0xb9, 0x27, 0x03, 0xbd, 0x8d, 0x51, 0x9a, 0x2c, 0x58, 0xb1, 0xd6, 0xca,
|
||||
0x28, 0x6c, 0x47, 0xb8, 0x9e, 0x8d, 0xbe, 0x12, 0xa8, 0x3f, 0x68, 0xb5, 0x5d, 0xe3, 0x11, 0xd4,
|
||||
0x38, 0xcd, 0x93, 0x61, 0x32, 0x6e, 0x97, 0xf6, 0x85, 0x08, 0x99, 0x24, 0x2b, 0x96, 0xd7, 0x3c,
|
||||
0xe3, 0xdf, 0x98, 0x43, 0xd3, 0x4e, 0x78, 0xe3, 0x82, 0xe5, 0xa9, 0xa7, 0x2b, 0x88, 0x53, 0x68,
|
||||
0x6d, 0x98, 0x60, 0x73, 0x3b, 0x38, 0xcf, 0x86, 0xe9, 0xb8, 0x33, 0x39, 0x2f, 0xf6, 0x5b, 0x0a,
|
||||
0xbf, 0xa1, 0x78, 0x89, 0x86, 0x7b, 0x69, 0xf4, 0xae, 0xdc, 0xfb, 0xb1, 0x0f, 0xad, 0x15, 0x33,
|
||||
0x84, 0x12, 0x43, 0xf2, 0xba, 0x1d, 0xdb, 0x2d, 0xf7, 0xb8, 0x7f, 0x03, 0xbd, 0x1f, 0x9f, 0xe1,
|
||||
0x31, 0xa4, 0x4b, 0xb6, 0x8b, 0x39, 0xdd, 0x13, 0x4f, 0xa0, 0xfe, 0x4e, 0xc4, 0xb6, 0x4a, 0x1a,
|
||||
0xc0, 0xb4, 0x76, 0x95, 0x8c, 0x3e, 0x12, 0x68, 0x3e, 0xc7, 0x80, 0x7f, 0x39, 0x6f, 0x00, 0x1d,
|
||||
0xbe, 0x90, 0xdc, 0x70, 0x25, 0x5f, 0xad, 0x39, 0x9c, 0x08, 0x15, 0xf5, 0x48, 0xf1, 0x0c, 0x5a,
|
||||
0x73, 0xa1, 0xb6, 0xd4, 0xa9, 0x59, 0x28, 0xc0, 0x63, 0x2b, 0x5d, 0x40, 0x36, 0x53, 0xca, 0xf8,
|
||||
0x03, 0x3a, 0x13, 0x3c, 0x38, 0xfe, 0x89, 0x99, 0x5b, 0xab, 0x94, 0x5e, 0x1f, 0x7d, 0xda, 0x4c,
|
||||
0x91, 0xc1, 0x53, 0x68, 0x2c, 0x99, 0x96, 0x4c, 0xc4, 0x5c, 0x11, 0x39, 0x9e, 0xdb, 0x9d, 0x9a,
|
||||
0xda, 0x74, 0xa9, 0xe3, 0x03, 0xc2, 0x6b, 0x68, 0xce, 0x57, 0x54, 0x70, 0xe9, 0xea, 0x77, 0x1d,
|
||||
0x0f, 0x7e, 0xaf, 0x29, 0xee, 0x82, 0x23, 0x94, 0x5c, 0xf9, 0xfb, 0x53, 0xe8, 0x1e, 0x0a, 0xff,
|
||||
0xa9, 0x71, 0xd6, 0xf0, 0x7f, 0xcd, 0xe5, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4c, 0x2b, 0xb3,
|
||||
0xcf, 0x46, 0x02, 0x00, 0x00,
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ message Group {
|
||||
string name = 2;
|
||||
// Profile id
|
||||
string profile = 3;
|
||||
// tags required to match the group
|
||||
map<string, string> requirements = 4;
|
||||
// JSON encoded metadata (with restrictions)
|
||||
// Selectors to match machines
|
||||
map<string, string> selector = 4;
|
||||
// JSON encoded metadata
|
||||
bytes metadata = 5;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,18 +7,18 @@ import (
|
||||
var (
|
||||
// Group is a machine group for testing.
|
||||
Group = &storagepb.Group{
|
||||
Id: "test-group",
|
||||
Name: "test group",
|
||||
Profile: "g1h2i3j4",
|
||||
Requirements: map[string]string{"uuid": "a1b2c3d4"},
|
||||
Metadata: []byte(`{"k8s_version":"v1.1.2","pod_network":"10.2.0.0/16","service_name":"etcd2"}`),
|
||||
Id: "test-group",
|
||||
Name: "test group",
|
||||
Profile: "g1h2i3j4",
|
||||
Selector: map[string]string{"uuid": "a1b2c3d4"},
|
||||
Metadata: []byte(`{"k8s_version":"v1.1.2","pod_network":"10.2.0.0/16","service_name":"etcd2"}`),
|
||||
}
|
||||
|
||||
// GroupNoMetadata is a Group without any metadata.
|
||||
GroupNoMetadata = &storagepb.Group{
|
||||
Id: "group-no-metadata",
|
||||
Requirements: map[string]string{"uuid": "a1b2c3d4"},
|
||||
Metadata: nil,
|
||||
Id: "group-no-metadata",
|
||||
Selector: map[string]string{"uuid": "a1b2c3d4"},
|
||||
Metadata: nil,
|
||||
}
|
||||
|
||||
// Profile is a machine profile for testing.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "etcd-aws",
|
||||
"name": "etcd Node",
|
||||
"profile": "etcd-aws",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"name": "etcd",
|
||||
"platform": "aws"
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node1",
|
||||
"name": "etcd Node 1",
|
||||
"profile": "etcd",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "16e7d8a7-bfa9-428b-9117-363341bb330b"
|
||||
},
|
||||
"metadata": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node2",
|
||||
"name": "etcd Node 2",
|
||||
"profile": "etcd",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "264cd073-ca62-44b3-98c0-50aad5b5f819"
|
||||
},
|
||||
"metadata": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node3",
|
||||
"name": "etcd Node 3",
|
||||
"profile": "etcd",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "39d2e747-2648-4d68-ae92-bbc70b245055"
|
||||
},
|
||||
"metadata": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node1",
|
||||
"name": "etcd Node 1",
|
||||
"profile": "etcd",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "16e7d8a7-bfa9-428b-9117-363341bb330b",
|
||||
"os": "installed"
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node2",
|
||||
"name": "etcd Node 2",
|
||||
"profile": "etcd",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "264cd073-ca62-44b3-98c0-50aad5b5f819",
|
||||
"os": "installed"
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node3",
|
||||
"name": "etcd Node 3",
|
||||
"profile": "etcd",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "39d2e747-2648-4d68-ae92-bbc70b245055",
|
||||
"os": "installed"
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "etcd-proxies",
|
||||
"name": "etcd Proxy",
|
||||
"profile": "etcd-proxy",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"os": "installed"
|
||||
},
|
||||
"metadata": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node1",
|
||||
"name": "etcd Node 1",
|
||||
"profile": "etcd",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "16e7d8a7-bfa9-428b-9117-363341bb330b"
|
||||
},
|
||||
"metadata": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node2",
|
||||
"name": "etcd Node 2",
|
||||
"profile": "etcd",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "264cd073-ca62-44b3-98c0-50aad5b5f819"
|
||||
},
|
||||
"metadata": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node3",
|
||||
"name": "etcd Node 3",
|
||||
"profile": "etcd",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "39d2e747-2648-4d68-ae92-bbc70b245055"
|
||||
},
|
||||
"metadata": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node1",
|
||||
"name": "Master Node",
|
||||
"profile": "k8s-master",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "16e7d8a7-bfa9-428b-9117-363341bb330b"
|
||||
},
|
||||
"metadata": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node2",
|
||||
"name": "Worker 1",
|
||||
"profile": "k8s-worker",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "264cd073-ca62-44b3-98c0-50aad5b5f819"
|
||||
},
|
||||
"metadata": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node3",
|
||||
"name": "Worker 2",
|
||||
"profile": "k8s-worker",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "39d2e747-2648-4d68-ae92-bbc70b245055"
|
||||
},
|
||||
"metadata": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node1",
|
||||
"name": "Master Node",
|
||||
"profile": "k8s-master-install",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"os": "installed",
|
||||
"uuid": "16e7d8a7-bfa9-428b-9117-363341bb330b"
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node2",
|
||||
"name": "Worker 1",
|
||||
"profile": "k8s-worker-install",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"os": "installed",
|
||||
"uuid": "264cd073-ca62-44b3-98c0-50aad5b5f819"
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node3",
|
||||
"name": "Worker 2",
|
||||
"profile": "k8s-worker-install",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"os": "installed",
|
||||
"uuid": "39d2e747-2648-4d68-ae92-bbc70b245055"
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node1",
|
||||
"name": "Master Node",
|
||||
"profile": "k8s-master",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "16e7d8a7-bfa9-428b-9117-363341bb330b"
|
||||
},
|
||||
"metadata": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node2",
|
||||
"name": "Worker 1",
|
||||
"profile": "k8s-worker",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "264cd073-ca62-44b3-98c0-50aad5b5f819"
|
||||
},
|
||||
"metadata": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "node3",
|
||||
"name": "Worker 2",
|
||||
"profile": "k8s-worker",
|
||||
"requirements": {
|
||||
"selector": {
|
||||
"uuid": "39d2e747-2648-4d68-ae92-bbc70b245055"
|
||||
},
|
||||
"metadata": {
|
||||
|
||||
Reference in New Issue
Block a user