Skip to content

Commit

Permalink
added serverless function and kubectl hyperkube command to remove pem…
Browse files Browse the repository at this point in the history
… file:

go
  • Loading branch information
swarupdonepudi committed Mar 4, 2020
1 parent 11dee6f commit 556af41
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cli/kubectl-hyperkube
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,24 @@ def get_pem(ctx, cluster):
print(f'Request error: {err}')


@cli.command()
@click.option('--cluster', '-g')
@click.pass_context
def remove_pem(ctx, cluster):
"""Removethe pem file for a specific cluster"""

try:
r = requests.delete(
(f'{ctx.obj["url"]}/{ctx.obj["stage"]}'
f'/clusters/remove-pem?cluster_name={cluster}'),
headers=ctx.obj['headers']
)
if r.status_code == 404:
sys.exit(1)
except requests.exceptions.RequestException as err:
print(f'Request error: {err}')


@cli.command()
@click.option('--cluster', '-g', required=True)
@click.option('--pem', '-p', required=True)
Expand Down
7 changes: 7 additions & 0 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ functions:
path: clusters/get-pem
method: get
private: true
remove_pem:
handler: pem.remove_pem
events:
- http:
path: clusters/remove-pem
method: delete
private: true
list_clusters:
handler: list_clusters.list_clusters
events:
Expand Down

0 comments on commit 556af41

Please sign in to comment.