Skip to content

Commit 78faf4b

Browse files
Merge pull request #51 from pomo-mondreganto/kube
Deploy to kubernetes
2 parents f99d532 + 0ea5df8 commit 78faf4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1121
-187
lines changed

.dockerignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
.DS_Store
22
.idea
33

4-
front/node_modules
4+
/front/node_modules
55

66
/control.py
7-
/requirements.txt
87
/README.md
98
.mypy_cache
10-
11-
docker_volumes
9+
/cli
10+
/docker_volumes

.github/workflows/tests.yml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ jobs:
3333
uses: actions/setup-python@v2
3434
with:
3535
python-version: '3.7'
36-
architecture: 'x64'
37-
3836
- name: Setup tests
3937
run: python tests/setup_forcad.py
4038
- name: Install requirements
@@ -71,7 +69,6 @@ jobs:
7169
python-version: '3.7'
7270
- name: Install dependencies
7371
run: pip install flake8
74-
7572
- name: Run linters
7673
uses: wearerequired/lint-action@v1
7774
with:
@@ -90,7 +87,6 @@ jobs:
9087
- name: Install dependencies
9188
working-directory: front
9289
run: yarn install
93-
9490
- name: Run linters
9591
uses: wearerequired/lint-action@v1
9692
with:
@@ -100,3 +96,39 @@ jobs:
10096
prettier: true
10197
eslint_dir: front/src
10298
prettier_dir: front/src
99+
100+
test_kube:
101+
runs-on: ubuntu-20.04
102+
steps:
103+
- name: Checkout
104+
uses: actions/checkout@v2
105+
- name: Setup python
106+
uses: actions/setup-python@v2
107+
with:
108+
python-version: '3.7'
109+
- name: Install skaffold
110+
run: |
111+
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v1.19.0/skaffold-linux-amd64
112+
chmod +x skaffold
113+
sudo mv skaffold /usr/local/bin
114+
- name: Setup Minikube
115+
uses: manusa/actions-setup-minikube@v2.3.0
116+
with:
117+
minikube version: 'v1.17.1'
118+
kubernetes version: 'v1.19.3'
119+
github token: ${{ secrets.GITHUB_TOKEN }}
120+
- name: Install cli requirements
121+
run: pip install -r cli/requirements.txt
122+
- name: Copy test config
123+
run: python tests/setup_forcad.py
124+
- name: Setup configuration
125+
run: ./control.py kube setup
126+
- name: Kustomize build
127+
uses: karancode/kustomize-github-action@master
128+
with:
129+
kustomize_version: '3.9.2'
130+
kustomize_build_dir: 'deploy'
131+
env:
132+
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133+
- name: Skaffold build
134+
run: ./control.py kube build

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ node_modules/
1818

1919
/.version
2020
/release
21+
deploy/secrets/*
22+
!deploy/secrets/.keep
23+
24+
deploy/kustomization.yml

backend/services/admin/viewsets/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from .tasks import TaskApi
55
from .teams import TeamApi
66
from .teamtasks import TeamTaskApi
7-
from .utils import admin_bp
7+
from .views import admin_bp
88

99
TeamApi(admin_bp, auth=True)
1010
TaskApi(admin_bp, auth=True)

backend/services/admin/viewsets/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
from flask import Blueprint, jsonify, make_response, abort
2-
3-
admin_bp = Blueprint('admin_api', __name__)
1+
from flask import jsonify, make_response, abort
42

53

64
def make_err_response(err, status=400):
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from flask import Blueprint, jsonify
2+
3+
admin_bp = Blueprint('admin_api', __name__)
4+
5+
6+
@admin_bp.route('/health/')
7+
def health_check():
8+
return jsonify({'status': 'ok'})

backend/services/api/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ def get_team_history(team_id):
4040
return jsonify(teamtasks)
4141

4242

43-
@client_bp.route('/status/')
44-
def status():
45-
return jsonify(dict(status='ok'))
43+
@client_bp.route('/health/')
44+
def health_check():
45+
return jsonify({'status': 'ok'})

backend/services/events/app.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22

3-
from flask import Flask
3+
from flask import Flask, jsonify
44
from flask_cors import CORS
55
from flask_socketio import SocketIO, emit
66

@@ -33,6 +33,11 @@ def handle_connect():
3333
)
3434

3535

36+
@app.route('/api/events/health/')
37+
def health_check():
38+
return jsonify({'status': 'ok'})
39+
40+
3641
if __name__ == '__main__':
3742
app.run(host="0.0.0.0", port=5000, debug=True)
3843
else:

backend/services/http_receiver/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
23
from flask import Blueprint
34
from flask import jsonify, make_response, request
45

@@ -63,7 +64,6 @@ def get_teams():
6364
return jsonify(responses)
6465

6566

66-
@receiver_bp.route('/status/')
67+
@receiver_bp.route('/health/')
6768
def health_check():
68-
logger.debug('status called')
6969
return jsonify({'status': 'ok'})

backend/services/monitoring/app.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import eventlet
21
import logging
3-
from flask import Flask
2+
3+
import eventlet
4+
from flask import Flask, jsonify
45
from flask_cors import CORS
56

67
from metrics import MetricsServer
@@ -16,6 +17,12 @@
1617
metrics.add_endpoint('/api/metrics')
1718
eventlet.spawn(metrics.connect_consumer)
1819

20+
21+
@app.route('/api/metrics/health/')
22+
def health():
23+
return jsonify({'status': 'ok'})
24+
25+
1926
if __name__ == '__main__':
2027
app.run(host="0.0.0.0", port=5000, debug=True)
2128
else:

0 commit comments

Comments
 (0)