Skip to content

Commit

Permalink
Merge pull request #18 from prachidamle/fix_pgrep_api
Browse files Browse the repository at this point in the history
grep for kube-apiserver
  • Loading branch information
prachidamle authored Jul 28, 2020
2 parents b856227 + 81d4e6a commit 941b0f4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions package/run_sonobuoy_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ mkdir -p "${RESULTS_DIR}"

# etcd
if [[ "${OVERRIDE_BENCHMARK_VERSION}" != "" ]]; then
if [[ "$(pgrep etcd | wc -l)" -gt 0 ]]; then
if [[ "$(pgrep -f /usr/local/bin/etcd | wc -l)" -gt 0 ]]; then
echo "etcd: Using OVERRIDE_BENCHMARK_VERSION=${OVERRIDE_BENCHMARK_VERSION}"
kube-bench run \
--targets etcd \
Expand All @@ -56,7 +56,7 @@ if [[ "${OVERRIDE_BENCHMARK_VERSION}" != "" ]]; then
--outputfile "${RESULTS_DIR}/etcd.json" 2> "${ERROR_LOG_FILE}"
fi
else
if [[ "$(pgrep etcd | wc -l)" -gt 0 ]]; then
if [[ "$(pgrep -f /usr/local/bin/etcd | wc -l)" -gt 0 ]]; then
echo "etcd: Using RANCHER_K8S_VERSION=${RANCHER_K8S_VERSION}"
kube-bench run \
--targets etcd \
Expand All @@ -74,7 +74,7 @@ fi

# master (no etcd)
if [[ "${OVERRIDE_BENCHMARK_VERSION}" != "" ]]; then
if [[ "$(pgrep apiserver | wc -l)" -gt 0 ]]; then
if [[ "$(pgrep kube-apiserver | wc -l)" -gt 0 ]]; then
echo "master: Using OVERRIDE_BENCHMARK_VERSION=${OVERRIDE_BENCHMARK_VERSION}"
kube-bench run \
--targets master \
Expand All @@ -89,7 +89,7 @@ if [[ "${OVERRIDE_BENCHMARK_VERSION}" != "" ]]; then
--outputfile "${RESULTS_DIR}/master.json" 2> "${ERROR_LOG_FILE}"
fi
else
if [[ "$(pgrep apiserver | wc -l)" -gt 0 ]]; then
if [[ "$(pgrep kube-apiserver | wc -l)" -gt 0 ]]; then
echo "master: Using RANCHER_K8S_VERSION=${RANCHER_K8S_VERSION}"
kube-bench run \
--targets master \
Expand Down Expand Up @@ -144,7 +144,7 @@ fi
# there would be some controls which require running on
# master nodes only
if [[ "${OVERRIDE_BENCHMARK_VERSION}" != "" ]]; then
if [[ "$(pgrep apiserver | wc -l)" -gt 0 ]]; then
if [[ "$(pgrep kube-apiserver | wc -l)" -gt 0 ]]; then
for controlFile in $(find ${CONFIG_DIR}/${OVERRIDE_BENCHMARK_VERSION} -name '*.yaml' ! -name config.yaml ! -name master.yaml ! -name node.yaml ! -name etcd.yaml); do
echo "controlFile: ${controlFile}"
target=$(basename "${controlFile}" .yaml)
Expand Down

0 comments on commit 941b0f4

Please sign in to comment.