Skip to content

Commit

Permalink
Dev/shishir/gcp fix (#432)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShishirPatil authored Jun 27, 2022
1 parent 15f800f commit 5afe0d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions skyplane/compute/gcp/gcp_cloud_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,21 @@ def configure_skyplane_firewall(self, ip="0.0.0.0/0"):

def create_firewall(body, update_firewall=False):
if update_firewall:
op = compute.firewalls().update(project=self.auth.project_id, firewall="ssh", body=fw_body).execute()
op = compute.firewalls().update(project=self.auth.project_id, firewall="skyplanessh", body=fw_body).execute()
else:
op = compute.firewalls().insert(project=self.auth.project_id, body=fw_body).execute()
self.wait_for_operation_to_complete("global", op["name"])

try:
current_firewall = compute.firewalls().get(project=self.auth.project_id, firewall="ssh").execute()
current_firewall = compute.firewalls().get(project=self.auth.project_id, firewall="skyplanessh").execute()
except googleapiclient.errors.HttpError as e:
if e.resp.status == 404:
current_firewall = None
else:
raise e

fw_body = {
"name": "ssh",
"name": "skyplanessh",
"network": "global/networks/skyplane",
"allowed": [{"IPProtocol": "tcp", "ports": ["22"]}, {"IPProtocol": "udp", "ports": ["1-65535"]}, {"IPProtocol": "icmp"}],
"description": "Allow all traffic from all IPs",
Expand Down Expand Up @@ -251,8 +251,8 @@ def create_firewall(body, update_firewall=False):
fw_body = {
"name": firewall_name, # Name should be [a-z]([-a-z0-9]*[a-z0-9]
"network": "global/networks/skyplane",
"allowed": [{"IPProtocol": "tcp", "ports": ["1-65535"]}, {"IPProtocol": "icmp", "ports": ["1-65535"]}],
"description": f"Allow all TCP/ICMP traffic from ip {ip}",
"allowed": [{"IPProtocol": "tcp", "ports": ["1-65535"]}],
"description": f"Allow all TCP traffic from ip {ip}",
"sourceRanges": [f"{ip}/32"],
}
try:
Expand Down

0 comments on commit 5afe0d8

Please sign in to comment.