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 RESOURCE and INSTANCE. RESOURCE refers to predefined resource label affinity, while INSTANCE refers to dynamic instance label affinity.

  • type – The affinity type mainly include PREFERRED, PREFERRED_ANTI, REQUIRED and REQUIRED_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 RESOURCE and INSTANCE. RESOURCE refers to predefined resource label affinity, while INSTANCE refers to dynamic instance label affinity.

  • type – The affinity type mainly include PREFERRED, PREFERRED_ANTI, REQUIRED and REQUIRED_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_POD and AFFINITYSCOPE_NODE.

~Affinity() = default#

Default Destructor.

inline std::string GetAffinityKind() const#

Get Affinity kind.

Returns:

The kind of affinity.

inline std::string GetAffinityType() const#

Get Affinity type.

Returns:

The type of affinity.

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.

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.

class ResourcePreferredAffinity : public YR::Affinity#

The affinity kind is RESOURCE, and the affinity type is PREFERRED.

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.

class InstancePreferredAffinity : public YR::Affinity#

The affinity kind is INSTANCE, and the affinity type is PREFERRED.

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.

class ResourceRequiredAffinity : public YR::Affinity#

The affinity kind is RESOURCE, and the affinity type is REQUIRED.

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.

class InstanceRequiredAffinity : public YR::Affinity#

The affinity kind is INSTANCE, and the affinity type is REQUIRED.

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.

class ResourcePreferredAntiAffinity : public YR::Affinity#

The affinity kind is RESOURCE, and the affinity type is PREFERRED_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.

class InstancePreferredAntiAffinity : public YR::Affinity#

The affinity kind is INSTANCE, and the affinity type is PREFERRED_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.

class ResourceRequiredAntiAffinity : public YR::Affinity#

The affinity kind is RESOURCE, and the affinity type is REQUIRED_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.

class InstanceRequiredAntiAffinity : public YR::Affinity#

The affinity kind is INSTANCE, and the affinity type is REQUIRED_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.

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.

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.

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.

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.

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 = "PreferredAffinity"#

Affinity type, indicating weak affinity.

const std::string YR::PREFERRED_ANTI = "PreferredAntiAffinity"#

Affinity type, indicating weak anti-affinity.

const std::string YR::REQUIRED = "RequiredAffinity"#

Affinity type, indicating strong 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.