Add -e to pre_stop hooks

This adds -e to the pre_stop scripts, so that they fail out if
any of their commands fail.  This is required, since it's the only
way to communicate whether there is an issue during pre_hook
execution.

"The logs for a Hook handler are not exposed in Pod events.
If a handler fails for some reason, it broadcasts an event."
https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks

As an example, this issue was discovered when "touch /tmp/stop"
was failing silently due to a readOnlyRootFilesystem setting,
resulting in pods that would not successfully Terminate until
the grace period was exhausted.

Change-Id: Ic9a228230d944530e31ed61f4239fd434cbb6187
This commit is contained in:
Matt McEuen 2019-11-07 17:28:49 -06:00
parent 46dffa8b12
commit fcaacf94a3
5 changed files with 5 additions and 5 deletions

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -x
set -ex
touch /tmp/stop
sleep {{ .Values.anchor.period }}

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -x
set -ex
touch /tmp/stop
sleep {{ .Values.anchor.period }}

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -x
set -ex
function cleanup_host {
rm -f $MANIFEST_PATH

View File

@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/}}
set -x
set -ex
touch /tmp/stop
sleep {{ .Values.conf.anchor.period }}

View File

@ -15,7 +15,7 @@
# limitations under the License.
*/}}
set -x
set -ex
touch /tmp/stop
sleep {{ .Values.anchor.period }}