Skip to content

Commit 58024cd

Browse files
authored
Merge pull request #328 from pdostal/gce_terraform
GCE: Add 'tf-network' to the list of protected networks
2 parents 061a14a + 775b7be commit 58024cd

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ocw/lib/gce.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from os.path import basename
44
from datetime import timezone
55
from dateutil.parser import parse
6+
from webui.PCWConfig import ConfigFile
67
import googleapiclient.discovery
78
from googleapiclient.errors import HttpError
89
from google.oauth2 import service_account
@@ -11,7 +12,6 @@
1112

1213
class GCE(Provider):
1314
__instances = {}
14-
__skip_networks = frozenset({"default"})
1515

1616
def __new__(cls, namespace):
1717
if namespace not in GCE.__instances:
@@ -20,6 +20,9 @@ def __new__(cls, namespace):
2020

2121
def __init__(self, namespace):
2222
super().__init__(namespace)
23+
24+
self.__skip_networks = frozenset(ConfigFile().getList('cleanup/gce-skip-networks', ["default"]))
25+
2326
self.__compute_client = None
2427
self.private_key_data = self.get_data()
2528
self.project = self.private_key_data["project_id"]

templates/pcw.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ to = <your_email@suse.com>
3131
[cleanup]
3232
# Max age of data storage resources ( used in EC2 only )
3333
ec2-max-age-days = 1
34+
# The list of networks which themselves as well as their resources should not be cleaned up
35+
# This is due to fact that netowrk and security resources in GCP don't have neither tags nor metadata
36+
gce-skip-networks = default,tf-network
3437
# Max age of data storage resources ( used in Azure and GCE )
3538
max-age-hours = 1
3639
# Max age for images in Openstack

0 commit comments

Comments
 (0)