Skip to content

Commit

Permalink
Remove unused statefulset label.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbobrovskyi committed Jan 3, 2025
1 parent bb38224 commit c457cb2
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 32 deletions.
3 changes: 2 additions & 1 deletion hack/e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,6 @@ trap cleanup EXIT
startup
kind_load
kueue_deploy
read
# shellcheck disable=SC2086
$GINKGO $GINKGO_ARGS --junit-report=junit.xml --json-report=e2e.json --output-dir="$ARTIFACTS" -v ./test/e2e/$E2E_TARGET_FOLDER/...
#$GINKGO $GINKGO_ARGS --junit-report=junit.xml --json-report=e2e.json --output-dir="$ARTIFACTS" -v ./test/e2e/$E2E_TARGET_FOLDER/...
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req reconcile.Request) (r
if removed {
log.V(3).Info(
"Finalizing statefulset pod in group",
"statefulset", pod.Labels[StatefulSetNameLabel],
"pod", klog.KObj(pod),
"group", pod.Labels[podcontroller.GroupNameLabel],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,20 @@ func TestPodReconciler(t *testing.T) {
"should finalize succeeded pod": {
lws: statefulset.MakeStatefulSet("sts", "ns").Obj(),
pod: testingjobspod.MakePod("pod", "ns").
Label(StatefulSetNameLabel, "sts").
StatusPhase(corev1.PodSucceeded).
KueueFinalizer().
Obj(),
wantPod: testingjobspod.MakePod("pod", "ns").
Label(StatefulSetNameLabel, "sts").
StatusPhase(corev1.PodSucceeded).
Obj(),
},
"should finalize failed pod": {
lws: statefulset.MakeStatefulSet("sts", "ns").Obj(),
pod: testingjobspod.MakePod("pod", "ns").
Label(StatefulSetNameLabel, "sts").
StatusPhase(corev1.PodFailed).
KueueFinalizer().
Obj(),
wantPod: testingjobspod.MakePod("pod", "ns").
Label(StatefulSetNameLabel, "sts").
StatusPhase(corev1.PodFailed).
Obj(),
},
Expand Down
13 changes: 3 additions & 10 deletions pkg/controller/jobs/statefulset/statefulset_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ import (
utilpod "sigs.k8s.io/kueue/pkg/util/pod"
)

const (
// StatefulSetNameLabel label key in the pod is used to indicate the name of the StatefulSet.
StatefulSetNameLabel = "kueue.x-k8s.io/statefulset-name"
)

type Webhook struct {
client client.Client
manageJobsWithoutQueueName bool
Expand Down Expand Up @@ -85,13 +80,11 @@ func (wh *Webhook) Default(ctx context.Context, obj runtime.Object) error {
ss.Spec.Template.Annotations = make(map[string]string, 1)
}
ss.Spec.Template.Annotations[pod.SuspendedByParentAnnotation] = FrameworkName
if ss.Spec.Template.Labels == nil {
ss.Spec.Template.Labels = make(map[string]string, 1)
}
ss.Spec.Template.Labels[StatefulSetNameLabel] = ss.Name

queueName := jobframework.QueueNameForObject(ss.Object())
if queueName != "" {
if ss.Spec.Template.Labels == nil {
ss.Spec.Template.Labels = make(map[string]string, 2)
}
ss.Spec.Template.Labels[constants.QueueLabel] = queueName
groupName, err := GetWorkloadName(obj.(*appsv1.StatefulSet))
if err != nil {
Expand Down
4 changes: 0 additions & 4 deletions pkg/controller/jobs/statefulset/statefulset_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func TestDefault(t *testing.T) {
want: baseStatefulSetWithQueue.Clone().
PodTemplateSpecQueue(testQueueName).
PodTemplateAnnotation(pod.SuspendedByParentAnnotation, FrameworkName).
PodTemplateSpecLabel(StatefulSetNameLabel, testStatefulSetName).
PodTemplateSpecPodGroupNameLabel(groupName).
PodTemplateSpecPodGroupTotalCountAnnotation(3).
PodTemplateSpecPodGroupFastAdmissionAnnotation(true).
Expand All @@ -84,7 +83,6 @@ func TestDefault(t *testing.T) {
PodTemplateSpecPodGroupTotalCountAnnotation(3).
PodTemplateSpecQueue(testQueueName).
PodTemplateAnnotation(pod.SuspendedByParentAnnotation, FrameworkName).
PodTemplateSpecLabel(StatefulSetNameLabel, testStatefulSetName).
PodTemplateSpecPodGroupFastAdmissionAnnotation(true).
PodTemplateSpecPodGroupServingAnnotation(true).
PodTemplateSpecPodGroupPodIndexLabelAnnotation(appsv1.PodIndexLabel).
Expand All @@ -97,7 +95,6 @@ func TestDefault(t *testing.T) {
want: baseStatefulSet.Clone().Namespace(testDefaultNamespaceName).Queue(testDefaultQueueName).
PodTemplateSpecQueue(testDefaultQueueName).
PodTemplateAnnotation(pod.SuspendedByParentAnnotation, FrameworkName).
PodTemplateSpecLabel(StatefulSetNameLabel, testStatefulSetName).
PodTemplateSpecPodGroupNameLabel(groupName).
PodTemplateSpecPodGroupTotalCountAnnotation(3).
PodTemplateSpecPodGroupFastAdmissionAnnotation(true).
Expand All @@ -112,7 +109,6 @@ func TestDefault(t *testing.T) {
want: baseStatefulSetWithQueue.Clone().
PodTemplateSpecQueue(testQueueName).
PodTemplateAnnotation(pod.SuspendedByParentAnnotation, FrameworkName).
PodTemplateSpecLabel(StatefulSetNameLabel, testStatefulSetName).
PodTemplateSpecPodGroupNameLabel(groupName).
PodTemplateSpecPodGroupTotalCountAnnotation(3).
PodTemplateSpecPodGroupFastAdmissionAnnotation(true).
Expand Down
12 changes: 0 additions & 12 deletions site/content/en/docs/reference/labels-and-annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,3 @@ Example: `kueue.x-k8s.io/role-hash: "b54683bb"`
Used on: [Plain Pods](/docs/tasks/run/plain_pods/).

The annotation key is used as the name for a Workload podSet.


### kueue.x-k8s.io/statefulset-name

Type: Label

Example: `kueue.x-k8s.io/statefulset-name: "statefulset-name"`

Used on: [Plain Pods](/docs/tasks/run/plain_pods/).

The label key in the pod is used to indicate the name of the StatefulSet if the StatefulSet is the pod's owner.
This label is automatically generated when a StatefulSet is created or updated.

0 comments on commit c457cb2

Please sign in to comment.