Skip to content

Commit

Permalink
Merge 761a606 into f82f13f
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhilborn committed Aug 4, 2021
2 parents f82f13f + 761a606 commit 59f6bea
Show file tree
Hide file tree
Showing 18 changed files with 1,332 additions and 67 deletions.
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@ python:
install:
- pip3 install -r requirements.txt
- pip3 install -e .
- pip3 install pytest
- pip3 install pytest-cov
- pip3 install coveralls
- pip3 install kubernetes
- curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
- sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
script:
- pytest
- pytest --cov=./
after_success:
- coveralls
5 changes: 4 additions & 1 deletion src/ce/delete_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import requests
from src.common.functions import Color

def get_input(text):
return input(text)

class DeleteEdge:
def __init__(self, crn: str, zone_id: str, cis_domain: str, apikey: str, token: str) -> None:
self.crn = crn
Expand All @@ -11,7 +14,7 @@ def __init__(self, crn: str, zone_id: str, cis_domain: str, apikey: str, token:
self.token = token

def delete_edge(self):
execute = input("Delete edge function? Input 'y' or 'yes' to execute: ").lower()
execute = get_input("Delete edge function? Input 'y' or 'yes' to execute: ").lower()
if execute == 'y' or execute == 'yes':
action_name = self.cis_domain.replace('.','-')
#token = self.request_token(self.apikey)
Expand Down
11 changes: 7 additions & 4 deletions src/ce/delete_glb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@
from ibm_cloud_sdk_core.api_exception import ApiException
from src.common.functions import Color

def get_input(text):
return input(text)

class DeleteGLB:
def __init__(self, crn: str, zone_id: str, endpoint: str, cis_domain: str) -> None:
self.crn = crn
self.zone_id = zone_id
self.endpoint = endpoint
self.cis_domain = cis_domain
self.cis_domain = cis_domain

def delete_glb(self):
# delete the glb
execute_glb = input("Delete global load balancer? Input 'y' or 'yes' to execute: ").lower()
execute_glb = get_input("Delete global load balancer? Input 'y' or 'yes' to execute: ").lower()
if execute_glb == 'y' or execute_glb == 'yes':
globalLoadBalancer = GlobalLoadBalancerV1.new_instance(
crn=self.crn, zone_identifier=self.zone_id, service_name="cis_services")
Expand All @@ -40,7 +43,7 @@ def delete_glb(self):

if keepgoing:
# delete the origin pool
execute_origin = input("Delete origin pool? Input 'y' or 'yes' to execute: ").lower()
execute_origin = get_input("Delete origin pool? Input 'y' or 'yes' to execute: ").lower()
if execute_origin == 'y' or execute_origin == 'yes':
globalLoadBalancerPools = GlobalLoadBalancerPoolsV0.new_instance(
crn=self.crn, service_name="cis_services")
Expand All @@ -64,7 +67,7 @@ def delete_glb(self):

if keepgoing:
# delete the linked health check
execute_monitor = input("Delete health check monitor? Input 'y' or 'yes' to execute: ").lower()
execute_monitor = get_input("Delete health check monitor? Input 'y' or 'yes' to execute: ").lower()
if execute_monitor == 'y' or execute_monitor == 'yes':

cert = GlobalLoadBalancerMonitorV1.new_instance(
Expand Down
5 changes: 4 additions & 1 deletion src/common/delete_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
from ibm_cloud_sdk_core.api_exception import ApiException
from src.common.functions import Color

def get_input(text):
return input(text)

class DeleteDNS:
def __init__(self, crn: str, zone_id: str, endpoint: str, cis_domain: str) -> None:
self.crn = crn
Expand All @@ -12,7 +15,7 @@ def __init__(self, crn: str, zone_id: str, endpoint: str, cis_domain: str) -> No
self.cis_domain = cis_domain

def delete_dns(self):
execute = input("Delete DNS Records? Input 'y' or 'yes' to execute: ").lower()
execute = get_input("Delete DNS Records? Input 'y' or 'yes' to execute: ").lower()
if execute == 'y' or execute == 'yes':
# create instance
record = DnsRecordsV1.new_instance(
Expand Down
2 changes: 2 additions & 0 deletions src/common/dns_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def create_records(self):

return (root_record, www_record)

return (root_record, www_record)

def create_root_record(self, record, record_type, root_name):
root_record = record.create_dns_record(type=record_type, name=root_name, content=self.content, proxied=True)
return root_record
Expand Down
8 changes: 7 additions & 1 deletion src/iks/iks.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ def handle_args(args):


def iks(args):

delete_dns = None
delete_workspaces = None
work_creator = None
user_ingress = None

UserInfo = handle_args(args)
if UserInfo.delete and not UserInfo.terraforming:
delete_dns = DeleteDNS(UserInfo.crn, UserInfo.zone_id, UserInfo.api_endpoint, UserInfo.cis_domain)
Expand Down Expand Up @@ -204,3 +208,5 @@ def iks(args):
hostUrl = "https://www."+UserInfo.cis_domain

healthCheck(hostUrl)

return delete_dns, delete_workspaces, work_creator, user_ingress
9 changes: 4 additions & 5 deletions src/root_terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ variable pool_name {
}

variable cluster_id {
type = string
description = "Cluster ID of the IKS instance"
type = string
description = "Cluster ID of the IKS instance"
}

variable standard {
type = bool
description = "Determines whether the CIS instance is using the Standard Plan"
type = string
type = bool
description = "Determines whether the CIS instance is using the Standard Plan"
}

variable create_ce {
Expand Down
8 changes: 8 additions & 0 deletions test_var.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CRN="test_crn"
ZONE_ID="test_zone_id"
API_ENDPOINT="www.test_api_endpoint.com"
CIS_SERVICES_APIKEY="test_api_key"
CIS_NAME="test_instance_name"
RESOURCE_GROUP="test-resource-group"
APP_DOMAIN="test_app_url.com"
CIS_DOMAIN="gcat-interns-test.com"
39 changes: 0 additions & 39 deletions tests/intro_tests.py

This file was deleted.

0 comments on commit 59f6bea

Please sign in to comment.