Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed K3 cluster by adding health endpoint #103

Closed
wants to merge 12 commits into from
4 changes: 2 additions & 2 deletions k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
resources:
limits:
cpu: "0.50"
memory: "128Mi"
memory: "256Mi"
requests:
cpu: "0.25"
memory: "64Mi"
memory: "128Mi"
14 changes: 14 additions & 0 deletions service/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ def index():
)


######################################################################
# HEALTH ENDPOINT FOR K3 CLUSTER
######################################################################
@app.route("/health")
def health():
"""Health endpoint"""
return (
jsonify(
message=status.HTTP_200_OK,
),
status.HTTP_200_OK,
)


######################################################################
# R E S T A P I E N D P O I N T S
######################################################################
Expand Down
11 changes: 11 additions & 0 deletions service/static/css/blue_bootstrap.min.css

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions service/static/css/cerulean_bootstrap.min.css

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions service/static/css/darkly_bootstrap.min.css

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions service/static/css/flatly_bootstrap.min.css

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions service/static/css/slate_bootstrap.min.css

Large diffs are not rendered by default.

Binary file added service/static/images/newapp-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
237 changes: 237 additions & 0 deletions service/static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
<!DOCTYPE html>
<html>

<head>
<title>Shopcart Demo RESTful Service</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta user_id="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="static/images/newapp-icon.png">
<link rel="stylesheet" href="static/css/cerulean_bootstrap.min.css">
</head>

<body>
<div class="container">
<div class="page-header">
<h1>Shopcart Demo REST API Service</h1>
</div>

<!-- Flash Message -->
<div class="table-responsive">
<table class="table">
<tr>
<td>Status:</td>
<td><span id="flash_message"></span></td>
</tr>
</table>
</div>

<!-- FORM -->
<div class="col-md-12" id="shopcarts_form_data">
<h3>Create, Retrieve, Update, and Delete a Shopcart:</h3>
<div class="well">
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2" for="shopcart_id">Shopcart ID:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="shopcart_id" placeholder="Enter ID of Shopcart">
</div>
<div class="col-sm-4">
<button type="submit" class="btn btn-primary" id="retrieve-shopcart-btn">Retrieve</button>
<button type="submit" class="btn btn-danger" id="delete-shopcart-btn">Delete</button>
</div>
</div>
</div> <!-- form horizontal -->

<div class="form-horizontal">

<!-- USER_ID -->
<div class="form-group">
<label class="control-label col-sm-2" for="shopcart_user_id">User ID:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="shopcart_user_id"
placeholder="Enter user_id of Shopcart's holder">
</div>
</div>

<!-- CREATION DATE -->
<div class="form-group">
<label class="control-label col-sm-2" for="shopcart_creation_date">Creation date:</label>
<div class="col-sm-10">
<input type="date" class="form-control" id="shopcart_creation_date" placeholder="2020-04-01">
</div>
</div>

<!-- LAST UPDATE DATE -->
<div class="form-group">
<label class="control-label col-sm-2" for="shopcart_last_update_date">Last update date:</label>
<div class="col-sm-10">
<input type="date" class="form-control" id="shopcart_last_update_date" placeholder="2020-04-01">
</div>
</div>

<!-- ITEMS -->
<div class="form-group">
<label class="control-label col-sm-2" for="shopcart_items">Items:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="shopcart_items" placeholder="Enter items for Shopcart">
</div>
</div>

<!-- TOTAL PRICE -->
<div class="form-group">
<label class="control-label col-sm-2" for="shopcart_total_price">Total price:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="shopcart_total_price"
placeholder="Enter total price for Shopcart">
</div>
</div>


<!-- SUBMIT BUTTONS -->
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary" id="search-shopcart-btn">Search</button>
<button type="submit" class="btn btn-primary" id="clear-shopcart-btn">Clear</button>
<button type="submit" class="btn btn-success" id="create-shopcart-btn">Create</button>
<button type="submit" class="btn btn-warning" id="update-shopcart-btn">Update</button>
</div>
</div>
</div> <!-- form horizontal -->
</div> <!-- end well -->
</div> <!-- end Form -->

<!-- Search Results -->
<div class="table-responsive col-md-12" id="search_results">
<table class="table table-striped">
<thead>
<tr>
<th class="col-md-1">Shopcart ID</th>
<th class="col-md-4">User ID</th>
<th class="col-md-3">Creation Date</th>
<th class="col-md-3">Last Update</th>
<th class="col-md-4">Items</th>
<th class="col-md-3">Total price</th>
</tr>
</thead>
</table>
</div>

<div class="col-md-12" id="items_form_data">
<h3>Create, Retrieve, Update, and Delete a Item:</h3>
<div class="well">
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2" for="item_id">Item ID:</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="item_id" placeholder="Enter ID of an Item">
</div>
<div class="col-sm-4">
<button type="submit" class="btn btn-primary" id="retrieve-item-btn">Retrieve</button>
<button type="submit" class="btn btn-danger" id="delete-item-btn">Delete</button>
</div>
</div>
</div> <!-- form horizontal -->

<div class="form-horizontal">

<!-- PRODUCT NAME -->
<div class="form-group">
<label class="control-label col-sm-2" for="item_product_name">Product name:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="item_product_name" placeholder="Enter the product name">
</div>
</div>

<!-- SHOPCART ID -->
<div class="form-group">
<label class="control-label col-sm-2" for="item_shopcart_id">Shopcart ID:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="item_shopcart_id"
placeholder="Enter the shopcart ID of an Item">
</div>
</div>

<!-- PRODUCT ID -->
<div class="form-group">
<label class="control-label col-sm-2" for="item_product_id">Product ID:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="item_product_id"
placeholder="Enter the product ID of an Item">
</div>
</div>

<!-- PRODUCT PRICE -->
<div class="form-group">
<label class="control-label col-sm-2" for="item_product_price">Product price:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="item_product_price"
placeholder="Enter the product price of an Item">
</div>
</div>

<!-- QUANTITY -->
<div class="form-group">
<label class="control-label col-sm-2" for="item_quantity">Product quantity:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="item_quantity" placeholder="Enter the product quantity">
</div>
</div>

<!-- SUBTOTAL -->
<div class="form-group">
<label class="control-label col-sm-2" for="item_subtotal_price">Subtotal:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="item_subtotal_price"
placeholder="Enter subtotal for the product given the quantity.">
</div>
</div>


<!-- SUBMIT BUTTONS -->
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary" id="search-item-btn">Search</button>
<button type="submit" class="btn btn-primary" id="clear-item-btn">Clear</button>
<button type="submit" class="btn btn-success" id="create-item-btn">Create</button>
<button type="submit" class="btn btn-warning" id="update-item-btn">Update</button>
</div>
</div>
</div> <!-- form horizontal -->
</div> <!-- end well -->
</div> <!-- end Form -->

<!-- Search Results -->
<div class="table-responsive col-md-12" id="search_results">
<table class="table table-striped">
<thead>
<tr>
<th class="col-md-1">Item ID</th>
<th class="col-md-4">Product name</th>
<th class="col-md-1">Shopcart ID</th>
<th class="col-md-3">Product ID</th>
<th class="col-md-3">Product Price</th>
<th class="col-md-4">Product quantity</th>
<th class="col-md-3">Subtotal</th>
</tr>
</thead>
</table>
</div>


<footer>
<br><br>
<p>&copy; NYU Shopcarts 2024</p>
</footer>

</div> <!-- container -->

<script type="text/javascript" src="static/js/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="static/js/bootstrap.min.js"></script>

<!-- YOUR REST API -->
<script type="text/javascript" src="static/js/rest_api.js"></script>

</body>

</html>
7 changes: 7 additions & 0 deletions service/static/js/bootstrap.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions service/static/js/jquery-3.6.0.min.js

Large diffs are not rendered by default.

Loading
Loading