-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(k8s): avoid building Helm chart before getting deploy status
- Loading branch information
Showing
14 changed files
with
257 additions
and
82 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
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
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
19 changes: 18 additions & 1 deletion
19
garden-service/test/data/test-projects/helm/api-image/Dockerfile
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 +1,18 @@ | ||
FROM busybox:1.31.0 | ||
# Using official python runtime base image | ||
FROM python:2.7-alpine | ||
|
||
# Set the application directory | ||
WORKDIR /app | ||
|
||
# Install our requirements.txt | ||
ADD requirements.txt /app/requirements.txt | ||
RUN pip install -r requirements.txt | ||
|
||
# Copy our code from the current folder to /app inside the container | ||
ADD . /app | ||
|
||
# Make port 80 available for links and/or publish | ||
EXPOSE 80 | ||
|
||
# Define our command to be run when launching the container | ||
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:80", "--log-file", "-", "--access-logfile", "-", "--workers", "4", "--keep-alive", "0"] |
52 changes: 52 additions & 0 deletions
52
garden-service/test/data/test-projects/helm/api-image/app.py
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,52 @@ | ||
from flask import Flask, render_template, request, make_response, g | ||
from flask_cors import CORS | ||
from redis import Redis | ||
import os | ||
import socket | ||
import random | ||
import json | ||
|
||
option_a = os.getenv('OPTION_A', "Cats") | ||
option_b = os.getenv('OPTION_B', "Dogs") | ||
hostname = socket.gethostname() | ||
|
||
app = Flask(__name__) | ||
CORS(app) | ||
|
||
def get_redis(): | ||
if not hasattr(g, 'redis'): | ||
g.redis = Redis(host="redis-master", db=0, socket_timeout=5) | ||
return g.redis | ||
|
||
@app.route("/vote/", methods=['POST','GET']) | ||
def vote(): | ||
voter_id = hex(random.getrandbits(64))[2:-1] | ||
|
||
app.logger.info("received request") | ||
|
||
vote = None | ||
|
||
if request.method == 'POST': | ||
redis = get_redis() | ||
vote = request.form['vote'] | ||
data = json.dumps({'voter_id': voter_id, 'vote': vote}) | ||
|
||
redis.rpush('votes', data) | ||
print("Registered vote") | ||
response = app.response_class( | ||
response=json.dumps(data), | ||
status=200, | ||
mimetype='application/json' | ||
) | ||
return response | ||
|
||
response = app.response_class( | ||
response=json.dumps({}), | ||
status=404, | ||
mimetype='application/json' | ||
) | ||
return response | ||
|
||
|
||
if __name__ == "__main__": | ||
app.run(host='0.0.0.0', port=80, debug=True, threaded=True) |
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 |
---|---|---|
|
@@ -6,4 +6,3 @@ hotReload: | |
sync: | ||
- source: "*" | ||
target: /app | ||
include: [Dockerfile] |
4 changes: 4 additions & 0 deletions
4
garden-service/test/data/test-projects/helm/api-image/requirements.txt
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,4 @@ | ||
Flask | ||
Redis | ||
gunicorn | ||
flask-cors |
Oops, something went wrong.