Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
[Deployment] Choose services for different cluster type (#3528)
Browse files Browse the repository at this point in the history
* Choose services for different cluster type

Choose services for different cluster type in deployment.

* Update cluster type in service.yaml

Update cluster type in service.yaml.

* Change the initial cluster type to None

Change the initial cluster type to None.
  • Loading branch information
abuccts authored Sep 3, 2019
1 parent 18414d9 commit a1332d3
Show file tree
Hide file tree
Showing 28 changed files with 106 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# 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.

import time
import os
import tempfile
Expand Down Expand Up @@ -41,12 +42,14 @@ def get_cluster_object_model_from_k8s(kube_config_path):
return cluster_object_service


def get_service_list():
def get_service_list(cluster_type="yarn"):
service_list = list()
subdir_list = directory_handler.get_subdirectory_list("src/")
for subdir in subdir_list:
service_deploy_dir = "src/{0}/deploy".format(subdir)
service_deploy_conf_path = "src/{0}/deploy/service.yaml".format(subdir)
if file_handler.directory_exits(service_deploy_dir) and file_handler.file_exist_or_not(service_deploy_conf_path):
service_list.append(subdir)
service_conf = file_handler.load_yaml_config(service_deploy_conf_path)
if ("cluster-type" not in service_conf) or ("cluster-type" in service_conf and cluster_type in service_conf["cluster-type"]):
service_list.append(subdir)
return service_list
11 changes: 5 additions & 6 deletions deployment/paiLibrary/paiService/service_management_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ class service_management_delete:
def __init__(self, kube_config_path=None, service_list=None, **kwargs):
self.logger = logging.getLogger(__name__)

self.cluster_object_model = None

self.cluster_object_model = service_management_configuration.get_cluster_object_model_from_k8s(kube_config_path)
self.kube_config_path = kube_config_path
self.cluster_type = None

if service_list is None:
self.service_list = service_management_configuration.get_service_list()
if "cluster-type" in self.cluster_object_model["cluster"]["common"]:
self.cluster_type = self.cluster_object_model["cluster"]["common"]["cluster-type"]
self.service_list = service_management_configuration.get_service_list(self.cluster_type)
else:
self.service_list = service_list
self.logger.info("Get the service-list to manage : {0}".format(str(self.service_list)))
Expand Down Expand Up @@ -75,9 +77,6 @@ def start(self, serv):
self.logger.info("----------------------------------------------------------------------")

def run(self):

self.cluster_object_model = service_management_configuration.get_cluster_object_model_from_k8s(kube_config_path=self.kube_config_path)

for serv in self.service_list:
if serv == "cluster-configuration":
continue
Expand Down
15 changes: 6 additions & 9 deletions deployment/paiLibrary/paiService/service_management_refresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class service_management_refresh:
def __init__(self, kube_config_path=None, service_list=None, **kwargs):
self.logger = logging.getLogger(__name__)

self.cluster_object_model = None

self.kube_config_path = None
if kube_config_path != None:
self.kube_config_path = kube_config_path
self.cluster_object_model = service_management_configuration.get_cluster_object_model_from_k8s(kube_config_path)
self.kube_config_path = kube_config_path
self.cluster_type = None

if service_list is None:
self.service_list = service_management_configuration.get_service_list()
if "cluster-type" in self.cluster_object_model["cluster"]["common"]:
self.cluster_type = self.cluster_object_model["cluster"]["common"]["cluster-type"]
self.service_list = service_management_configuration.get_service_list(self.cluster_type)
else:
self.service_list = service_list
self.logger.info("Get the service-list to manage : {0}".format(str(self.service_list)))
Expand Down Expand Up @@ -156,9 +156,6 @@ def start(self, serv):
self.done_dict[serv] = True

def run(self):

self.cluster_object_model = service_management_configuration.get_cluster_object_model_from_k8s(kube_config_path=self.kube_config_path)

self.done_dict = dict()
self.refresh_all_label()
for serv in self.service_list:
Expand Down
11 changes: 5 additions & 6 deletions deployment/paiLibrary/paiService/service_management_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ class serivce_management_start:
def __init__(self, kube_config_path=None, service_list=None, **kwargs):
self.logger = logging.getLogger(__name__)

self.cluster_object_model = None

self.cluster_object_model = service_management_configuration.get_cluster_object_model_from_k8s(kube_config_path)
self.kube_config_path = kube_config_path
self.cluster_type = None

if service_list is None:
self.service_list = service_management_configuration.get_service_list()
if "cluster-type" in self.cluster_object_model["cluster"]["common"]:
self.cluster_type = self.cluster_object_model["cluster"]["common"]["cluster-type"]
self.service_list = service_management_configuration.get_service_list(self.cluster_type)
else:
self.service_list = service_list
self.logger.info("Get the service-list to manage : {0}".format(str(self.service_list)))
Expand Down Expand Up @@ -111,9 +113,6 @@ def start(self, serv):
self.done_dict[serv] = True

def run(self):

self.cluster_object_model = service_management_configuration.get_cluster_object_model_from_k8s(kube_config_path=self.kube_config_path)

self.done_dict = dict()

for serv in self.service_list:
Expand Down
11 changes: 5 additions & 6 deletions deployment/paiLibrary/paiService/service_management_stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ class service_management_stop:
def __init__(self, kube_config_path=None, service_list=None, **kwargs):
self.logger = logging.getLogger(__name__)

self.cluster_object_model = None

self.cluster_object_model = service_management_configuration.get_cluster_object_model_from_k8s(kube_config_path)
self.kube_config_path = kube_config_path
self.cluster_type = None

if service_list is None:
self.service_list = service_management_configuration.get_service_list()
if "cluster-type" in self.cluster_object_model["cluster"]["common"]:
self.cluster_type = self.cluster_object_model["cluster"]["common"]["cluster-type"]
self.service_list = service_management_configuration.get_service_list(self.cluster_type)
else:
self.service_list = service_list
self.logger.info("Get the service-list to manage : {0}".format(str(self.service_list)))
Expand Down Expand Up @@ -75,9 +77,6 @@ def start(self, serv):
self.logger.info("----------------------------------------------------------------------")

def run(self):

self.cluster_object_model = service_management_configuration.get_cluster_object_model_from_k8s(kube_config_path=self.kube_config_path)

for serv in self.service_list:
if serv == "cluster-configuration":
continue
Expand Down
4 changes: 4 additions & 0 deletions src/alert-manager/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# 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.

cluster-type:
- yarn
- k8s

prerequisite:
- cluster-configuration
- drivers
Expand Down
3 changes: 3 additions & 0 deletions src/cleaner/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# 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.

cluster-type:
- yarn

# to avoid possible race condition, start cleaner after all services are ready
prerequisite:
- cluster-configuration
Expand Down
4 changes: 4 additions & 0 deletions src/cluster-configuration/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# 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.

cluster-type:
- yarn
- k8s

template-list:
- secret.yaml
- host-configuration/host-configuration.yaml
Expand Down
4 changes: 4 additions & 0 deletions src/drivers/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# 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.

cluster-type:
- yarn
- k8s

prerequisite:
- cluster-configuration

Expand Down
3 changes: 3 additions & 0 deletions src/end-to-end-test/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# 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.

cluster-type:
- yarn

prerequisite:
- cluster-configuration
- yarn-frameworklauncher
Expand Down
4 changes: 4 additions & 0 deletions src/grafana/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# 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.

cluster-type:
- yarn
- k8s

prerequisite:
- cluster-configuration
- prometheus
Expand Down
3 changes: 3 additions & 0 deletions src/hadoop-batch-job/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# 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.

cluster-type:
- yarn

prerequisite:
- cluster-configuration
- drivers
Expand Down
3 changes: 3 additions & 0 deletions src/hadoop-data-node/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# 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.

cluster-type:
- yarn

prerequisite:
- cluster-configuration
- drivers
Expand Down
3 changes: 3 additions & 0 deletions src/hadoop-jobhistory/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# 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.

cluster-type:
- yarn

prerequisite:
- cluster-configuration
- drivers
Expand Down
3 changes: 3 additions & 0 deletions src/hadoop-name-node/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# 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.

cluster-type:
- yarn

prerequisite:
- cluster-configuration
- drivers
Expand Down
3 changes: 3 additions & 0 deletions src/hadoop-node-manager/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# 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.

cluster-type:
- yarn

prerequisite:
- cluster-configuration
- drivers
Expand Down
3 changes: 3 additions & 0 deletions src/hadoop-resource-manager/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# 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.

cluster-type:
- yarn

prerequisite:
- cluster-configuration
- drivers
Expand Down
4 changes: 4 additions & 0 deletions src/job-exporter/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# 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.

cluster-type:
- yarn
- k8s

prerequisite:
- cluster-configuration
- drivers
Expand Down
4 changes: 4 additions & 0 deletions src/k8s-dashboard/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# 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.

cluster-type:
- yarn
- k8s

template-list:
- k8s-dashboard.yaml
- start.sh
Expand Down
3 changes: 3 additions & 0 deletions src/log-manager/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# 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.

cluster-type:
- k8s

prerequisite:
- cluster-configuration

Expand Down
4 changes: 4 additions & 0 deletions src/node-exporter/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# 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.

cluster-type:
- yarn
- k8s

prerequisite:
- cluster-configuration

Expand Down
4 changes: 4 additions & 0 deletions src/prometheus/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# 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.

cluster-type:
- yarn
- k8s

prerequisite:
- cluster-configuration

Expand Down
4 changes: 4 additions & 0 deletions src/pylon/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# 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.

cluster-type:
- yarn
- k8s

prerequisite:
- cluster-configuration

Expand Down
4 changes: 4 additions & 0 deletions src/rest-server/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# 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.

cluster-type:
- yarn
- k8s

prerequisite:
- cluster-configuration
- yarn-frameworklauncher
Expand Down
4 changes: 4 additions & 0 deletions src/watchdog/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# 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.

cluster-type:
- yarn
- k8s

prerequisite:
- cluster-configuration

Expand Down
4 changes: 4 additions & 0 deletions src/webportal/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# 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.

cluster-type:
- yarn
- k8s

prerequisite:
- cluster-configuration
- rest-server
Expand Down
2 changes: 2 additions & 0 deletions src/yarn-frameworklauncher/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# 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.

cluster-type:
- yarn

prerequisite:
- cluster-configuration
Expand Down
3 changes: 3 additions & 0 deletions src/zookeeper/deploy/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# 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.

cluster-type:
- yarn

prerequisite:
- cluster-configuration

Expand Down

0 comments on commit a1332d3

Please sign in to comment.