Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad indentation in registry configuration: registries.yaml with rewrite rules #197

Closed
Jonaprince opened this issue Nov 14, 2022 · 0 comments · Fixed by #198
Closed

Bad indentation in registry configuration: registries.yaml with rewrite rules #197

Jonaprince opened this issue Nov 14, 2022 · 0 comments · Fixed by #198

Comments

@Jonaprince
Copy link
Contributor

Jonaprince commented Nov 14, 2022

Summary

When adding rewrite rule into to add registry pull through cache the registries.yaml file created on k3s node indentation had bad indentation so rewrite rules is not used.

Issue Type

  • Bug Report

Controller Environment and Configuration

# Begin ANSIBLE VERSION
ansible [core 2.12.2]
  config file = /root/garage-installer/install-k3s/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.8/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.12 (default, Apr 21 2022, 07:55:08) [GCC 8.5.0 20210514 (Red Hat 8.5.0-10)]
  jinja version = 2.10.3
  libyaml = True
# End ANSIBLE VERSION

# Begin ANSIBLE CONFIG
DEFAULT_BECOME(/root/garage-installer/install-k3s/ansible.cfg) = True
DEFAULT_BECOME_METHOD(/root/garage-installer/install-k3s/ansible.cfg) = sudo
DEFAULT_ROLES_PATH(/root/garage-installer/install-k3s/ansible.cfg) = ['/root/garage-installer/install-k3s/roles']
HOST_KEY_CHECKING(/root/garage-installer/install-k3s/ansible.cfg) = False
# End ANSIBLE CONFIG

# Begin ANSIBLE ROLES
# /root/garage-installer/install-k3s/roles
- ansible-role-k3s, (unknown version)
# End ANSIBLE ROLES

# Begin PLAY HOSTS
["Node1"]
# End PLAY HOSTS

# Begin K3S ROLE CONFIG
## Node1
k3s_become: true
k3s_etcd_datastore: true
k3s_release_version: "v1.24.7+k3s1"
k3s_server: {"tls-san": ["apiserver.example.com"]}
k3s_registries: {"mirrors": {"docker.io": {"endpoint": ["http://example.com"], "rewrite": {"(.*)": "docker-hub/$1"}}}}
k3s_control_node: "true"
k3s_check_openrc_run: {"changed": false, "skipped": true, "skip_reason": "Conditional result was False"}
k3s_check_cgroup_option: {"changed": false, "stdout": "cpuset\t0\t308\t1", "stderr": "", "rc": 0, "cmd": ["grep", "-E", "^cpuset\\s+.*\\s+1$", "/proc/cgroups"], "start": "2022-11-14 10:07:55.773975", "end": "2022-11-14 10:07:55.776973", "delta": "0:00:00.002998", "msg": "", "stdout_lines": ["cpuset\t0\t308\t1"], "stderr_lines": [], "failed": false, "failed_when_result": false}

Steps to Reproduce

You can reproduce the issue adding this into your inventory:

k3s_registries:
  mirrors:
    docker.io:
      endpoint:
        - "http://registry.example.com"
      rewrite:
        "(.*)": "docker-hub/$1"

Expected Result

/etc/rancher/k3s/registries.yaml should contain:

mirrors:
  docker.io:
    endpoint:
    - http://registry.example.com
    rewrite:
      (.*): docker-hub/$1

Actual Result

Produced file contains 4 indentations instead of 2 in rewrite section.

mirrors:
  docker.io:
    endpoint:
    - http://registry.example.com
    rewrite:
        (.*): docker-hub/$1
@Jonaprince Jonaprince changed the title Bad indentation in registry configuration.yaml with rewrite rules Bad indentation in registry configuration: registries.yaml with rewrite rules Nov 14, 2022
Jonaprince added a commit to Jonaprince/ansible-role-k3s that referenced this issue Nov 14, 2022
Fix the issue of bad indentation in rewrite rules when using registry pull through cache
xanmanning added a commit that referenced this issue Nov 15, 2022
Fixes #197 fix length indentation in registry.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant