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

Customize and modify the dir of runtime #28

Merged
merged 4 commits into from
Jun 5, 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
6 changes: 6 additions & 0 deletions ansible/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ kubernetes_version: "v{{ kube_release }}"
docker_release: ""
# runtime containerd version
containerd_release: ""
# runtime data-root-dir
runtime_data_dir: ""
# docker data-root-dir
docker_data_dir: "{{ runtime_data_dir }}"
# containerd data-root-dir
containerd_data_dir: "{{ runtime_data_dir }}"

docker_package_rocky: "docker-ce{{'' if docker_release == '' else '-' ~ docker_release }}"
containerd_package_rocky: "containerd.io{{'' if containerd_release == '' else '-' ~ containerd_release }}"
Expand Down
4 changes: 4 additions & 0 deletions ansible/roles/baremetal/templates/config.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ imports = []
oom_score = 0
plugin_dir = ""
required_plugins = []
{% if containerd_data_dir %}
root = "{{ containerd_data_dir }}"
{% else %}
root = "/var/lib/containerd"
{% endif %}
state = "/run/containerd"
temp = ""
version = 2
Expand Down
3 changes: 3 additions & 0 deletions ansible/roles/baremetal/templates/kube-daemon.json.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"insecure-registries": ["{{ image_repository_daemon }}"],
"exec-opts": ["native.cgroupdriver=systemd"],
{% if docker_data_dir %}
"data-root": "{{ docker_data_dir }}",
{% endif %}
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
Expand Down
5 changes: 5 additions & 0 deletions etc/kubez/globals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ docker_release: ""
# runtime containerd version
containerd_release: ""

# 自定义 docker 数据存放目录
docker_data_dir: "{{ runtime_data_dir }}"
# 自定义 containerd 数据存放目录
containerd_data_dir: "{{ runtime_data_dir }}"

#####################
# keepalived options
#####################
Expand Down
Loading