Browse Source

Make specific module internal filenames for limits

Avoid filename collision between limits and sysctl module.

Bugfix for sysctl to print reverted setting before it's deleted.

Change-Id: I31269c413f884a25ecf3588b52677ca427b4c082
skovaleff 5 months ago
parent
commit
eebedea5f2

+ 5
- 5
divingbell/templates/bin/_limits.sh.tpl View File

@@ -57,7 +57,7 @@ add_limits_param(){
57 57
     log.INFO "No changes made to limits param: ${limit}"
58 58
   fi
59 59
 
60
-  curr_settings="${curr_settings}${file_name}"$'\n'
60
+  curr_limits="${curr_limits}${file_name}"$'\n'
61 61
 }
62 62
 
63 63
 {{- range $index, $limit := .Values.conf.limits }}
@@ -68,9 +68,9 @@ add_limits_param {{ $index | squote }} {{ $limit.domain | squote }} {{ $limit.ty
68 68
 # Revert any previously applied limits settings which are now absent
69 69
 prev_files="$(find "${persist_path}" -type f)"
70 70
 if [ -n "${prev_files}" ]; then
71
-  basename -a ${prev_files} | sort > /tmp/prev_settings
72
-  echo "${curr_settings}" | sort > /tmp/curr_settings
73
-  revert_list="$(comm -23 /tmp/prev_settings /tmp/curr_settings)"
71
+  basename -a ${prev_files} | sort > /tmp/prev_limits
72
+  echo "${curr_limits}" | sort > /tmp/curr_limits
73
+  revert_list="$(comm -23 /tmp/prev_limits /tmp/curr_limits)"
74 74
   IFS=$'\n'
75 75
   for orig_limits_setting in ${revert_list}; do
76 76
     rm "${persist_path}/${orig_limits_setting}"
@@ -87,7 +87,7 @@ su -c "prlimit --noheadings --output RESOURCE,SOFT,HARD"
87 87
 # For this test it's just test bash process.
88 88
 # For production case it's limits_host.sh run by DivingBell pod which is in sleep mode.
89 89
 
90
-if [ -n "${curr_settings}" ]; then
90
+if [ -n "${curr_limits}" ]; then
91 91
   log.INFO 'All limits configuration successfully validated on this node.'
92 92
 else
93 93
   log.WARN 'No limits overrides defined for this node.'

+ 2
- 2
divingbell/templates/bin/_sysctl.sh.tpl View File

@@ -103,10 +103,10 @@ if [ -n "${prev_files}" ]; then
103 103
   for orig_sysctl_setting in ${revert_list}; do
104 104
     rm "${persist_path}/${orig_sysctl_setting}"
105 105
     sysctl -p "${defaults_path}/${orig_sysctl_setting}"
106
-    rm "${defaults_path}/${orig_sysctl_setting}"
107
-    reload_system_configs=true
108 106
     log.INFO "Reverted sysctl setting:" \
109 107
              "$(cat "${defaults_path}/${orig_sysctl_setting}")"
108
+    rm "${defaults_path}/${orig_sysctl_setting}"
109
+    reload_system_configs=true
110 110
   done
111 111
 fi
112 112
 

Loading…
Cancel
Save