DRA device taints: automatically bump TimeAdded when changing effect

In practice, TimeAdded is managed by the API server. When admins used
DeviceTaintRule to simulate eviction, then change the effect to really evict,
it is useful to calculate tolerations based on the time when that second
update happened. Therefore the TimeAdded field gets bumped automatically
when changing the effect.

Kubernetes-commit: f28dc4139208e64fe2882cd44d548c25020f2e3a
This commit is contained in:
Patrick Ohly
2026-02-20 12:35:40 +01:00
committed by Kubernetes Publisher
parent 55e741a004
commit 67f0d98034
4 changed files with 40 additions and 4 deletions

View File

@@ -43,8 +43,17 @@ type DeviceTaintApplyConfiguration struct {
// nodes is not valid here. More effects may get added in the future.
// Consumers must treat unknown effects like None.
Effect *resourcev1.DeviceTaintEffect `json:"effect,omitempty"`
// TimeAdded represents the time at which the taint was added.
// TimeAdded represents the time at which the taint was added or
// (only in a DeviceTaintRule) the effect was modified.
// Added automatically during create or update if not set.
//
// In addition, in a DeviceTaintRule a value provided during
// an update gets replaced with the current time if the provided
// value is the same as the old one and the new effect is different.
// Changing the key and/or value while keeping the effect unchanged
// is possible and does not update the time stamp because the eviction
// which uses it is either already started (NoExecute) or
// not started yet (NoEffect, NoSchedule).
TimeAdded *metav1.Time `json:"timeAdded,omitempty"`
}

View File

@@ -43,8 +43,17 @@ type DeviceTaintApplyConfiguration struct {
// nodes is not valid here. More effects may get added in the future.
// Consumers must treat unknown effects like None.
Effect *resourcev1alpha3.DeviceTaintEffect `json:"effect,omitempty"`
// TimeAdded represents the time at which the taint was added.
// TimeAdded represents the time at which the taint was added or
// (only in a DeviceTaintRule) the effect was modified.
// Added automatically during create or update if not set.
//
// In addition, in a DeviceTaintRule a value provided during
// an update gets replaced with the current time if the provided
// value is the same as the old one and the new effect is different.
// Changing the key and/or value while keeping the effect unchanged
// is possible and does not update the time stamp because the eviction
// which uses it is either already started (NoExecute) or
// not started yet (NoEffect, NoSchedule).
TimeAdded *v1.Time `json:"timeAdded,omitempty"`
}

View File

@@ -43,8 +43,17 @@ type DeviceTaintApplyConfiguration struct {
// nodes is not valid here. More effects may get added in the future.
// Consumers must treat unknown effects like None.
Effect *resourcev1beta1.DeviceTaintEffect `json:"effect,omitempty"`
// TimeAdded represents the time at which the taint was added.
// TimeAdded represents the time at which the taint was added or
// (only in a DeviceTaintRule) the effect was modified.
// Added automatically during create or update if not set.
//
// In addition, in a DeviceTaintRule a value provided during
// an update gets replaced with the current time if the provided
// value is the same as the old one and the new effect is different.
// Changing the key and/or value while keeping the effect unchanged
// is possible and does not update the time stamp because the eviction
// which uses it is either already started (NoExecute) or
// not started yet (NoEffect, NoSchedule).
TimeAdded *v1.Time `json:"timeAdded,omitempty"`
}

View File

@@ -43,8 +43,17 @@ type DeviceTaintApplyConfiguration struct {
// nodes is not valid here. More effects may get added in the future.
// Consumers must treat unknown effects like None.
Effect *resourcev1beta2.DeviceTaintEffect `json:"effect,omitempty"`
// TimeAdded represents the time at which the taint was added.
// TimeAdded represents the time at which the taint was added or
// (only in a DeviceTaintRule) the effect was modified.
// Added automatically during create or update if not set.
//
// In addition, in a DeviceTaintRule a value provided during
// an update gets replaced with the current time if the provided
// value is the same as the old one and the new effect is different.
// Changing the key and/or value while keeping the effect unchanged
// is possible and does not update the time stamp because the eviction
// which uses it is either already started (NoExecute) or
// not started yet (NoEffect, NoSchedule).
TimeAdded *v1.Time `json:"timeAdded,omitempty"`
}