現象
既存のyamlをOpenShift4.7で利用したところ、
Using non-groupfied API resources is deprecated and will be removed in a future release, update apiVersion to "xxx/v1" for your resource
というWarning。リソースは問題なく作成されますが。
以下はImageStreamの例ですが、BuildConfig、DeploymentConfigも同様に。
$ oc create -f lab02-is.yaml
W0524 02:13:07.418890 744 shim_kubectl.go:55] Using non-groupfied API resources is deprecated and will be removed in a future release, update apiVersion to "image.openshift.io/v1" for your resource
imagestream.image.openshift.io/ocsample-lab02-is created
$
OCP 4.7 Deprecated features
リリースノートにありました
https://docs.openshift.com/container-platform/4.7/release_notes/ocp-4-7-release-notes.html#ocp-4-7-apiversion-v1
Currently,
ocfixesapiVersionin YAML or JSON resource files OpenShift Container Platform resources fromv1to the correct value for the object. For example,v1is corrected toapps.openshift.io/v1forDeploymentConfigobjects. This behavior is deprecated and is planned for removal in a future release, and every resource that includes*.openshift.iomust match theapiVersionvalue found in the API index.
修正
各yamlで以下のように修正することで、Warningなくなりました
| 修正前 | 修正後 | |
|---|---|---|
| ImageStream | apiVersion: v1 | apiVersion: image.openshift.io/v1 |
| BuildConfig | apiVersion: v1 | apiVersion: build.openshift.io/v1 |
| DeploymentConfig | apiVersion: v1 | apiVersion: apps.openshift.io/v1 |
現状ocコマンドがapiVersion: v1をapiVersion: image.openshift.io/v1などに適宜変換してくれますが、将来的に変換機能はなくなりますよ、ということで、前述 API index にある「API group」の値を指定してやりましょう、ということでした。