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

feat add custom registries_config_yaml for private-registry #319

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions inventory-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
extra_server_args: ""
extra_agent_args: ""

# Optional vars

Check warning on line 22 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 22 in inventory-sample.yml

View workflow job for this annotation

GitHub Actions / Lint

22:3 [comments-indentation] comment not indented like content
# api_port: 6443

Check warning on line 23 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 23 in inventory-sample.yml

View workflow job for this annotation

GitHub Actions / Lint

23:5 [comments-indentation] comment not indented like content
# k3s_server_location: /var/lib/rancher/k3s
# systemd_dir: /etc/systemd/system
# extra_service_envs: [ 'ENV_VAR1=VALUE1', 'ENV_VAR2=VALUE2' ]
Expand All @@ -29,7 +29,11 @@
# extra_manifests: [ '/path/to/manifest1.yaml', '/path/to/manifest2.yaml' ]
# airgap_dir: /tmp/k3s-airgap-images
# user_kubectl: true, by default kubectl is symlinked and configured for use by ansible_user. Set to false to only kubectl via root user.
# server_config_yaml: |

Check warning on line 32 in inventory-sample.yml

View workflow job for this annotation

GitHub Actions / Lint

yaml[line-length]

Line too long (141 > 120 characters)

Check warning on line 32 in inventory-sample.yml

View workflow job for this annotation

GitHub Actions / Lint

32:121 [line-length] line too long (141 > 120 characters)
# This is now an inner yaml file. Maintain the indentation.
# YAML here will be placed as the content of /etc/rancher/k3s/config.yaml

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
# 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.

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
# YAML here will be placed as the content of /etc/rancher/k3s/registries.yaml

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)
# 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
Loading