-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from pomo-mondreganto/kube
Deploy to kubernetes
- Loading branch information
Showing
67 changed files
with
1,121 additions
and
187 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,11 +1,10 @@ | ||
.DS_Store | ||
.idea | ||
|
||
front/node_modules | ||
/front/node_modules | ||
|
||
/control.py | ||
/requirements.txt | ||
/README.md | ||
.mypy_cache | ||
|
||
docker_volumes | ||
/cli | ||
/docker_volumes |
This file contains 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 |
---|---|---|
|
@@ -33,8 +33,6 @@ jobs: | |
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.7' | ||
architecture: 'x64' | ||
|
||
- name: Setup tests | ||
run: python tests/setup_forcad.py | ||
- name: Install requirements | ||
|
@@ -71,7 +69,6 @@ jobs: | |
python-version: '3.7' | ||
- name: Install dependencies | ||
run: pip install flake8 | ||
|
||
- name: Run linters | ||
uses: wearerequired/lint-action@v1 | ||
with: | ||
|
@@ -90,7 +87,6 @@ jobs: | |
- name: Install dependencies | ||
working-directory: front | ||
run: yarn install | ||
|
||
- name: Run linters | ||
uses: wearerequired/lint-action@v1 | ||
with: | ||
|
@@ -100,3 +96,39 @@ jobs: | |
prettier: true | ||
eslint_dir: front/src | ||
prettier_dir: front/src | ||
|
||
test_kube: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.7' | ||
- name: Install skaffold | ||
run: | | ||
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v1.19.0/skaffold-linux-amd64 | ||
chmod +x skaffold | ||
sudo mv skaffold /usr/local/bin | ||
- name: Setup Minikube | ||
uses: manusa/[email protected] | ||
with: | ||
minikube version: 'v1.17.1' | ||
kubernetes version: 'v1.19.3' | ||
github token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Install cli requirements | ||
run: pip install -r cli/requirements.txt | ||
- name: Copy test config | ||
run: python tests/setup_forcad.py | ||
- name: Setup configuration | ||
run: ./control.py kube setup | ||
- name: Kustomize build | ||
uses: karancode/kustomize-github-action@master | ||
with: | ||
kustomize_version: '3.9.2' | ||
kustomize_build_dir: 'deploy' | ||
env: | ||
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Skaffold build | ||
run: ./control.py kube build |
This file contains 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 |
---|---|---|
|
@@ -18,3 +18,7 @@ node_modules/ | |
|
||
/.version | ||
/release | ||
deploy/secrets/* | ||
!deploy/secrets/.keep | ||
|
||
deploy/kustomization.yml |
This file contains 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 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 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 @@ | ||
from flask import Blueprint, jsonify | ||
|
||
admin_bp = Blueprint('admin_api', __name__) | ||
|
||
|
||
@admin_bp.route('/health/') | ||
def health_check(): | ||
return jsonify({'status': 'ok'}) |
This file contains 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 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 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 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 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 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,18 @@ | ||
from functools import wraps | ||
from typing import Union, Tuple, Type | ||
|
||
ExceptType = Union[Type[Exception], Tuple[Type[Exception]]] | ||
|
||
|
||
def ignore_exc_wrapper(exc: ExceptType): | ||
def decorator(func): | ||
@wraps(func) | ||
def wrapper(*args, **kwargs): | ||
try: | ||
func(*args, **kwargs) | ||
except exc: | ||
pass | ||
|
||
return wrapper | ||
|
||
return decorator |
This file contains 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 |
---|---|---|
@@ -1,32 +1,15 @@ | ||
import click | ||
|
||
from .build import build | ||
from .pause import pause | ||
from .print_tokens import print_tokens | ||
from .reset import reset | ||
from .resume import resume | ||
from .run_docker import run_docker_command | ||
from .scale import scale | ||
from .setup import setup | ||
from .start import start | ||
from .worker import worker | ||
from . import base, kube | ||
|
||
|
||
@click.group() | ||
def cli(): | ||
pass | ||
|
||
|
||
cli: click.Group | ||
cli.add_command(setup) | ||
cli.add_command(print_tokens) | ||
cli.add_command(reset) | ||
cli.add_command(build) | ||
cli.add_command(start) | ||
cli.add_command(scale) | ||
cli.add_command(worker) | ||
cli.add_command(pause) | ||
cli.add_command(resume) | ||
cli.add_command(run_docker_command) | ||
base.register(cli) | ||
|
||
cli.add_command(kube.cli) | ||
|
||
__all__ = ('cli',) |
This file contains 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,28 @@ | ||
import click | ||
|
||
from .build import build | ||
from .pause import pause | ||
from .print_tokens import print_tokens | ||
from .reset import reset | ||
from .resume import resume | ||
from .run_docker import run_docker_command | ||
from .scale import scale | ||
from .setup import setup | ||
from .start import start | ||
from .worker import worker | ||
|
||
|
||
def register(cli: click.Group): | ||
cli.add_command(setup) | ||
cli.add_command(print_tokens) | ||
cli.add_command(reset) | ||
cli.add_command(build) | ||
cli.add_command(start) | ||
cli.add_command(scale) | ||
cli.add_command(worker) | ||
cli.add_command(pause) | ||
cli.add_command(resume) | ||
cli.add_command(run_docker_command) | ||
|
||
|
||
__all__ = ('register',) |
This file contains 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 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import click | ||
|
||
from .utils import run_docker | ||
from cli.utils import run_docker | ||
|
||
|
||
@click.command(help='Stop updating rounds & receiving flags') | ||
def pause(): | ||
run_docker(['stop', 'celerybeat', 'tcp_receiver', 'http_receiver']) | ||
run_docker(['stop', 'celerybeat', 'tcp-receiver', 'http-receiver']) |
This file contains 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 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 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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import click | ||
|
||
from .utils import run_docker | ||
from cli.utils import run_docker | ||
|
||
|
||
@click.command( | ||
help='Start updating rounds & receiving flags (counterpart of pause_game command)', | ||
) | ||
def resume(): | ||
run_docker(['start', 'celerybeat', 'tcp_receiver', 'http_receiver']) | ||
run_docker(['start', 'celerybeat', 'tcp-receiver', 'http-receiver']) |
This file contains 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 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
Oops, something went wrong.