Bug 1741596 - `oc adm migrate image-references` fails with HTTP 404
Summary: `oc adm migrate image-references` fails with HTTP 404
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 3.11.0
Hardware: x86_64
OS: Linux
high
high
Target Milestone: ---
: 3.11.z
Assignee: Maciej Szulik
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-15 14:04 UTC by Simon Krenger
Modified: 2023-09-07 20:24 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-10-17 13:25:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 4353381 0 None None None 2019-08-20 13:07:25 UTC

Description Simon Krenger 2019-08-15 14:04:57 UTC
Description of problem:

Executing `oc adm migrate image-references` with confirmation results in no changes:

```
$ oc adm migrate image-references myregistry.com/*=docker.io/* --include=deploymentconfigs --all-namespaces=false --confirm
summary: total=1 errors=0 ignored=0 unchanged=1 migrated=0
```

Using `--loglevel=10` shows that a HTTP 404 is generated:

```
  I0815 08:55:27.267252   38750 round_trippers.go:405] PUT https://openshift.internal.xyz.lab.upshift.rdu2.redhat.com:443/apis/apps.openshift.io/__internal/namespaces/random-project/deploymentconfigs/random-thing 404 Not Found in 1 milliseconds
  I0815 08:55:27.267319   38750 round_trippers.go:411] Response Headers:
  I0815 08:55:27.267363   38750 round_trippers.go:414]     Cache-Control: no-store
  I0815 08:55:27.267407   38750 round_trippers.go:414]     Content-Type: application/json
  I0815 08:55:27.267450   38750 round_trippers.go:414]     Content-Length: 174
  I0815 08:55:27.267492   38750 round_trippers.go:414]     Date: Thu, 15 Aug 2019 12:55:27 GMT
  I0815 08:55:27.267548   38750 request.go:897] Response Body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"the server could not find the requested resource","reason":"NotFound","details":{},"code":404}
  I0815 08:55:27.267785 unchanged: -n random-project deploymentconfigs/random-thing
```

Note that the endpoint `/apis/apps.openshift.io/__internal/` is called, which does not exist.

Version-Release number of selected component (if applicable):

```
$ ./oc version
oc v3.11.135
kubernetes v1.11.0+d4cacc0
features: Basic-Auth GSSAPI Kerberos SPNEGO

Server https://openshift.internal.xyz.lab.upshift.rdu2.redhat.com:443
openshift v3.11.135
kubernetes v1.11.0+d4cacc0
```

How reproducible:

Always


Steps to Reproduce:
1. `oc run nginx --image=docker.io/bitnami/nginx`
2. `oc adm migrate image-references docker.io/*=internal-registry.example.com/* --include=deploymentconfigs --all-namespaces=false ` => Looks good
3. `oc adm migrate image-references docker.io/*=internal-registry.example.com/* --include=deploymentconfigs --all-namespaces=false --confirm`

Actual results:

No changes:

```
$ oc adm migrate image-references docker.io/*=internal-registry.example.com/* --include=deploymentconfigs --all-namespaces=false --confirm
summary: total=1 errors=0 ignored=0 unchanged=1 migrated=0
$ oc get dc nginx -o yaml | grep "image:"
      - image: docker.io/bitnami/nginx
```

Also, `--loglevel=10` shows the HTTP 404 error.

Expected results:

```
$ ./oc adm migrate image-references docker.io/*=internal-registry.example.com/* --include=deploymentconfigs --all-namespaces=false --confirm
summary: total=1 errors=0 ignored=0 unchanged=0 migrated=1
[quicklab@master-0 ~]$ oc get dc nginx -o yaml | grep "image:"
      - image: internal-registry.example.com/bitnami/nginx
```

Additional info:

Bug is fixed in `oc` version 4.1 or higher. Customer can use this as a workaround.

Bug seems to be in this file, because the internal client is still used: https://github.com/openshift/origin/blob/release-3.11/pkg/oc/cli/admin/migrate/images/imagerefs.go#L25


Note You need to log in before you can comment on or make changes to this bug.