Skip to content

Commit

Permalink
hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-kod committed Aug 16, 2022
1 parent d9a2d2d commit 3e6625d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Binary file modified __pycache__/k8s.cpython-38.pyc
Binary file not shown.
Binary file modified __pycache__/main.cpython-38.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions k8s.py
Expand Up @@ -30,6 +30,6 @@ def get_used_port():
print(unusedport)
return unusedport

def update_port(name):
cp = subprocess.run(['kubectl' 'patch' 'service' name '--type=\'json\'' '-p=\'[{"op": "replace", "path": "/spec/ports/0/nodePort", "value": 31600}]\''], encoding='utf-8', stdout=subprocess.PIPE)
def update_port(name, port):
cp = subprocess.run(['kubectl', 'patch', 'service', name, '--type=\'json\'', '-p=\'[{"op": "replace", "path": "/spec/ports/0/nodePort", "value": {}}]\''.format(port)], encoding='utf-8', stdout=subprocess.PIPE)
return cp.stdout
4 changes: 2 additions & 2 deletions main.py
Expand Up @@ -31,11 +31,11 @@ def create_pod(pod: Pod):

@app.get("/pods/")
def get_pod():
return {"output": k8s.get_pod()}
return {"pods": k8s.get_pod()}

@app.post("/services/")
def create_service(service: Service):
callback = k8s.change_port(name)
callback = k8s.change_port(service.name,service.port)
return {"result": callback}

@app.get("/ports_suggest/")
Expand Down

0 comments on commit 3e6625d

Please sign in to comment.