Skip to content

Commit

Permalink
Merge pull request #40 from KAIYO-OSS/dockerfile-update
Browse files Browse the repository at this point in the history
Add helm dependencies in Odin Docker file and remove acl from odin
  • Loading branch information
anuragsarkar97 authored Jul 31, 2021
2 parents 2d760cd + 02fc149 commit 7aee405
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
10 changes: 9 additions & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,13 @@ COPY . /app
WORKDIR /app

RUN pip install -r requirements.txt
RUN curl -fsSL -o get_helm.sh "https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3"
RUN chmod 700 get_helm.sh
RUN ./get_helm.sh
RUN curl -L -s "https://dl.k8s.io/release/stable.txt"
RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/v1.23.1/bin/linux/amd64/kubectl"
RUN chmod +x kubectl

CMD ["uvicorn" ,"application:application", "--host", "0.0.0.0", "--port" ,"5000"]


CMD ["uvicorn" ,"application:application", "--host", "0.0.0.0", "--port" ,"5000"]
1 change: 0 additions & 1 deletion api/models/deployRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class DeployRequest(BaseModel):
acl_token: str
# workspaceID: str
chart_name: str
service_name: str
Expand Down
3 changes: 2 additions & 1 deletion api/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ pymongo==3.11.0
asyncio==3.4.3
requests==2.24.0
prometheus_client==0.7.1
starlette-exporter==0.7.0
starlette-exporter==0.7.0
etcd3==0.8.1
12 changes: 6 additions & 6 deletions api/routers/odin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async def deploy_service(deploy_request: DeployRequest):
output = Utils.getJson(Helm.deployService(deploy_request.service_name,
deploy_request.chart_name, deploy_request.values))
service_list = Utils.getJson(Helm.listAllServices())
etcd.put('{acl_token}:service_list'.format(acl_token=deploy_request.acl_token), json.dumps(service_list))
etcd.put('service_list', json.dumps(service_list))
return {
"status": "200",
"metadata": output,
Expand All @@ -28,12 +28,12 @@ async def deploy_service(deploy_request: DeployRequest):
raise HTTPException(status_code=500, detail="Service deployment failed: " + str(ex))


@router.delete("/odin/service/{service_name}/{acl_token}", tags=["odin"])
async def delete_service(service_name, acl_token):
@router.delete("/odin/service/{service_name}", tags=["odin"])
async def delete_service(service_name):
try:
Helm.deleteService(service_name)
service_list = Utils.getJson(Helm.listAllServices())
etcd.put('{acl_token}:service_list'.format(acl_token=acl_token), json.dumps(service_list))
etcd.put('service_list', json.dumps(service_list))
return {
"status": "200",

Expand Down Expand Up @@ -89,9 +89,9 @@ async def rollback_service(rollback_request: RollbackRequest):


@router.get("/odin/services/", tags=["odin"])
async def get_all_services(acl_token: str):
async def get_all_services():
try:
service_list = Utils.getJsonValue(etcd, '{acl_token}:service_list'.format(acl_token=acl_token))
service_list = Utils.getJsonValue(etcd, 'service_list')
return {
"status": "200",
"metadata": service_list,
Expand Down

0 comments on commit 7aee405

Please sign in to comment.