Merge pull request #9577 from microsoft/saulparedes/topology

genpolicy: add topologySpreadConstraints support
This commit is contained in:
Wainer Moschetta
2024-07-02 11:24:26 -03:00
committed by GitHub
2 changed files with 30 additions and 0 deletions

View File

@@ -89,6 +89,9 @@ pub struct PodSpec {
#[serde(skip_serializing_if = "Option::is_none")]
dnsPolicy: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
topologySpreadConstraints: Option<Vec<TopologySpreadConstraint>>,
}
/// See Reference / Kubernetes API / Workload Resources / Pod.
@@ -503,6 +506,29 @@ struct PodDNSConfigOption {
value: Option<String>,
}
/// See Reference / Kubernetes API / Workload Resources / Pod.
#[derive(Clone, Debug, Serialize, Deserialize)]
struct TopologySpreadConstraint {
maxSkew: i32,
topologyKey: String,
whenUnsatisfiable: String,
#[serde(skip_serializing_if = "Option::is_none")]
labelSelector: Option<yaml::LabelSelector>,
#[serde(skip_serializing_if = "Option::is_none")]
matchLabelKeys: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
minDomains: Option<i32>,
#[serde(skip_serializing_if = "Option::is_none")]
nodeAffinityPolicy: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
nodeTaintsPolicy: Option<String>,
}
impl Container {
pub async fn init(&mut self, config: &Config) {
// Load container image properties from the registry.

View File

@@ -27,3 +27,7 @@ spec:
securityContext:
seccompProfile:
type: RuntimeDefault
topologySpreadConstraints:
- maxSkew: 2
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway