Label Manager
Brief description
Architecture description
- LabelEntities: Refers to a collection of label entities, including cluster labels, configuration labels, engine labels, node labels, routing labels, search labels, etc.
- NodeLabelService: The associated service interface class of instance/node and label, which defines the interface method of adding, deleting, modifying and checking the relationship between the two and matching the instance/node according to the label.
- UserLabelService: Declare the associated operation between the user and the label.
- ResourceLabelService: Declare the associated operations of cluster resources and labels, involving resource management of combined labels, cleaning or setting the resource value associated with the label.
- NodeLabelScorer: Node label scorer, corresponding to the implementation of different label matching algorithms, using scores to indicate node label matching.
- According to the input, select the appropriate label class to be parsed.
- Convert the input value object to the tag value type, using implicit conversion or positive and negative analysis framework.
- According to the return of 1-3, instantiate the label, and perform some post operations according to different label classes.
- The input of the method should be two sets of network relationship lists, namely and , where the Node node in the relationship must have all the CORE and SUITABLE feature labels, these nodes are also called candidate nodes.
- The first step is to traverse and calculate the relationship list of , and traverse the label Label associated with each node. In this step, the label is scored first. If the label is not the label attached to the request, the score is 0. Otherwise, the score is divided into: (basic score/the number of times the tag corresponds to the feature value in the request) * the incentive value of the corresponding feature value, where the basic score defaults to 1, and the initial score of the node is the sum of the associated tag scores; where because The CORE/SUITABLE type label must be the only label, and the number of occurrences is always 1.
- After obtaining the initial score of the node, the second step is to traverse the calculation of the relationship. Since the first step ignores the effect of unrequested attached labels on the score, the proportion of irrelevant labels will indeed affect the score. This type of label is unified with the UNKNOWN feature, and this feature also has a corresponding incentive value; We set that the higher the proportion of candidate nodes associated with irrelevant labels in the total associated nodes, the more significant the impact on the score, which can further accumulate the initial score of the node obtained in the first step.
- Normalize the standard deviation of the scores of the candidate nodes and sort them.