Skip to content

Commit

Permalink
Merge pull request #10 from yyzxw/chore/update-label
Browse files Browse the repository at this point in the history
chore: update label
  • Loading branch information
kebe7jun authored Aug 13, 2024
2 parents 58c8287 + 93ea1c6 commit 90e4c2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 3 additions & 6 deletions internal/controller/snapshotpod_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log"

snapshotpodv1alpha1 "github.com/baizeai/kube-snapshot/api/v1alpha1"
)

const (
snapshotNameLabel = "snapshot-pod.baizeai.io/name"
"github.com/baizeai/kube-snapshot/pkg/apis/snapshotpod/v1alpha1"
)

// SnapshotPodReconciler reconciles a SnapshotPod object
Expand Down Expand Up @@ -124,7 +121,7 @@ func (r *SnapshotPodReconciler) reconcileTasks(ctx context.Context, sp *snapshot
snapshotPodOwner(sp),
},
Labels: map[string]string{
snapshotNameLabel: sp.Name,
v1alpha1.SnapshotNameLabel: sp.Name,
},
},
Spec: snapshotpodv1alpha1.SnapshotPodTaskSpec{
Expand Down Expand Up @@ -164,7 +161,7 @@ func (r *SnapshotPodReconciler) reconcileTasksStatus(ctx context.Context, sp *sn
sptList := snapshotpodv1alpha1.SnapshotPodTaskList{}
selector, _ := metav1.LabelSelectorAsSelector(&metav1.LabelSelector{
MatchLabels: map[string]string{
snapshotNameLabel: sp.Name,
v1alpha1.SnapshotNameLabel: sp.Name,
},
})
err := r.Client.List(ctx, &sptList, &client.ListOptions{
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/snapshotpod/v1alpha1/snapshot_labels.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package v1alpha1

const (
// SnapshotNameLabel is the label key for the snapshot name
SnapshotNameLabel = "snapshot-pod.baizeai.io/name"
)

0 comments on commit 90e4c2e

Please sign in to comment.