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

Commit

Permalink
adapt user transfer script to new config (#2266)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangcan0329 authored Mar 4, 2019
1 parent f1cb5a5 commit d150ced
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/rest-server/config/rest_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, cluster_configuration, service_configuration, default_service
self.cluster_configuration = cluster_configuration
self.service_configuration = dict(default_service_configuraiton,
**service_configuration)

#### Fist check, ensure all the configured data in cluster_configuration, service_configuration, default_service_configuration is right. And nothing is miss.
def validation_pre(self):
machine_list = self.cluster_configuration['machine-list']
Expand All @@ -31,7 +31,7 @@ def validation_pre(self):
return False, '"default-pai-admin-password" is required in rest-server'

return True, None

#### Generate the final service object model
def run(self):
# parse your service object model here, and return a generated dictionary
Expand All @@ -50,10 +50,13 @@ def run(self):
service_object_model['github-owner'] = self.service_configuration['github-owner']
service_object_model['github-repository'] = self.service_configuration['github-repository']
service_object_model['github-path'] = self.service_configuration['github-path']
service_object_model['etcd-uris'] = ','.join('http://{0}:4001'.format(host['hostip'])
for host in machine_list
if host.get('k8s-role') == 'master')

return service_object_model
#### All service and main module (kubrenetes, machine) is generated. And in this check steps, you could refer to the service object model which you will used in your own service, and check its existence and correctness.

#### All service and main module (kubrenetes, machine) is generated. And in this check steps, you could refer to the service object model which you will used in your own service, and check its existence and correctness.
def validation_post(self, cluster_object_model):
if 'yarn-frameworklauncher' not in cluster_object_model or 'webservice' not in cluster_object_model['yarn-frameworklauncher']:
return False, 'yarn-frameworklauncher.webservice is required'
Expand Down
2 changes: 1 addition & 1 deletion src/rest-server/deploy/start.sh.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pushd $(dirname "$0") > /dev/null

# Check whether has etcd-uri in cluster config if so need to transfer user-data
{% if cluster_cfg['rest-server']['etcd-uris'] -%}
python3 legacy_user_migrate.py -e {{ cluster_cfg['rest-server']['etcd-uris'] }} -k {{ cluster_cfg['kubernetes']['api-servers-url'] }} || exit $?
python3 legacy_user_migrate.py -e {{ cluster_cfg['rest-server']['etcd-uris'] }} -k {{ cluster_cfg['layout']['kubernetes']['api-servers-url'] }} || exit $?
{% endif -%}

kubectl apply --overwrite=true -f rest-server.yaml|| exit $?
Expand Down

0 comments on commit d150ced

Please sign in to comment.