Affinity#
-
class Affinity#
This is the base class for affinity operators, which defines the common interface for affinity operators.
Subclassed by YR::InstancePreferredAffinity, YR::InstancePreferredAntiAffinity, YR::InstanceRequiredAffinity, YR::InstanceRequiredAntiAffinity, YR::ResourcePreferredAffinity, YR::ResourcePreferredAntiAffinity, YR::ResourceRequiredAffinity, YR::ResourceRequiredAntiAffinity
Public Functions
-
Affinity() = delete#
Does not support default constructor.
-
inline Affinity(const std::string &kind, const std::string &type, const std::list<LabelOperator> &operators)#
Construct an affinity operation object.
- Parameters:
kind – The affinity kind mainly include
RESOURCEandINSTANCE.RESOURCErefers to predefined resource label affinity, whileINSTANCErefers to dynamic instance label affinity.type – The affinity type mainly include
PREFERRED,PREFERRED_ANTI,REQUIREDandREQUIRED_ANTI, which represent weak affinity, weak anti-affinity, strong affinity, and strong anti-affinity, respectively.operators – Label operation list, see LabelOperator and its subclasses for details.
-
inline Affinity(const std::string &kind, const std::string &type, const std::list<LabelOperator> &operators, const std::string &affinityScope)#
Construct an affinity operation object.
- Parameters:
kind – The affinity kind mainly include
RESOURCEandINSTANCE.RESOURCErefers to predefined resource label affinity, whileINSTANCErefers to dynamic instance label affinity.type – The affinity type mainly include
PREFERRED,PREFERRED_ANTI,REQUIREDandREQUIRED_ANTI, which represent weak affinity, weak anti-affinity, strong affinity, and strong anti-affinity, respectively.operators – Label operation list, see LabelOperator and its subclasses for details.
affinityScope – The instance affinity scope mainly includes two types:
AFFINITYSCOPE_PODandAFFINITYSCOPE_NODE.
-
~Affinity() = default#
Default Destructor.
-
inline std::list<LabelOperator> GetLabelOperators() const#
Get the list of label operation objects with affinity.
- Returns:
The list of label operation objects with affinity.
-
inline std::string GetAffinityScope() const#
Get the scope of instance affinity.
- Returns:
The scope of instance affinity.
-
inline void SetAffinityScope(const std::string &affinityScope)#
Set the scope of instance affinity.
-
Affinity() = delete#
-
class LabelOperator#
This is the base class for tag operators, which defines the common interface for tag operators.
Subclassed by YR::LabelDoesNotExistOperator, YR::LabelExistsOperator, YR::LabelInOperator, YR::LabelNotInOperator
Public Functions
-
LabelOperator() = delete#
Does not support default constructor.
-
inline LabelOperator(const std::string &type, const std::string &key, const std::list<std::string> &values)#
Construct a label operation object.
- Parameters:
type – Label operation type, supporting the following categories:
LABEL_IN,LABEL_NOT_IN,LABEL_EXISTS,LABEL_DOES_NOT_EXIST.key – The key of the label.
values – The value of the label.
-
inline LabelOperator(const std::string &type, const std::string &key)#
Construct a label operation object.
- Parameters:
type – Label operation type, supporting the following categories:
LABEL_IN,LABEL_NOT_IN,LABEL_EXISTS,LABEL_DOES_NOT_EXIST.key – The key of the label.
-
~LabelOperator() = default#
Default Destructor.
-
inline std::string GetOperatorType() const#
Get the type of the label operation object.
- Returns:
The type of the label operation object.
-
inline std::string GetKey() const#
Get the key of the label.
- Returns:
The key of the label.
-
inline std::list<std::string> GetValues() const#
Get the values of the label.
- Returns:
The values of the label.
-
LabelOperator() = delete#
-
class ResourcePreferredAffinity : public YR::Affinity#
The affinity kind is
RESOURCE, and the affinity type isPREFERRED.Public Functions
-
inline ResourcePreferredAffinity(const LabelOperator &labelOperator)#
Construct a new ResourcePreferred Affinity object.
- Parameters:
labelOperator – Label operation.
-
inline ResourcePreferredAffinity(const std::list<LabelOperator> &operators)#
Construct a new ResourcePreferred Affinity object.
- Parameters:
operators – Label operation list.
-
inline ResourcePreferredAffinity(const LabelOperator &labelOperator)#
-
class InstancePreferredAffinity : public YR::Affinity#
The affinity kind is
INSTANCE, and the affinity type isPREFERRED.Public Functions
-
inline InstancePreferredAffinity(const LabelOperator &labelOperator)#
Construct a new InstancePreferred Affinity object.
- Parameters:
labelOperator – Label operation.
-
inline InstancePreferredAffinity(const std::list<LabelOperator> &operators)#
Construct a new InstancePreferred Affinity object.
- Parameters:
operators – Label operation list.
-
inline InstancePreferredAffinity(const LabelOperator &labelOperator)#
-
class ResourceRequiredAffinity : public YR::Affinity#
The affinity kind is
RESOURCE, and the affinity type isREQUIRED.Public Functions
-
inline ResourceRequiredAffinity(const LabelOperator &labelOperator)#
Construct a new ResourceRequired Affinity object.
- Parameters:
labelOperator – Label operation.
-
inline ResourceRequiredAffinity(const std::list<LabelOperator> &operators)#
Construct a new ResourceRequired Affinity object.
- Parameters:
operators – Label operation list.
-
inline ResourceRequiredAffinity(const LabelOperator &labelOperator)#
-
class InstanceRequiredAffinity : public YR::Affinity#
The affinity kind is
INSTANCE, and the affinity type isREQUIRED.Public Functions
-
inline InstanceRequiredAffinity(const LabelOperator &labelOperator)#
Construct a new InstanceRequired Affinity object.
- Parameters:
labelOperator – Label operation.
-
inline InstanceRequiredAffinity(const std::list<LabelOperator> &operators)#
Construct a new InstanceRequired Affinity object.
- Parameters:
operators – Label operation list.
-
inline InstanceRequiredAffinity(const LabelOperator &labelOperator)#
-
class ResourcePreferredAntiAffinity : public YR::Affinity#
The affinity kind is
RESOURCE, and the affinity type isPREFERRED_ANTI.Public Functions
-
inline ResourcePreferredAntiAffinity(const LabelOperator &labelOperator)#
Construct a new ResourcePreferred AntiAffinity object.
- Parameters:
labelOperator – Label operation.
-
inline ResourcePreferredAntiAffinity(const std::list<LabelOperator> &operators)#
Construct a new ResourcePreferred AntiAffinity object.
- Parameters:
operators – Label operation list.
-
inline ResourcePreferredAntiAffinity(const LabelOperator &labelOperator)#
-
class InstancePreferredAntiAffinity : public YR::Affinity#
The affinity kind is
INSTANCE, and the affinity type isPREFERRED_ANTI.Public Functions
-
inline InstancePreferredAntiAffinity(const LabelOperator &labelOperator)#
Construct a new InstancePreferred AntiAffinity object.
- Parameters:
labelOperator – Label operation.
-
inline InstancePreferredAntiAffinity(const std::list<LabelOperator> &operators)#
Construct a new InstancePreferred AntiAffinity object.
- Parameters:
operators – Label operation list.
-
inline InstancePreferredAntiAffinity(const LabelOperator &labelOperator)#
-
class ResourceRequiredAntiAffinity : public YR::Affinity#
The affinity kind is
RESOURCE, and the affinity type isREQUIRED_ANTI.Public Functions
-
inline ResourceRequiredAntiAffinity(const LabelOperator &labelOperator)#
Construct a new ResourceRequired AntiAffinity object.
- Parameters:
labelOperator – Label operation.
-
inline ResourceRequiredAntiAffinity(const std::list<LabelOperator> &operators)#
Construct a new ResourceRequired AntiAffinity object.
- Parameters:
operators – Label operation list.
-
inline ResourceRequiredAntiAffinity(const LabelOperator &labelOperator)#
-
class InstanceRequiredAntiAffinity : public YR::Affinity#
The affinity kind is
INSTANCE, and the affinity type isREQUIRED_ANTI.Public Functions
-
inline InstanceRequiredAntiAffinity(const LabelOperator &labelOperator)#
Construct a new InstanceRequired AntiAffinity object.
- Parameters:
labelOperator – Label operation.
-
inline InstanceRequiredAntiAffinity(const std::list<LabelOperator> &operators)#
Construct a new InstanceRequired AntiAffinity object.
- Parameters:
operators – Label operation list.
-
inline InstanceRequiredAntiAffinity(const LabelOperator &labelOperator)#
-
class LabelInOperator : public YR::LabelOperator#
The label operation class with the operation type
LABEL_IN.Public Functions
-
inline LabelInOperator(const std::string &key, const std::list<std::string> &values)#
Construct a label operation object of type
LABEL_IN.- Parameters:
key – The key of the label.
values – The values of the label.
-
inline LabelInOperator(const std::string &key, const std::list<std::string> &values)#
-
class LabelNotInOperator : public YR::LabelOperator#
The label operation class with the operation type
LABEL_NOT_IN.Public Functions
-
inline LabelNotInOperator(const std::string &key, const std::list<std::string> &values)#
Construct a label operation object of type
LABEL_NOT_IN.- Parameters:
key – The key of the label.
values – The values of the label.
-
inline LabelNotInOperator(const std::string &key, const std::list<std::string> &values)#
-
class LabelExistsOperator : public YR::LabelOperator#
The label operation class with the operation type
LABEL_EXISTS.Public Functions
-
inline LabelExistsOperator(const std::string &key)#
Construct a label operation object of type
LABEL_EXISTS.- Parameters:
key – The key of the label.
-
inline LabelExistsOperator(const std::string &key)#
-
class LabelDoesNotExistOperator : public YR::LabelOperator#
The label operation class with the operation type
LABEL_DOES_NOT_EXIST.Public Functions
-
inline LabelDoesNotExistOperator(const std::string &key)#
Construct a label operation object of type
LABEL_DOES_NOT_EXIST.- Parameters:
key – The key of the label.
-
inline LabelDoesNotExistOperator(const std::string &key)#
The parameter descriptions are supplemented as follows:
-
const std::string YR::RESOURCE = "Resource"#
Affinity kind, indicating the predefined resource label affinity.
-
const std::string YR::INSTANCE = "Instance"#
Affinity kind, indicating the dynamic instance label affinity.
-
const std::string YR::PREFERRED_ANTI = "PreferredAntiAffinity"#
Affinity type, indicating weak anti-affinity.
-
const std::string YR::REQUIRED_ANTI = "RequiredAntiAffinity"#
Affinity type, indicating strong anti-affinity.
-
const std::string YR::LABEL_IN = "LabelIn"#
Label operation type, indicating that the corresponding label has a corresponding value.
-
const std::string YR::LABEL_NOT_IN = "LabelNotIn"#
Label operation type, indicating that the corresponding label does not have a corresponding value.
-
const std::string YR::LABEL_EXISTS = "LabelExists"#
Label operation type, indicating the presence of corresponding tags.
-
const std::string YR::LABEL_DOES_NOT_EXIST = "LabelDoesNotExist"#
Label operation type, indicating that there is no corresponding label.