From b94a555dfcca64ff508c4e9964e2ebe40a334592 Mon Sep 17 00:00:00 2001 From: Zhen Wang Date: Wed, 12 Jun 2019 20:23:13 -0700 Subject: [PATCH 1/2] Add systemd monitor for kubelet, docker, and containerd restart events --- config/systemd-monitor.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 config/systemd-monitor.json diff --git a/config/systemd-monitor.json b/config/systemd-monitor.json new file mode 100644 index 00000000..17376fe9 --- /dev/null +++ b/config/systemd-monitor.json @@ -0,0 +1,28 @@ +{ + "plugin": "journald", + "pluginConfig": { + "source": "systemd" + }, + "logPath": "/var/log/journal", + "lookback": "", + "bufferSize": 10, + "source": "systemd-monitor", + "conditions": [], + "rules": [ + { + "type": "temporary", + "reason": "KubeletStart", + "pattern": "Started Kubernetes kubelet." + }, + { + "type": "temporary", + "reason": "DockerStart", + "pattern": "Starting Docker Application Container Engine..." + }, + { + "type": "temporary", + "reason": "ContainerdStart", + "pattern": "Starting containerd container runtime..." + } + ] +} From ea6a14135168800d87a677ebaaf8dd390c77c7a4 Mon Sep 17 00:00:00 2001 From: Zhen Wang Date: Thu, 13 Jun 2019 10:54:28 -0700 Subject: [PATCH 2/2] Allow using custom flags in build.sh --- test/build.sh | 133 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 98 insertions(+), 35 deletions(-) diff --git a/test/build.sh b/test/build.sh index 2e608598..8cab8509 100755 --- a/test/build.sh +++ b/test/build.sh @@ -26,15 +26,33 @@ NPD_STAGING_PATH=${NPD_STAGING_PATH:-"gs://node-problem-detector-staging"} NPD_STAGING_REGISTRY=${NPD_STAGING_REGISTRY:-"gcr.io/node-problem-detector-staging"} PR_ENV_FILENAME=${PR_ENV_FILENAME:-"pr.env"} CI_ENV_FILENAME=${CI_ENV_FILENAME:-"ci.env"} +CI_CUSTOM_FLAGS_ENV_FILENAME=${CI_CUSTOM_FLAGS_ENV_FILENAME:-"ci-custom-flags.env"} ROOT_PATH=$(git rev-parse --show-toplevel) GCS_URL_PREFIX="https://storage.googleapis.com/" + function print-help() { - echo "Usage: build.sh [args...]" - echo "Available arguments:" - echo " pr [pull_number]: Build node-problem-detector for presubmit jobs and push to staging." - echo " ci: Build node-problem-detector for CI jobs and push to staging." - echo " get-ci-env: Download environment variable file from staging for CI job." + echo "Usage: build.sh [flags] [command]" + echo + echo "Available flags:" + echo " -p [PR_NUMBER] Specify the pull request number when building for a presubmit job." + echo " -f Use custom flags." + echo + echo "Available commands:" + echo " help Print this help message" + echo " pr Build node-problem-detector for presubmit jobs and push to staging. Flag -p is required." + echo " ci Build node-problem-detector for CI jobs and push to staging." + echo " get-ci-env Download environment variable file from staging for CI job." + echo " install-lib Install the libraries needed." + echo + echo "Examples:" + echo " build.sh help" + echo " build.sh -p [PR_NUMBER] pr" + echo " build.sh -p [PR_NUMBER] -f pr" + echo " build.sh ci" + echo " build.sh get-ci-env" + echo " build.sh -f get-ci-env" + echo " build.sh install-lib" } function get-version() { @@ -65,17 +83,43 @@ export NODE_PROBLEM_DETECTOR_TAR_HASH=$(sha1sum ${ROOT_PATH}/node-problem-detect export EXTRA_ENVS=NODE_PROBLEM_DETECTOR_IMAGE=${REGISTRY}/node-problem-detector:${TAG} EOF + if [[ -n "${NODE_PROBLEM_DETECTOR_CUSTOM_FLAGS:-}" ]]; then + cat >> ${ROOT_PATH}/${env_file} <