Kayobe seed host configure deploys registry even when docker_registry_enabled is false

Bug #2051971 reported by Martin Ananda Boeker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kayobe
In Progress
Medium
Maksim Malchuk
Antelope
Confirmed
Medium
Unassigned
Bobcat
Confirmed
Medium
Unassigned
Caracal
In Progress
Medium
Maksim Malchuk
Zed
Confirmed
Medium
Unassigned

Bug Description

Kayobe 14.1

I have set docker_registry_enabled to false, but it still deploys one (just apparently not enabled). Here's the playbook output, ran with "-C -vv"

PLAY [Ensure a local Docker registry is deployed] ******************************************************************

TASK [Gathering Facts] *********************************************************************************************
task path: /home/ubuntu/venvs/kayobe/share/kayobe/ansible/docker-registry.yml:9
Thursday 01 February 2024 17:30:21 +0000 (0:00:00.202) 0:01:31.867 *****
ok: [kayobe]

TASK [docker-registry : include_tasks] *****************************************************************************
task path: /home/ubuntu/venvs/kayobe/share/kayobe/ansible/roles/docker-registry/tasks/main.yml:2
Thursday 01 February 2024 17:30:22 +0000 (0:00:01.382) 0:01:33.249 *****
statically imported: /home/ubuntu/venvs/kayobe/share/kayobe/ansible/roles/docker-registry/tasks/config.yml
redirecting (type: modules) ansible.builtin.docker_container to community.docker.docker_container
included: /home/ubuntu/venvs/kayobe/share/kayobe/ansible/roles/docker-registry/tasks/deploy.yml for kayobe

TASK [docker-registry : Ensure configuration path exists] **********************************************************
task path: /home/ubuntu/venvs/kayobe/share/kayobe/ansible/roles/docker-registry/tasks/config.yml:2
Thursday 01 February 2024 17:30:23 +0000 (0:00:00.253) 0:01:33.503 *****
skipping: [kayobe] => changed=false
  skip_reason: Conditional result was False

TASK [docker-registry : Ensure TLS certificate exists] *************************************************************
task path: /home/ubuntu/venvs/kayobe/share/kayobe/ansible/roles/docker-registry/tasks/config.yml:14
Thursday 01 February 2024 17:30:23 +0000 (0:00:00.053) 0:01:33.557 *****
skipping: [kayobe] => changed=false
  skip_reason: Conditional result was False

TASK [docker-registry : Ensure TLS key exists] *********************************************************************
task path: /home/ubuntu/venvs/kayobe/share/kayobe/ansible/roles/docker-registry/tasks/config.yml:26
Thursday 01 February 2024 17:30:23 +0000 (0:00:00.057) 0:01:33.615 *****
skipping: [kayobe] => changed=false
  skip_reason: Conditional result was False

TASK [docker-registry : Ensure basic auth htpasswd file exists] ****************************************************
task path: /home/ubuntu/venvs/kayobe/share/kayobe/ansible/roles/docker-registry/tasks/config.yml:38
Thursday 01 February 2024 17:30:23 +0000 (0:00:00.051) 0:01:33.666 *****
skipping: [kayobe] => changed=false
  skip_reason: Conditional result was False

TASK [docker-registry : Ensure Docker registry container is running] ***********************************************
task path: /home/ubuntu/venvs/kayobe/share/kayobe/ansible/roles/docker-registry/tasks/deploy.yml:4
Thursday 01 February 2024 17:30:23 +0000 (0:00:00.052) 0:01:33.719 *****
redirecting (type: modules) ansible.builtin.docker_container to community.docker.docker_container
redirecting (type: modules) ansible.builtin.docker_container to community.docker.docker_container
changed: [kayobe] => (item={'key': 'docker_registry', 'value': {'container_name': 'docker_registry', 'env': {'REGISTRY_HTTP_ADDR': '0.0.0.0:4000'}, 'enabled': False, 'image': '1.2.3.4:5000/registry:2.8', 'network_mode': 'host', 'ports': [], 'volumes': ['/etc/localtime:/etc/localtime:ro', 'docker_registry:/var/lib/registry']}}) => changed=true
  actions:
  - stopped: 48c0cb76aac700d67492187ade418e9b58c9a057bd02fd3f8c08f9898ec06e0f
    timeout: null
  - force: false
    link: false
    removed: 48c0cb76aac700d67492187ade418e9b58c9a057bd02fd3f8c08f9898ec06e0f
    volume_state: false
  ansible_loop_var: item
  item:
    key: docker_registry
    value:
      container_name: docker_registry
      enabled: false
      env:
        REGISTRY_HTTP_ADDR: 0.0.0.0:4000
      image: 1.2.3.4:5000/registry:2.8
      network_mode: host
      ports: []
      volumes:
      - /etc/localtime:/etc/localtime:ro
      - docker_registry:/var/lib/registry

Here's the contents of docker-registry/tasks/deploy.yml

(kayobe) ubuntu@kayobevm:~/venvs/kayobe/share/kayobe/ansible/roles/docker-registry$ cat tasks/deploy.yml
---
- import_tasks: config.yml

- name: Ensure Docker registry container is running
  docker_container:
    env: "{{ item.value.env }}"
    image: "{{ item.value.image }}"
    name: "{{ item.value.container_name }}"
    network_mode: "{{ item.value.network_mode }}"
    ports: "{{ item.value.ports | default(omit) }}"
    privileged: "{{ item.value.privileged | default(omit) }}"
    read_only: "{{ item.value.read_only | default(omit) }}"
    restart_policy: "{{ docker_registry_restart_policy }}"
    restart_retries: "{{ docker_registry_restart_retries | default(omit) }}"
    state: "{{ item.value.enabled | ternary('started', 'absent') }}"
    volumes: "{{ item.value.volumes | select | list }}"
  with_dict: "{{ docker_registry_services }}"

I feel like there should be a when: docker_registry_enabled in there, no?

Revision history for this message
Will Szumski (willjs) wrote (last edit ):

Hmm, I guess kayobe thinks it is managing that container and you have an existing container with the same name. Kayobe is is doing: `state: absent`. I think you should be able to remove the seed from the docker-regsitry group to prevent this from happening:

https://github.com/openstack/kayobe/blob/master/etc/kayobe/inventory/groups#L77-L81

Change it to something like ((empty group):

    [docker-registry]

I think the original idea was kayobe would clean up the container if you toggled docker_registry_enabled to false.

Revision history for this message
Martin Ananda Boeker (mboeker) wrote :

Interesting, I'll give that a shot. Thank you!

Revision history for this message
Martin Ananda Boeker (mboeker) wrote :

So this is verified. Disabling the docker registry still installs and somehow runs it with "enabled=false", which I think is not ideal, but making the [docker-registry] group empty stops it from deploying the registry in the first place.

Changed in kayobe:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Maksim Malchuk (mmalchuk)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to kayobe (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/kayobe/+/909205

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.