Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1726171

Summary: [RFE] Validate container image registry credentials before starting deployment
Product: Red Hat OpenStack Reporter: Artem Hrechanychenko <ahrechan>
Component: python-tripleoclientAssignee: RHOS Maint <rhos-maint>
Status: CLOSED WONTFIX QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 15.0 (Stein)CC: aschultz, augol, dbecker, emacchi, hbrock, johfulto, jslagle, mburns, morazi, pkomarov
Target Milestone: ---Keywords: FutureFeature, Reopened, Triaged, ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-21 12:41:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
/var/log/tripleo-container-image-prepare.log none

Description Artem Hrechanychenko 2019-07-02 09:24:37 UTC
Description of problem:
OSP15 1ctrl+1comp+3ceph

(undercloud) [stack@undercloud-0 config-download]$ cat ~/overcloud_deploy.sh 
#!/bin/bash

openstack overcloud deploy \
--timeout 100 \
--templates /usr/share/openstack-tripleo-heat-templates \
--stack overcloud \
--libvirt-type kvm \
--ntp-server clock.redhat.com \
-e /home/stack/virt/internal.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \
-e /home/stack/virt/network/network-environment.yaml \
-e /home/stack/virt/network/dvr-override.yaml \
-e /home/stack/virt/enable-tls.yaml \
-e /home/stack/virt/inject-trust-anchor.yaml \
-e /home/stack/virt/public_vip.yaml \
-e /usr/share/openstack-tripleo-heat-templates/environments/ssl/tls-endpoints-public-ip.yaml \
-e /home/stack/virt/hostnames.yml \
-e /usr/share/openstack-tripleo-heat-templates/environments/ceph-ansible/ceph-ansible.yaml \
-e /home/stack/virt/nodes_data.yaml \
-e ~/containers-prepare-parameter.yaml \
-e /home/stack/virt/extra_templates.yaml \
-e /home/stack/wa.yaml \
--stack-only \
--log-file overcloud_deployment_95.log

openstack overcloud config download   --name overcloud   --config-dir ~/config-download && cd config download && tripleo-ansible-inventory       --ansible_ssh_user heat-admin       --static-yaml-inventory inventory.yaml

ansible-playbook   -i inventory.yaml   --private-key ~/.ssh/id_rsa   --become   ~/config-download/deploy_steps_playbook.yaml

PLAY [Overcloud deploy step tasks for 1] *****************************************************************************************************************************************************************************************************

TASK [Write the config_step hieradata for the deploy step 1 tasks] ***************************************************************************************************************************************************************************
ok: [ceph-0]
ok: [ceph-1]
ok: [ceph-2]
ok: [controller-0]
ok: [compute-0]

TASK [tripleo-container-tag : Pull 192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1 image] ***************************************************************************************************************************************
skipping: [ceph-0]
skipping: [ceph-1]
skipping: [ceph-2]
skipping: [compute-0]
fatal: [controller-0]: FAILED! => {"changed": true, "cmd": "podman pull 192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1", "delta": "0:00:00.133417", "end": "2019-07-02 09:17:00.467821", "msg": "non-zero return code", "rc": 125, "start": "2019-07-02 09:17:00.334404", "stderr": "Trying to pull 192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1...Failed\nerror pulling image \"192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1\": unable to pull 192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1: unable to pull image: Error determining manifest MIME type for docker://192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1: Error reading manifest 20190625.1 in 192.168.24.1:8787/rhosp15/openstack-cinder-volume: error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: \"<!DOCTYPE HTML PUBLIC \\\"-//IETF//DTD HTML 2.0//EN\\\">\\n<html><head>\\n<title>404 Not Found</title>\\n</head><body>\\n<h1>Not Found</h1>\\n<p>The requested URL /v2/rhosp15/openstack-cinder-volume/manifests/20190625.1 was not found on this server.</p>\\n</body></html>\\n\"", "stderr_lines": ["Trying to pull 192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1...Failed", "error pulling image \"192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1\": unable to pull 192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1: unable to pull image: Error determining manifest MIME type for docker://192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1: Error reading manifest 20190625.1 in 192.168.24.1:8787/rhosp15/openstack-cinder-volume: error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: \"<!DOCTYPE HTML PUBLIC \\\"-//IETF//DTD HTML 2.0//EN\\\">\\n<html><head>\\n<title>404 Not Found</title>\\n</head><body>\\n<h1>Not Found</h1>\\n<p>The requested URL /v2/rhosp15/openstack-cinder-volume/manifests/20190625.1 was not found on this server.</p>\\n</body></html>\\n\""], "stdout": "", "stdout_lines": []}


Version-Release number of selected component (if applicable):
RHOS_TRUNK-15.0-RHEL-8-20190627.n.0
openstack-tripleo-heat-templates-10.5.1-0.20190627050406.22ee26f.el8ost.noarch

How reproducible:
always

Steps to Reproduce:
1.Try to install OC manually using config-download - add --stack-only to overcloud deploy command

2.openstack overcloud config download   --name overcloud   --config-dir ~/config-download && cd config download && tripleo-ansible-inventory       --ansible_ssh_user heat-admin       --static-yaml-inventory inventory.yaml
3.ansible-playbook   -i inventory.yaml   --private-key ~/.ssh/id_rsa   --become   ~/config-download/deploy_steps_playbook.yaml

Actual results:
fatal: [controller-0]: FAILED! => {"changed": true, "cmd": "podman pull 192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1", "delta": "0:00:00.133417", "end": "2019-07-02 09:17:00.467821", "msg": "non-zero return code", "rc": 125, "start": "2019-07-02 09:17:00.334404", "stderr": "Trying to pull 192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1...Failed\nerror pulling image \"192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1\": unable to pull 192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1: unable to pull image: Error determining manifest MIME type for docker://192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1: Error reading manifest 20190625.1 in 192.168.24.1:8787/rhosp15/openstack-cinder-volume: error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: \"<!DOCTYPE HTML PUBLIC \\\"-//IETF//DTD HTML 2.0//EN\\\">\\n<html><head>\\n<title>404 Not Found</title>\\n</head><body>\\n<h1>Not Found</h1>\\n<p>The requested URL /v2/rhosp15/openstack-cinder-volume/manifests/20190625.1 was not found on this server.</p>\\n</body></html>\\n\"", "stderr_lines": ["Trying to pull 192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1...Failed", "error pulling image \"192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1\": unable to pull 192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1: unable to pull image: Error determining manifest MIME type for docker://192.168.24.1:8787/rhosp15/openstack-cinder-volume:20190625.1: Error reading manifest 20190625.1 in 192.168.24.1:8787/rhosp15/openstack-cinder-volume: error parsing HTTP 404 response body: invalid character '<' looking for beginning of value: \"<!DOCTYPE HTML PUBLIC \\\"-//IETF//DTD HTML 2.0//EN\\\">\\n<html><head>\\n<title>404 Not Found</title>\\n</head><body>\\n<h1>Not Found</h1>\\n<p>The requested URL /v2/rhosp15/openstack-cinder-volume/manifests/20190625.1 was not found on this server.</p>\\n</body></html>\\n\""], "stdout": "", "stdout_lines": []}


Expected results:
OC installed

Additional info:

Comment 1 Artem Hrechanychenko 2019-07-02 09:26:49 UTC
cat containers-prepare-parameter.yaml 
# Generated with the following on 2019-07-01T11:09:16.313279
#
#   openstack tripleo container image prepare default --output-env-file /home/stack/containers-prepare-parameter.yaml --local-push-destination
#

parameter_defaults:
  ContainerImagePrepare:
  - push_destination: true
    set:
      ceph_image: rhceph-4-rhel8
      ceph_namespace: registry.redhat.io/rhceph-beta
      ceph_tag: latest
      name_prefix: openstack-
      name_suffix: ''
      namespace: brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888/rhosp15
      neutron_driver: ovn
      tag: 20190625.1
/var/log/tripleo-container-image-prepare.log in attachment

Comment 2 Artem Hrechanychenko 2019-07-02 09:27:34 UTC
Created attachment 1586605 [details]
/var/log/tripleo-container-image-prepare.log

/var/log/tripleo-container-image-prepare.log

Comment 3 Artem Hrechanychenko 2019-07-02 10:00:28 UTC
ansible-playbook   -i inventory.yaml   --private-key ~/.ssh/id_rsa   --become   ~/config-download/deploy_steps_playbook.yaml --skip-tags container_image_prepare didn't help

Comment 4 John Fulton 2019-07-02 12:01:23 UTC
Artem,

This isn't really a bug. You just need to pass the correct parameters. I'll explain.

The error you got is here:

imagename: registry.redhat.io/rhceph-beta/rhceph-4-rhel8:latest
Image prepare failed: 401 Client Error: Unauthorized for url: https://registry.redhat.io/auth/realms/rhcc/protocol/redhat-docker-v2/auth?service=docker-registry&scope=repository%3Arhceph-beta%2Frhceph-4-rhel8%3Apull

This is because you need a Red Hat account to access our container images. To use your Red Hat account to access the Red Hat images please see this docbug

 https://bugzilla.redhat.com/show_bug.cgi?id=1723969

*** This bug has been marked as a duplicate of bug 1723969 ***

Comment 6 Marius Cornea 2019-07-03 09:05:47 UTC
(In reply to John Fulton from comment #4)
> Artem,
> 
> This isn't really a bug. You just need to pass the correct parameters. I'll
> explain.
> 
> The error you got is here:
> 
> imagename: registry.redhat.io/rhceph-beta/rhceph-4-rhel8:latest
> Image prepare failed: 401 Client Error: Unauthorized for url:
> https://registry.redhat.io/auth/realms/rhcc/protocol/redhat-docker-v2/
> auth?service=docker-registry&scope=repository%3Arhceph-beta%2Frhceph-4-
> rhel8%3Apull
> 
> This is because you need a Red Hat account to access our container images.
> To use your Red Hat account to access the Red Hat images please see this
> docbug
> 
>  https://bugzilla.redhat.com/show_bug.cgi?id=1723969
> 

Can we provide a pre-deployment validation that ensures ceph credentials were provided and do not start the deployment when credentials are not present? If the ceph registry now requires authentication then imho we shouldn't start deployment if credentials were not provided.

Comment 7 John Fulton 2019-07-03 14:49:21 UTC
(In reply to Marius Cornea from comment #6)
> (In reply to John Fulton from comment #4)
> > Artem,
> > 
> > This isn't really a bug. You just need to pass the correct parameters. I'll
> > explain.
> > 
> > The error you got is here:
> > 
> > imagename: registry.redhat.io/rhceph-beta/rhceph-4-rhel8:latest
> > Image prepare failed: 401 Client Error: Unauthorized for url:
> > https://registry.redhat.io/auth/realms/rhcc/protocol/redhat-docker-v2/
> > auth?service=docker-registry&scope=repository%3Arhceph-beta%2Frhceph-4-
> > rhel8%3Apull
> > 
> > This is because you need a Red Hat account to access our container images.
> > To use your Red Hat account to access the Red Hat images please see this
> > docbug
> > 
> >  https://bugzilla.redhat.com/show_bug.cgi?id=1723969
> > 
> 
> Can we provide a pre-deployment validation that ensures ceph credentials
> were provided and do not start the deployment 

I expect most customers will store the container registry on their undercloud by running a command like the following before they run 'openstack overcloud deploy':

 sudo openstack tripleo container image prepare -e containers.yaml --output-env-file containers-env-file.yaml

The above downloads the containers from the external Red Hat registry (using credentials in containers.yaml) and sets them up to be served from the undercloud. Then the overcloud nodes get the containers from the undercloud, provided that the overcloud is deployed with '-e containers-env-file.yaml'.

When the customer follows this pattern without providing their credentials they'll fail the authentication before the overcloud deploy and get the feedback early. This the pattern that's recommended recommended in our docs. See section 2.1:

 https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/14/html/transitioning_to_containerized_services/obtaining-container-images

The OSP15 version of the above will be updated with how to use ContainerImageRegistryCredentials as per docbug 1723969.

> when credentials are not
> present? If the ceph registry now requires authentication then imho we
> shouldn't start deployment if credentials were not provided.

They're not exactly ceph credentials, they're Red Hat registry credentials and I expect in OSP16 that the OpenStack containers will also be hosted on registry.redhat.io which will continue to require authentication.

This issue isn't related to Ceph integration. It's related to director's overall process for obtaining container images and the docs will be updated to cover accessing our containers from our new registry. If you still think we need additional validations then perhaps this should be moved to an RFE so PM can assess it and it can be scheduled for a future feature.

Comment 8 Marius Cornea 2019-07-04 08:27:29 UTC
(In reply to John Fulton from comment #7)
> (In reply to Marius Cornea from comment #6)
> > (In reply to John Fulton from comment #4)
> > > Artem,
> > > 
> > > This isn't really a bug. You just need to pass the correct parameters. I'll
> > > explain.
> > > 
> > > The error you got is here:
> > > 
> > > imagename: registry.redhat.io/rhceph-beta/rhceph-4-rhel8:latest
> > > Image prepare failed: 401 Client Error: Unauthorized for url:
> > > https://registry.redhat.io/auth/realms/rhcc/protocol/redhat-docker-v2/
> > > auth?service=docker-registry&scope=repository%3Arhceph-beta%2Frhceph-4-
> > > rhel8%3Apull
> > > 
> > > This is because you need a Red Hat account to access our container images.
> > > To use your Red Hat account to access the Red Hat images please see this
> > > docbug
> > > 
> > >  https://bugzilla.redhat.com/show_bug.cgi?id=1723969
> > > 
> > 
> > Can we provide a pre-deployment validation that ensures ceph credentials
> > were provided and do not start the deployment 
> 
> I expect most customers will store the container registry on their
> undercloud by running a command like the following before they run
> 'openstack overcloud deploy':
> 
>  sudo openstack tripleo container image prepare -e containers.yaml
> --output-env-file containers-env-file.yaml

This is only recommended when modifying container images:
https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/14/html/transitioning_to_containerized_services/obtaining-container-images#modifying-images-during-preparation

> The above downloads the containers from the external Red Hat registry (using
> credentials in containers.yaml) and sets them up to be served from the
> undercloud. Then the overcloud nodes get the containers from the undercloud,
> provided that the overcloud is deployed with '-e containers-env-file.yaml'.
> 
> When the customer follows this pattern without providing their credentials
> they'll fail the authentication before the overcloud deploy and get the
> feedback early. This the pattern that's recommended recommended in our docs.
> See section 2.1:
> 
>  https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/14/
> html/transitioning_to_containerized_services/obtaining-container-images

Not really, the docs recommend using:

openstack tripleo container image prepare default \
  --local-push-destination \
  --output-env-file containers-prepare-parameter.yaml

which is the same that we're using in testing and seeing the authentication error late in the deployment process.


> The OSP15 version of the above will be updated with how to use
> ContainerImageRegistryCredentials as per docbug 1723969.
> 
> > when credentials are not
> > present? If the ceph registry now requires authentication then imho we
> > shouldn't start deployment if credentials were not provided.
> 
> They're not exactly ceph credentials, they're Red Hat registry credentials
> and I expect in OSP16 that the OpenStack containers will also be hosted on
> registry.redhat.io which will continue to require authentication.
> 
> This issue isn't related to Ceph integration. It's related to director's
> overall process for obtaining container images and the docs will be updated
> to cover accessing our containers from our new registry. If you still think
> we need additional validations then perhaps this should be moved to an RFE
> so PM can assess it and it can be scheduled for a future feature.

Agreed, I'll change the title for a better description.

Comment 10 John Fulton 2019-07-05 12:43:55 UTC
*** Bug 1726567 has been marked as a duplicate of this bug. ***