From a949680ddfaed9b9e5515f7b1c45eabc5f22b9e8 Mon Sep 17 00:00:00 2001 From: Di Xu Date: Wed, 12 Sep 2018 17:46:38 +0800 Subject: [PATCH] refactor watchdog folder (#1342) --- pai-management/src/watchdog/image.yaml | 20 ------------------- .../watchdog/build/watchdog.dockerfile | 2 +- .../watchdog/deploy}/delete.sh | 3 +-- .../watchdog/deploy}/refresh.sh.template | 0 .../watchdog/deploy}/service.yaml | 6 ++---- .../watchdog => src/watchdog/deploy}/start.sh | 0 .../watchdog => src/watchdog/deploy}/stop.sh | 11 +++------- .../deploy}/watchdog-configmap.yaml.template | 0 .../watchdog/deploy}/watchdog.yaml.template | 0 .../exporter => src/watchdog/src}/watchdog.py | 0 10 files changed, 7 insertions(+), 35 deletions(-) delete mode 100644 pai-management/src/watchdog/image.yaml rename pai-management/src/watchdog/dockerfile => src/watchdog/build/watchdog.dockerfile (96%) rename {pai-management/bootstrap/watchdog => src/watchdog/deploy}/delete.sh (98%) rename {pai-management/bootstrap/watchdog => src/watchdog/deploy}/refresh.sh.template (100%) rename {pai-management/bootstrap/watchdog => src/watchdog/deploy}/service.yaml (95%) rename {pai-management/bootstrap/watchdog => src/watchdog/deploy}/start.sh (100%) rename {pai-management/bootstrap/watchdog => src/watchdog/deploy}/stop.sh (86%) rename {pai-management/bootstrap/watchdog => src/watchdog/deploy}/watchdog-configmap.yaml.template (100%) rename {pai-management/bootstrap/watchdog => src/watchdog/deploy}/watchdog.yaml.template (100%) rename {prometheus/exporter => src/watchdog/src}/watchdog.py (100%) diff --git a/pai-management/src/watchdog/image.yaml b/pai-management/src/watchdog/image.yaml deleted file mode 100644 index c61210bd2..000000000 --- a/pai-management/src/watchdog/image.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) Microsoft Corporation -# All rights reserved. -# -# MIT License -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -# documentation files (the "Software"), to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and -# to permit persons to whom the Software is furnished to do so, subject to the following conditions: -# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING -# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -copy-list: - - src: ../prometheus/exporter - dst: src/watchdog/copied_file diff --git a/pai-management/src/watchdog/dockerfile b/src/watchdog/build/watchdog.dockerfile similarity index 96% rename from pai-management/src/watchdog/dockerfile rename to src/watchdog/build/watchdog.dockerfile index ef400343b..98ac8d83b 100644 --- a/pai-management/src/watchdog/dockerfile +++ b/src/watchdog/build/watchdog.dockerfile @@ -19,4 +19,4 @@ FROM python:2.7 RUN pip install PyYAML requests paramiko prometheus_client -COPY copied_file/exporter/watchdog.py / +COPY src/watchdog.py / diff --git a/pai-management/bootstrap/watchdog/delete.sh b/src/watchdog/deploy/delete.sh similarity index 98% rename from pai-management/bootstrap/watchdog/delete.sh rename to src/watchdog/deploy/delete.sh index 1b952d11c..b11b05b2b 100644 --- a/pai-management/bootstrap/watchdog/delete.sh +++ b/src/watchdog/deploy/delete.sh @@ -22,5 +22,4 @@ pushd $(dirname "$0") > /dev/null echo "Call stop script to stop all service first" /bin/bash stop.sh || exit $? - -popd > /dev/null \ No newline at end of file +popd > /dev/null diff --git a/pai-management/bootstrap/watchdog/refresh.sh.template b/src/watchdog/deploy/refresh.sh.template similarity index 100% rename from pai-management/bootstrap/watchdog/refresh.sh.template rename to src/watchdog/deploy/refresh.sh.template diff --git a/pai-management/bootstrap/watchdog/service.yaml b/src/watchdog/deploy/service.yaml similarity index 95% rename from pai-management/bootstrap/watchdog/service.yaml rename to src/watchdog/deploy/service.yaml index d8bbf63f3..4d3cadd0c 100644 --- a/pai-management/bootstrap/watchdog/service.yaml +++ b/src/watchdog/deploy/service.yaml @@ -17,18 +17,16 @@ prerequisite: - cluster-configuration - - drivers template-list: - watchdog-configmap.yaml - watchdog.yaml + - refresh.sh start-script: start.sh stop-script: stop.sh delete-script: delete.sh refresh-script: refresh.sh -upgraded-script: upgraded.sh - deploy-rules: - in: pai-master \ No newline at end of file + in: pai-master diff --git a/pai-management/bootstrap/watchdog/start.sh b/src/watchdog/deploy/start.sh similarity index 100% rename from pai-management/bootstrap/watchdog/start.sh rename to src/watchdog/deploy/start.sh diff --git a/pai-management/bootstrap/watchdog/stop.sh b/src/watchdog/deploy/stop.sh similarity index 86% rename from pai-management/bootstrap/watchdog/stop.sh rename to src/watchdog/deploy/stop.sh index e82991d1f..cdd92e2cf 100644 --- a/pai-management/bootstrap/watchdog/stop.sh +++ b/src/watchdog/deploy/stop.sh @@ -19,11 +19,6 @@ # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -INSTANCES="daemonset/watchdog -deployment/watchdog -configmap/watchdog -" - -for instance in ${INSTANCES}; do - kubectl delete --ignore-not-found --now ${instance} -done \ No newline at end of file +kubectl delete --ignore-not-found --now daemonset/watchdog +kubectl delete --ignore-not-found --now deployment/watchdog +kubectl delete --ignore-not-found --now configmap/watchdog diff --git a/pai-management/bootstrap/watchdog/watchdog-configmap.yaml.template b/src/watchdog/deploy/watchdog-configmap.yaml.template similarity index 100% rename from pai-management/bootstrap/watchdog/watchdog-configmap.yaml.template rename to src/watchdog/deploy/watchdog-configmap.yaml.template diff --git a/pai-management/bootstrap/watchdog/watchdog.yaml.template b/src/watchdog/deploy/watchdog.yaml.template similarity index 100% rename from pai-management/bootstrap/watchdog/watchdog.yaml.template rename to src/watchdog/deploy/watchdog.yaml.template diff --git a/prometheus/exporter/watchdog.py b/src/watchdog/src/watchdog.py similarity index 100% rename from prometheus/exporter/watchdog.py rename to src/watchdog/src/watchdog.py