Skip to content

Commit

Permalink
feat add custom registries_config_yaml for private-registry (#319)
Browse files Browse the repository at this point in the history
* feat add custom registries_config_yaml for private-registry

Signed-off-by: dreamingdeer <[email protected]>
Co-authored-by: dreamingdeer <[email protected]>
  • Loading branch information
dreamingdeer and dreamingdeer authored Apr 2, 2024
1 parent 485ee0f commit 33c15e7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions inventory-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ k3s_cluster:
# This is now an inner yaml file. Maintain the indentation.

Check warning on line 34 in inventory-sample.yml

View workflow job for this annotation

GitHub Actions / Lint

yaml[comments-indentation]

Comment not indented like content

Check warning on line 34 in inventory-sample.yml

View workflow job for this annotation

GitHub Actions / Lint

34:7 [comments-indentation] comment not indented like content
# YAML here will be placed as the content of /etc/rancher/k3s/config.yaml
# See https://docs.k3s.io/installation/configuration#configuration-file
# registries_config_yaml: |

Check warning on line 37 in inventory-sample.yml

View workflow job for this annotation

GitHub Actions / Lint

yaml[comments-indentation]

Comment not indented like content

Check warning on line 37 in inventory-sample.yml

View workflow job for this annotation

GitHub Actions / Lint

37:5 [comments-indentation] comment not indented like content
# Containerd can be configured to connect to private registries and use them to pull images as needed by the kubelet.

Check warning on line 38 in inventory-sample.yml

View workflow job for this annotation

GitHub Actions / Lint

yaml[comments-indentation]

Comment not indented like content

Check warning on line 38 in inventory-sample.yml

View workflow job for this annotation

GitHub Actions / Lint

yaml[line-length]

Line too long (123 > 120 characters)

Check warning on line 38 in inventory-sample.yml

View workflow job for this annotation

GitHub Actions / Lint

38:7 [comments-indentation] comment not indented like content

Check warning on line 38 in inventory-sample.yml

View workflow job for this annotation

GitHub Actions / Lint

38:121 [line-length] line too long (123 > 120 characters)
# YAML here will be placed as the content of /etc/rancher/k3s/registries.yaml
# See https://docs.k3s.io/installation/private-registry
14 changes: 14 additions & 0 deletions roles/prereq/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,17 @@
dest: "/var/lib/rancher/k3s/server/manifests"
mode: 0600
loop: "{{ extra_manifests }}"

- name: Setup optional private registry configuration
when: registries_config_yaml is defined
block:
- name: Make k3s config directory
ansible.builtin.file:
path: "/etc/rancher/k3s"
mode: 0755
state: directory
- name: Copy config values
ansible.builtin.copy:
content: "{{ registries_config_yaml }}"
dest: "/etc/rancher/k3s/registries.yaml"
mode: 0644

0 comments on commit 33c15e7

Please sign in to comment.