diff --git a/Makefile b/Makefile index f3ec29d..039cf25 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index 2c3e824..4024d33 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -46,7 +46,7 @@ spec: resources: limits: cpu: "0.50" - memory: "128Mi" + memory: "256Mi" requests: cpu: "0.25" - memory: "64Mi" + memory: "128Mi" diff --git a/service/routes.py b/service/routes.py index 8ccfbd5..07c7085 100644 --- a/service/routes.py +++ b/service/routes.py @@ -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 ######################################################################