This repository was archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 550
New RestServer Architecture: RestServer -> DB -> ApiServer; P0 Items #4761
Merged
Merged
Changes from 18 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
4d24735
Compact PR (#4758)
hzy46 3039d89
fix
hzy46 eec3e80
fix
hzy46 429dc4e
trigger
hzy46 dbe94ac
fix
hzy46 c2adce5
fix
hzy46 642c868
fix
hzy46 e46f0ac
fix
hzy46 c6900f6
fix
hzy46 e4e7e72
fix
hzy46 b2ec6f5
Merge branch 'master' of github.com:microsoft/pai into zhiyuhe/db_int…
hzy46 4a64f65
fix rbac
hzy46 3850a10
fix
hzy46 a3e2cab
change rest-server & initializer
hzy46 d2ed448
fix
hzy46 197ca82
fix
hzy46 d235d4e
fix
hzy46 1cb37d0
fix
hzy46 54d219f
change license comment
hzy46 345d3af
fix lint
hzy46 e608c5e
fix
hzy46 979fe5d
fix
hzy46 94d8ae9
fix
hzy46 fd13d0e
resolve conflicts
hzy46 2dce698
fluentd fix
hzy46 e459a88
fix
hzy46 a20d16f
fix
hzy46 77352f4
fix
hzy46 7355131
fix
hzy46 da47640
fix
hzy46 bcd1b3c
fix
hzy46 ae73bfe
fix
hzy46 e203fd4
fix
hzy46 7c4878d
fix
hzy46 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| root = true | ||
|
|
||
| [*] | ||
| charset = utf-8 | ||
| end_of_line = lf | ||
| indent_size = 2 | ||
| indent_style = space | ||
| insert_final_newline = true | ||
| trim_trailing_whitespace = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| lerna-debug.log* | ||
|
|
||
| # Diagnostic reports (https://nodejs.org/api/report.html) | ||
| report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
|
||
| # Runtime data | ||
| pids | ||
| *.pid | ||
| *.seed | ||
| *.pid.lock | ||
|
|
||
| # Directory for instrumented libs generated by jscoverage/JSCover | ||
| lib-cov | ||
|
|
||
| # Coverage directory used by tools like istanbul | ||
| coverage | ||
| *.lcov | ||
|
|
||
| # nyc test coverage | ||
| .nyc_output | ||
|
|
||
| # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
| .grunt | ||
|
|
||
| # Bower dependency directory (https://bower.io/) | ||
| bower_components | ||
|
|
||
| # node-waf configuration | ||
| .lock-wscript | ||
|
|
||
| # Compiled binary addons (https://nodejs.org/api/addons.html) | ||
| build/Release | ||
|
|
||
| # Dependency directories | ||
| node_modules/ | ||
| jspm_packages/ | ||
|
|
||
| # TypeScript v1 declaration files | ||
| typings/ | ||
|
|
||
| # TypeScript cache | ||
| *.tsbuildinfo | ||
|
|
||
| # Optional npm cache directory | ||
| .npm | ||
|
|
||
| # Optional eslint cache | ||
| .eslintcache | ||
|
|
||
| # Microbundle cache | ||
| .rpt2_cache/ | ||
| .rts2_cache_cjs/ | ||
| .rts2_cache_es/ | ||
| .rts2_cache_umd/ | ||
|
|
||
| # Optional REPL history | ||
| .node_repl_history | ||
|
|
||
| # Output of 'npm pack' | ||
| *.tgz | ||
|
|
||
| # Yarn Integrity file | ||
| .yarn-integrity | ||
|
|
||
| # dotenv environment variables file | ||
| .env | ||
| .env.test | ||
|
|
||
| # parcel-bundler cache (https://parceljs.org/) | ||
| .cache | ||
|
|
||
| # Next.js build output | ||
| .next | ||
|
|
||
| # Nuxt.js build / generate output | ||
| .nuxt | ||
| dist | ||
|
|
||
| # Gatsby files | ||
| .cache/ | ||
| # Comment in the public line in if your project uses Gatsby and *not* Next.js | ||
| # https://nextjs.org/blog/next-9-1#public-directory-support | ||
| # public | ||
|
|
||
| # vuepress build output | ||
| .vuepress/dist | ||
|
|
||
| # Serverless directories | ||
| .serverless/ | ||
|
|
||
| # FuseBox cache | ||
| .fusebox/ | ||
|
|
||
| # DynamoDB Local files | ||
| .dynamodb/ | ||
|
|
||
| # TernJS port file | ||
| .tern-port | ||
|
|
||
| version/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| ## Database Controller | ||
|
|
||
| ### Development | ||
|
|
||
| **Environment:** Node.js 8.17.0, use `yarn install` to install all dependencies under `src/` or `sdk/`. To set environmental variables, create a `.env` file under `src`. | ||
|
|
||
|
|
||
| **Lint:** Use `npm install standard --global` to isntall Standard.js globally. Then run `npm run lint` under `src/` or `sdk/`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Copyright (c) Microsoft Corporation | ||
| # All rights reserved. | ||
yiyione marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| # | ||
| # 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. | ||
|
|
||
| pushd $(dirname "$0") > /dev/null | ||
|
|
||
| mkdir -m 777 -p "../version" | ||
| cp -arf "../../../version/PAI.VERSION" "../version/" | ||
| echo `git rev-parse HEAD` > "../version/COMMIT.VERSION" | ||
|
|
||
| popd > /dev/null | ||
35 changes: 35 additions & 0 deletions
35
src/database-controller/build/database-controller.common.dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # 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. | ||
|
|
||
| FROM node:carbon | ||
|
|
||
| WORKDIR /database-controller | ||
|
|
||
| COPY ./src ./src | ||
| COPY ./sdk ./sdk | ||
| COPY ./version ./version | ||
|
|
||
| WORKDIR src | ||
|
|
||
| RUN yarn install | ||
|
|
||
| RUN npm install json -g | ||
| RUN json -I -f package.json -e "this.paiVersion=\"`cat ../version/PAI.VERSION`\"" | ||
| RUN json -I -f package.json -e "this.paiCommitVersion=\"`cat ../version/COMMIT.VERSION`\"" | ||
|
|
||
|
|
||
| CMD ["sleep", "infinity"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # 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. | ||
|
|
||
| service_type: "common" | ||
|
|
||
| # general settings | ||
| log-level: info | ||
| recovery-mode: false | ||
| k8s-connection-timeout-second: 120 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not need manual recovery-mode if we already have auto recover in init container? #Closed
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. btw Note that during recover do not serve any http request just recover In reply to: 466150363 [](ancestors = 466150363) |
||
| write-merger-connection-timeout-second: 120 | ||
|
|
||
| # write merger | ||
| write-merger-port: 9748 | ||
| write-merger-max-db-connection: 50 | ||
|
|
||
| # db poller | ||
| db-poller-interval-second: 120 | ||
| db-poller-max-db-connection: 10 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #!/usr/bin/env python | ||
| # | ||
| # 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. | ||
|
|
||
| import copy | ||
| import logging | ||
|
|
||
|
|
||
| class DatabaseController(object): | ||
| def __init__(self, cluster_conf, service_conf, default_service_conf): | ||
| self.cluster_conf = cluster_conf | ||
| self.service_conf = self.merge_service_configuration(service_conf, default_service_conf) | ||
| self.logger = logging.getLogger(__name__) | ||
|
|
||
| @staticmethod | ||
| def merge_service_configuration(overwrite_srv_cfg, default_srv_cfg): | ||
| if overwrite_srv_cfg is None: | ||
| return default_srv_cfg | ||
| srv_cfg = default_srv_cfg.copy() | ||
| for k in overwrite_srv_cfg: | ||
| srv_cfg[k] = overwrite_srv_cfg[k] | ||
| return srv_cfg | ||
|
|
||
| def get_master_ip(self): | ||
| for host_conf in self.cluster_conf["machine-list"]: | ||
| if "pai-master" in host_conf and host_conf["pai-master"] == "true": | ||
| return host_conf["hostip"] | ||
|
|
||
| def validation_pre(self): | ||
| return True, None | ||
|
|
||
| def run(self): | ||
| result = copy.deepcopy(self.service_conf) | ||
| result['write-merger-url'] = 'http://{}:{}'.format(self.get_master_ip(), result['write-merger-port']) | ||
| return result | ||
|
|
||
| def validation_post(self, conf): | ||
| return True, None |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.