Merge pull request #123937 from p0lyn0mial/upstream-use-initial-events-annotation-key-const

use metav1.InitialEventsAnnotationKey const

Kubernetes-commit: c016b0b9a8ca63dbec1fade0910c2a06017cc4ab
This commit is contained in:
Kubernetes Publisher 2024-04-18 01:05:06 -07:00
commit a82df61b84
2 changed files with 8 additions and 8 deletions

View File

@ -780,7 +780,7 @@ loop:
}
case watch.Bookmark:
// A `Bookmark` means watch has synced here, just update the resourceVersion
if meta.GetAnnotations()["k8s.io/initial-events-end"] == "true" {
if meta.GetAnnotations()[metav1.InitialEventsAnnotationKey] == "true" {
if exitOnInitialEventsEndBookmark != nil {
*exitOnInitialEventsEndBookmark = true
}

View File

@ -174,7 +174,7 @@ func TestWatchList(t *testing.T) {
{Type: watch.Bookmark, Object: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
Annotations: map[string]string{"k8s.io/initial-events-end": "true"},
Annotations: map[string]string{metav1.InitialEventsAnnotationKey: "true"},
},
}},
},
@ -203,7 +203,7 @@ func TestWatchList(t *testing.T) {
{Type: watch.Bookmark, Object: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "5",
Annotations: map[string]string{"k8s.io/initial-events-end": "true"},
Annotations: map[string]string{metav1.InitialEventsAnnotationKey: "true"},
},
}},
},
@ -241,7 +241,7 @@ func TestWatchList(t *testing.T) {
{Type: watch.Bookmark, Object: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
Annotations: map[string]string{"k8s.io/initial-events-end": "true"},
Annotations: map[string]string{metav1.InitialEventsAnnotationKey: "true"},
},
}},
},
@ -279,7 +279,7 @@ func TestWatchList(t *testing.T) {
{Type: watch.Bookmark, Object: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "1",
Annotations: map[string]string{"k8s.io/initial-events-end": "true"},
Annotations: map[string]string{metav1.InitialEventsAnnotationKey: "true"},
},
}},
},
@ -310,7 +310,7 @@ func TestWatchList(t *testing.T) {
{Type: watch.Bookmark, Object: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
Annotations: map[string]string{"k8s.io/initial-events-end": "true"},
Annotations: map[string]string{metav1.InitialEventsAnnotationKey: "true"},
},
}},
{Type: watch.Added, Object: makePod("p3", "3")},
@ -351,7 +351,7 @@ func TestWatchList(t *testing.T) {
{Type: watch.Bookmark, Object: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
Annotations: map[string]string{"k8s.io/initial-events-end": "true"},
Annotations: map[string]string{metav1.InitialEventsAnnotationKey: "true"},
},
}},
{Type: watch.Added, Object: makePod("p3", "3")},
@ -382,7 +382,7 @@ func TestWatchList(t *testing.T) {
{Type: watch.Bookmark, Object: &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
ResourceVersion: "2",
Annotations: map[string]string{"k8s.io/initial-events-end": "false"},
Annotations: map[string]string{metav1.InitialEventsAnnotationKey: "false"},
},
}},
},