Repository: knative/pkg
Pull request #2404 (2022-01-28 01:27:46)

[main] Update community files
Cron -knative-prow-robot

/cc knative/serving-writers knative/eventing-writers
/assign knative/serving-writers knative/eventing-writers

Produced by: knative-sandbox/knobots/actions/update-community

Details:
```

```

knative-prow-robot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by: *<a href="https://github.com/knative/pkg/pull/2404#" title="Author self-approved">knative-automation</a>*
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **julz** after the PR has been reviewed.
You can assign the PR to them by writing `/assign @julz` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=knative%2Fpkg).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/knative/pkg/blob/main/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["julz"]} -->
codecov[bot]: # [Codecov](https://codecov.io/gh/knative/pkg/pull/2404?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) Report
> Merging [#2404](https://codecov.io/gh/knative/pkg/pull/2404?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) (36caceb) into [main](https://codecov.io/gh/knative/pkg/commit/d7b329c36019326ccb19a90f0573db16b83b822e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) (d7b329c) will **decrease** coverage by `0.02%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/knative/pkg/pull/2404/graphs/tree.svg?width=650&height=150&src=pr&token=rlqpDnfxbO&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative)](https://codecov.io/gh/knative/pkg/pull/2404?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative)

```diff
@@            Coverage Diff             @@
##             main    #2404      +/-   ##
==========================================
- Coverage   63.53%   63.51%   -0.03%     
==========================================
  Files         226      226              
  Lines        9886     9886              
==========================================
- Hits         6281     6279       -2     
- Misses       3320     3321       +1     
- Partials      285      286       +1     
```


| [Impacted Files](https://codecov.io/gh/knative/pkg/pull/2404?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative) | Coverage Δ | |
|---|---|---|
| [test/gcs/mock/mock.go](https://codecov.io/gh/knative/pkg/pull/2404/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative#diff-dGVzdC9nY3MvbW9jay9tb2NrLmdv) | `92.47% <0.00%> (-1.08%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/knative/pkg/pull/2404?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/knative/pkg/pull/2404?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative). Last update [d7b329c...36caceb](https://codecov.io/gh/knative/pkg/pull/2404?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=knative).


Patch:
diff --git a/OWNERS_ALIASES b/OWNERS_ALIASES
index 4a3752e39..c0169064d 100644
--- a/OWNERS_ALIASES
+++ b/OWNERS_ALIASES
@@ -149,16 +149,16 @@ aliases:
   - efiturri
   - evankanderson
   - gerardo-lc
-  - joshua-bone
   - kvmware
   - shinigambit
-  - steuhs
   productivity-wg-leads:
   - chizhg
   productivity-writers:
+  - cardil
   - chaodaiG
   - chizhg
   - coryrc
+  - psschwei
   security-wg-leads:
   - evankanderson
   - julz
diff --git a/apiextensions/storageversion/migrator.go b/apiextensions/storageversion/migrator.go
index 2d1cb47ac..7ac1cc932 100644
--- a/apiextensions/storageversion/migrator.go
+++ b/apiextensions/storageversion/migrator.go
@@ -22,6 +22,7 @@ import (
 
 	apix "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
 	apixclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
+	apierrs "k8s.io/apimachinery/pkg/api/errors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/runtime"
 	"k8s.io/apimachinery/pkg/runtime/schema"
@@ -93,7 +94,7 @@ func (m *Migrator) migrateResources(ctx context.Context, gvr schema.GroupVersion
 		_, err := client.Namespace(item.GetNamespace()).
 			Patch(ctx, item.GetName(), types.MergePatchType, []byte("{}"), metav1.PatchOptions{})
 
-		if err != nil {
+		if err != nil && !apierrs.IsNotFound(err) {
 			return fmt.Errorf("unable to patch resource %s/%s (gvr: %s) - %w",
 				item.GetNamespace(), item.GetName(),
 				gvr, err)


Test patch:
diff --git a/apiextensions/storageversion/migrator_test.go b/apiextensions/storageversion/migrator_test.go
index b779995f5..8129d456c 100644
--- a/apiextensions/storageversion/migrator_test.go
+++ b/apiextensions/storageversion/migrator_test.go
@@ -24,6 +24,7 @@ import (
 	"github.com/google/go-cmp/cmp"
 	apix "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
 	apixFake "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/fake"
+	apierrs "k8s.io/apimachinery/pkg/api/errors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
 	runtime "k8s.io/apimachinery/pkg/runtime"
@@ -97,6 +98,7 @@ func TestMigrate_Errors(t *testing.T) {
 		name string
 		crd  func(*k8stesting.Fake)
 		dyn  func(*k8stesting.Fake)
+		pass bool
 	}{{
 		name: "failed to fetch CRD",
 		crd: func(fake *k8stesting.Fake) {
@@ -129,6 +131,16 @@ func TestMigrate_Errors(t *testing.T) {
 					return true, nil, errors.New("failed to patch definition")
 				})
 		},
+	}, {
+		name: "patching unexisting resource",
+		dyn: func(fake *k8stesting.Fake) {
+			fake.PrependReactor("patch", "*",
+				func(k8stesting.Action) (bool, runtime.Object, error) {
+					return true, nil, apierrs.NewNotFound(fakeGR, "resource-removed")
+				})
+		},
+		// Resouce not found error should not block the storage migration.
+		pass: true,
 	},
 	// todo paging fails
 	}
@@ -148,7 +160,7 @@ func TestMigrate_Errors(t *testing.T) {
 			}
 
 			m := NewMigrator(dclient, cclient)
-			if err := m.Migrate(context.Background(), fakeGR); err == nil {
+			if err := m.Migrate(context.Background(), fakeGR); test.pass != (err == nil) {
 				t.Error("Migrate should have returned an error")
 			}
 		})