Skip to content

Commit

Permalink
Support setting CPU masks for DB nodes, and RedOS fixes (#35)
Browse files Browse the repository at this point in the history
* Initial support for setting cpu masks in pre-collections playbooks
* Support CPU affinity specification for static nodes
* Disable improper block trimming in services files
* no kernel-modules-extra on RED OS
* protect config files from malicious access
* fixed options for config copy task
  • Loading branch information
zinal authored Jul 20, 2024
1 parent 37324b7 commit 7375965
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 6 deletions.
1 change: 0 additions & 1 deletion install-dynamic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
roles:
- role: ydbd
- role: ydbd_config
- role: ydbd_config_dynamic
- role: ydbd_dynamic
1 change: 0 additions & 1 deletion install-static.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
roles:
- role: ydbd
- role: ydbd_config
- role: ydbd_config_static
- role: ydbd_static
2 changes: 1 addition & 1 deletion roles/ydbd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
ansible.builtin.package:
name: kernel-modules-extra
state: present
when: ansible_distribution == 'CentOS' or ansible_distribution == 'AlmaLinux' or ansible_distribution == 'RED'
when: ansible_distribution == 'CentOS' or ansible_distribution == 'AlmaLinux'

- name: Copy the kernel module customization for htcp congestion
copy: src=modules-ydbd.conf dest=/etc/modules-load.d/50-ydbd.conf
Expand Down
10 changes: 9 additions & 1 deletion roles/ydbd_config/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,13 @@
copy: src={{ ydb_tls_dir }}/ca.crt dest={{ ydb_dir }}/cfg/ca.crt

- name: Copy cluster configuration file
copy: src={{ ydb_config }} dest={{ ydb_dir }}/cfg/ydbd-config.yaml
copy: src={{ ydb_config }} dest={{ ydb_dir }}/cfg/ydbd-config.yaml group=ydb owner=root mode=440
when: ydb_config is defined

- name: Build dynamic node configuration file
command: "{{ ydb_dir }}/home/update_config_file.sh ydbd-config.yaml ydbd-dynamic.yaml COMPUTE {{ ydb_cores_dynamic }}"
when: ydb_config is defined and ydb_cores_dynamic is defined

- name: Build static node configuration file
command: "{{ ydb_dir }}/home/update_config_file.sh ydbd-config.yaml ydbd-static.yaml STORAGE {{ ydb_cores_static }}"
when: ydb_config is defined and ydb_cores_static is defined
4 changes: 4 additions & 0 deletions roles/ydbd_config/templates/update_config_file.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ CONF_CORES="$4"
set -e
set -u

rm -f ${CONF_DST} || true
cp -v ${CONF_SRC} ${CONF_DST}
COUNT=`grep -E '^[ ]*actor_system_config:[ ]*' ${CONF_DST} | wc -l | (read x && echo $x)`
if [ $COUNT -gt 0 ]; then
Expand All @@ -27,4 +28,7 @@ actor_system_config:
cpu_count: $CONF_CORES
EOF

chown root:ydb ${CONF_DST}
chmod 440 ${CONF_DST}

# End Of File
2 changes: 1 addition & 1 deletion roles/ydbd_config_dynamic/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ydbd dynamic nodes configuration

- name: Copy cluster configuration file
copy: src={{ ydb_config }} dest={{ ydb_dir }}/cfg/ydbd-config.yaml
copy: src={{ ydb_config }} dest={{ ydb_dir }}/cfg/ydbd-config.yaml group=ydb owner=root mode=440
when: ydb_config is defined

- name: Build dynamic node configuration file
Expand Down
3 changes: 2 additions & 1 deletion roles/ydbd_config_static/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# ydbd static nodes configuration

- name: Copy cluster configuration file
copy: src={{ ydb_config }} dest={{ ydb_dir }}/cfg/ydbd-config.yaml
copy: src={{ ydb_config }} dest={{ ydb_dir }}/cfg/ydbd-config.yaml group=ydb owner=root mode=440
when: ydb_config is defined

- name: Build static node configuration file
command: "{{ ydb_dir }}/home/update_config_file.sh ydbd-config.yaml ydbd-static.yaml STORAGE {{ ydb_cores_static }}"
Expand Down

0 comments on commit 7375965

Please sign in to comment.