Documentation ¶
Index ¶
Constants ¶
const ( // DynamicStrategy is used for dynamic node allocation to one of many // replaceable nodes, while StaticStrategy is used when a manifest // must be scheduled on specific nodes DynamicStrategy = Strategy("dynamic_strategy") StaticStrategy = Strategy("static_strategy") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ID ¶
type ID string
ID is a named type alias for Resource Controller IDs. This is preferred to the raw string format so that Go will typecheck its uses.
type RC ¶
type RC struct { // GUID for this controller ID ID // The pod manifest that should be scheduled on nodes Manifest manifest.Manifest // Defines the set of nodes on which the manifest can be scheduled NodeSelector labels.Selector // A set of labels that will be added to every pod scheduled by this controller. PodLabels labels.Set // The desired number of instances of the manifest that should be // scheduled. ReplicasDesired int // When disabled, this controller will not make any scheduling changes Disabled bool // Distinguishes between dynamic, static or other strategies for allocating // nodes on which the rc can schedule the manifest. AllocationStrategy Strategy }
RC holds the runtime state of a Resource Controller as saved in Consul.
func (RC) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for serializing the RC to JSON format.
The RC struct contains interfaces (manifest.Manifest, labels.Selector), and unmarshaling into a nil, non-empty interface is impossible (unless the value is a JSON null), because the unmarshaler doesn't know what structure to allocate there we own manifest.Manifest, but we don't own labels.Selector, so we have to implement the json marshaling here to wrap around the interface values
func (*RC) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for deserializing the JSON representation of an RC.
type RawRC ¶
type RawRC struct { ID ID `json:"id"` Manifest string `json:"manifest"` NodeSelector string `json:"node_selector"` PodLabels labels.Set `json:"pod_labels"` // ReplicasDesired is an int pointer so we can distinguish between a // zero-count indicating the RC handler should remove any and all pods // from a case (for instance if the json key was changed) where golang // is defaulting to the 0 value ReplicasDesired *int `json:"replicas_desired"` Disabled bool `json:"disabled"` AllocationStrategy Strategy `json:"allocation_strategy"` }
RawRC defines the JSON format used to store data into Consul. It should only be used while (de-)serializing the RC state. Prefer using the "RC" when possible.