Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from IBM/deleteIngress
Delete ingress
- Loading branch information
Showing
4 changed files
with
85 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import requests | ||
import json | ||
from src.common.functions import Color as Color | ||
|
||
class DeleteIngress: | ||
def __init__(self, namespace, id_token, iks_master_url) -> None: | ||
self.namespace = namespace | ||
self.id_token= id_token | ||
self.iks_master_url = iks_master_url | ||
|
||
def delete_ingress(self): | ||
|
||
#Delete ingress file with Kubernetes API | ||
url = self.iks_master_url+"/apis/networking.k8s.io/v1beta1/namespaces/"+self.namespace+"/ingresses/cis-ingress" | ||
|
||
payload={} | ||
headers = { | ||
'Authorization': 'bearer '+self.id_token | ||
} | ||
|
||
try: | ||
response = requests.request("DELETE", url, headers=headers, data=payload, verify=False) | ||
data=json.loads(response.text) | ||
|
||
if data["status"]!="Failure": | ||
print(Color.GREEN+"SUCCESS: Deleted ingress file"+Color.END) | ||
else: | ||
print(Color.RED+"ERROR: Unable to delete ingress file"+Color.END) | ||
except: | ||
print(Color.RED+"ERROR: Unable to delete ingress file"+Color.END) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters