Keys are labels that can be given to resources. They can be used to filter widgets or to determine the optimal node placement for resources using Dynamic Workload Placement. Keys can be set by either the master billing entity, billing entities, or customers, and are set when managing the appropriate resource. The master billing entity can set keys on all resources, billing entities can set keys on resources belonging to the billing entity (such as customers, for example), and customers can set keys on resources belonging to them, for example servers.
Multiple keys can be set on the same resource, with the limitation that each key name is only used once per resource. For example, you cannot have two keys named alpha on the same server, but you can have a key named alpha on a second server. Equally, you can have two keys called alpha and beta on the same server. For information on how to set keys, see Setting Keys on Resources.
Broadly speaking, keys come in one of two types: normal and placement keys. There are further sub-types of placement keys; these are discussed in more detail in How the Dynamic Workload Placement System Works.
Normal keys can be assigned to resources to filter the widgets that display these resources.
- You have a server called my server.
- You add a key/value pair to my server of Key: Project, Value: test project
- You cannot add another key with the name Project to that resource, but you can still add a key with the name Project to another server or add additional keys to this server, such as Key: Maintainer, Value: Bob.
You can filter Widgets in the user interfaces to only shows resources with certain key or key value pairs in them, enabling you to have complete control of how you want to view and categorise your resources.
Placement keys are used in the Dynamic Workload Placement system to determine the optimal node placement for virtual machines. This is done by determining a score for a pair of matched placement keys. There are also special, reserved, and sticky placement keys. For an explanation of the differences between these sub-types, see How the Dynamic Workload Placement System Works.
Placement keys are matched using their names. This means that if a node placement key has the same name as a resource placement key, a score is calculated for the key pair. This does not apply if two customers of the same billing entity are using identical placement key names, as the placement keys are used only within the entity that created them. This means that if two customers create placement keys with the same name, the keys will not interact; however if a billing entity creates a placement key, all the billing entity's customers will have the same placement key and the keys will interact with each other.
The score of a node based on the value of the placement keys assigned to both the node and the virtual machine, and the weight of the placement key assigned to a resource. This is calculated using the following method:
X = Node placement key value - Resource placement key value #If X is a negative number, the negative sign is ignored when calculating Y. Y = 1 - X #If Y < 0, Y = 0. Score = Y x Resource placement key weight
For this reason, if you are configuring Dynamic Workload Placement to more strongly influence resources onto a particular node, it is advisable to use integers for placement key weights. If you are configuring Dynamic Workload Placement to suggest an order of precedence for the nodes that resources should start on, it is advisable to use decimal values for placement key weights.