Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Commit 74b6130

Browse files
author
David Chung
authored
Support for attachments in vanilla plugin (#455)
Signed-off-by: David Chung <[email protected]>
1 parent a8cf57d commit 74b6130

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

docs/cattle.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"Tags": {
2121
"tier": "web",
2222
"project": "infrakit"
23-
}
23+
},
24+
"Attachments" : [{"ID":"attachid", "Type": "attachtype"}]
2425
}
2526
}
2627
}

docs/cattle2.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"Tags": {
2121
"tier": "web",
2222
"project": "infrakit"
23-
}
23+
},
24+
"Attachments" : [{"ID":"attachid", "Type": "attachtype"}]
2425
}
2526
}
2627
}

docs/tutorial.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ Putting everything together, we have the configuration to give to the default Gr
9595
"Tags": {
9696
"tier": "web",
9797
"project": "infrakit"
98-
}
98+
},
99+
"Attachments" : [{"ID":"attachid", "Type": "attachtype"}]
99100
}
100101
}
101102
}
@@ -192,7 +193,8 @@ Now let's update the configuration by changing the size of the group and a prope
192193
"Tags": {
193194
"tier": "web",
194195
"project": "infrakit"
195-
}
196+
},
197+
"Attachments" : [{"ID":"attachid", "Type": "attachtype"}]
196198
}
197199
}
198200
}

examples/flavor/vanilla/flavor.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ type Spec struct {
1616

1717
// Tags
1818
Tags map[string]string
19+
20+
// Attachments are instructions for external entities that should be attached to the instance.
21+
Attachments []instance.Attachment
1922
}
2023

2124
// NewPlugin creates a Flavor plugin that doesn't do very much. It assumes instances are
@@ -69,5 +72,10 @@ func (f vanillaFlavor) Prepare(flavor *types.Any,
6972
}
7073
instance.Tags[k] = v
7174
}
75+
76+
// Attachements
77+
for _, a := range s.Attachments {
78+
instance.Attachments = append(instance.Attachments, a)
79+
}
7280
return instance, nil
7381
}

0 commit comments

Comments
 (0)