Skip to content

Commit

Permalink
feat add custom registries_config_yaml for private-registry (k3s-io#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
2 people authored and steevi committed Jul 2, 2024
1 parent 6e057d5 commit 8b1a98f
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.
# 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: |
# Containerd can be configured to connect to private registries and use them to pull images as needed by the kubelet.
# 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 @@ -210,3 +210,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 8b1a98f

Please sign in to comment.