* Ignore migration of CRD that is not installed
Signed-off-by: aavarghese <avarghese@us.ibm.com>
* Ignore error from ParseBool
Co-authored-by: Dave Protasowski <dprotaso@gmail.com>
* Review comments to check for error in main
Signed-off-by: aavarghese <avarghese@us.ibm.com>
* REmoving test
Signed-off-by: aavarghese <avarghese@us.ibm.com>
* Update log output format
Co-authored-by: Dave Protasowski <dprotaso@gmail.com>
Co-authored-by: Dave Protasowski <dprotaso@gmail.com>
storage-version-migration-serving crashes if ksvc deleted during
migration.
Please refer to the following error especially
`services.serving.knative.dev \"receiver261\" not found` message.
```
{"severity":"INFO","timestamp":"2022-01-25T14:17:19.840090884Z","caller":"logging/config.go:116","message":"Successfully created the logger."}
{"severity":"INFO","timestamp":"2022-01-25T14:17:19.840350704Z","caller":"logging/config.go:117","message":"Logging level set to: info"}
{"severity":"INFO","timestamp":"2022-01-25T14:17:19.840399959Z","caller":"logging/config.go:79","message":"Fetch GitHub commit ID from kodata failed","error":"\"KO_DATA_PATH\" does not exist or is empty"}
{"severity":"INFO","timestamp":"2022-01-25T14:17:19.854296148Z","logger":"storage-migrator","caller":"migrate/main.go:60","message":"Migrating 4 group resources"}
{"severity":"INFO","timestamp":"2022-01-25T14:17:19.85439718Z","logger":"storage-migrator","caller":"migrate/main.go:63","message":"Migrating group resource services.serving.knative.dev"}
{"severity":"EMERGENCY","timestamp":"2022-01-25T14:17:47.601002153Z","logger":"storage-migrator","caller":"migrate/main.go:65","message":"Failed to migrate: unable to patch resource kc-broker-newsubs-kn-0/receiver261 (gvr: serving.knative.dev/v1, Resource=services) - services.serving.knative.dev \"receiver261\" not found","stacktrace":"main.main\n\t/opt/app-root/src/go/src/knative.dev/serving/vendor/knative.dev/pkg/apiextensions/storageversion/cmd/migrate/main.go:65\nruntime.main\n\t/usr/lib/golang/src/runtime/proc.go:255"}
```
It could be a rare case but it happens when an user delete their
resource during storage-version-migration-serving is running.
This patch fixes the issue by ignoring the NotFound error during
patching resources.
* bump k8s deps to v1.20.7
* fix migrator test pkg
* dynamicclient now expects List types to be declare either via a scheme or manually
* fix error message comparison
* drop excess vendor licenses
* Using the injection fake dynamic client will preserve pre-1.20 behaviour
This is accomplished by preprocessing the scheme/fixtures and declaring
a custom scheme were we map our types & lists to unstructured.* types
* revert webhook factory changes
* ensure objects to the dynamic client are unstructured
* seed the default dynamic client with k8s scheme
* include duckv1 types in default fake dynamic client scheme
* use default k8s scheme
looks like eventing adds to this scheme but we should import the correct one vs the one from the fake package
* drop duckv1 from default scheme
* set APIVersion/Kind if empty
* refactor ToUnstructured helper to a new package
* consolidate k8s flags to an environment package
* add copyright
* fix comment style
* use go1.16 in workflows so downstream tests work
* Deprecate GetRESTConfig and do not remove
* update copyright date
* Remove unused code.
* Use raw strings to avoid escaping.
* Remove unneeded type conversions.
* Preallocate slices where possible.
* Use semantic equality in psbinding reconciler.
* include utility to migrate a CRD's storage version
* fix godoc function name
* godoc updates
* drop use of fmt.Sprintf
* Update apiextensions/storageversion/cmd/migrate/main.go
Co-Authored-By: Victor Agababov <vagababov@gmail.com>
* Update apiextensions/storageversion/migrator_test.go
Co-Authored-By: Victor Agababov <vagababov@gmail.com>
* Update apiextensions/storageversion/migrator_test.go
Co-Authored-By: Victor Agababov <vagababov@gmail.com>
* test formatting
Co-authored-by: Victor Agababov <vagababov@gmail.com>