Skip to content

Commit

Permalink
Merge pull request #151 from MichaelTrip/change-registry-deployment
Browse files Browse the repository at this point in the history
change registry deployment so it works more intuitive and out of the box
  • Loading branch information
MonolithProjects authored Jun 16, 2023
2 parents 9e302fc + 5628134 commit b3af10f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ rke2_custom_manifests:
rke2_static_pods:

# Configure custom Containerd Registry
rke2_custom_registry_mirrors:
- name:
endpoint: {}
rke2_custom_registry_mirrors: []
# - name:
# endpoint: {}
# rewrite: '"^rancher/(.*)": "mirrorproject/rancher-images/$1"'

# Configure custom Containerd Registry additional configuration
# rke2_custom_registry_configs:
rke2_custom_registry_configs: []
# - endpoint:
# config:

Expand Down
2 changes: 1 addition & 1 deletion tasks/first_server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
owner: root
group: root
mode: 0644
when: rke2_custom_registry_mirrors.0.endpoint | length > 0
when: (rke2_custom_registry_mirrors | length > 0 or rke2_custom_registry_configs | length > 0)
register: config_file_is_changed

- name: Register if we need to do a etcd restore from file
Expand Down
2 changes: 1 addition & 1 deletion tasks/remaining_nodes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
owner: root
group: root
mode: 0644
when: rke2_custom_registry_mirrors.0.endpoint | length > 0
when: (rke2_custom_registry_mirrors | length > 0 or rke2_custom_registry_configs | length > 0)
register: config_file_is_changed

- name: Start RKE2 service on the rest of the nodes
Expand Down
4 changes: 3 additions & 1 deletion templates/registries.yaml.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% if rke2_custom_registry_mirrors | length > 0 %}
mirrors:
{% for mirror in rke2_custom_registry_mirrors %}
{{ mirror.name }}:
Expand All @@ -10,7 +11,8 @@ mirrors:
{{ mirror.rewrite }}
{% endif %}
{% endfor %}
{% if rke2_custom_registry_configs is defined %}
{% endif %}
{% if rke2_custom_registry_mirrors | length > 0 %}
configs:
{% for config in rke2_custom_registry_configs %}
{{ config.endpoint }}:
Expand Down

0 comments on commit b3af10f

Please sign in to comment.