Skip to content

Commit

Permalink
Merge pull request #104 from CSCI-GA-2820-SP24-001/k3-health
Browse files Browse the repository at this point in the history
added health endpoint for the deployment
  • Loading branch information
vidishaholsambre authored Apr 15, 2024
2 parents aada9cb + 4c89826 commit bc97e90
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,15 @@ depoy: ## Deploy the service on local Kubernetes
$(info Deploying service locally...)
kubectl apply -f k8s/

.PHONY: setup-cluster
setup-cluster: ## Setup the cluster and deploy the service
$(info Destroying the cluster if any...)
make cluster-rm
$(info Creating a cluster...)
make cluster
.PHONY: build-docker
build-docker: ## Build the docker image and push it to the registry
$(info Building the docker image and pushing it to the registry...)
docker build -t shopcarts:1.0 .
docker tag shopcarts:1.0 cluster-registry:32000/shopcarts:1.0
docker push cluster-registry:32000/shopcarts:1.0

.PHONY: setup-cluster
setup-cluster: ## Setup the cluster and deploy the service
$(info Creating the namespace for the resource...)
kubectl create namespace shopcarts-dev
kubectl get ns
Expand Down
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

0 comments on commit bc97e90

Please sign in to comment.