cloud-governance 1.1.375__py3-none-any.whl → 1.1.377__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -408,6 +408,7 @@ class EnvironmentVariables:
408
408
 
409
409
 
410
410
  environment_variables = EnvironmentVariables()
411
+
411
412
  # env vars examples
412
413
  # os.environ['AWS_DEFAULT_REGION'] = 'us-east-2'
413
414
  # os.environ['AWS_DEFAULT_REGION'] = 'all'
@@ -983,5 +983,5 @@ class ZombieClusterResources(ZombieClusterCommonMethods):
983
983
 
984
984
  return zombies, cluster_left_out_days
985
985
 
986
- # zombie_cluster_resources = ZombieClusterResources(cluster_prefix='kubernetes.io/cluster/', delete=False, region='us-east-2')
986
+ # zombie_cluster_resources = ZombieClusterResources(cluster_prefix=["kubernetes.io/cluster", "sigs.k8s.io/cluster-api-provider-aws/cluster"], delete=False, region='us-east-2')
987
987
  # print(zombie_cluster_resources.zombie_cluster_subnet())
@@ -15,7 +15,7 @@ def tag_cluster_resource(cluster_name: str = '', mandatory_tags: dict = None, re
15
15
  else:
16
16
  action = 'read'
17
17
  dry_run = 'yes'
18
- tag_cluster_resources = TagClusterResources(cluster_prefix='kubernetes.io/cluster/', cluster_name=cluster_name,
18
+ tag_cluster_resources = TagClusterResources(cluster_prefix=["kubernetes.io/cluster", "sigs.k8s.io/cluster-api-provider-aws/cluster"], cluster_name=cluster_name,
19
19
  input_tags=mandatory_tags, region=region, dry_run=dry_run, cluster_only=cluster_only)
20
20
 
21
21
  func_resource_list = [tag_cluster_resources.cluster_instance,
@@ -16,7 +16,7 @@ class TagClusterResources(TagClusterOperations):
16
16
  SHORT_ID = 5
17
17
  NA_VALUE = 'NA'
18
18
 
19
- def __init__(self, cluster_name: str = None, cluster_prefix: str = None, input_tags: dict = None,
19
+ def __init__(self, cluster_name: str = None, cluster_prefix: list = None, input_tags: dict = None,
20
20
  region: str = 'us-east-2', dry_run: str = 'yes', cluster_only: bool = False):
21
21
  super().__init__(cluster_name=cluster_name, cluster_prefix=cluster_prefix, input_tags=input_tags, region=region,
22
22
  dry_run=dry_run, cluster_only=cluster_only)
@@ -63,7 +63,7 @@ class TagClusterResources(TagClusterOperations):
63
63
  if tag.get('Key') == 'api.openshift.com/name':
64
64
  cluster_name = tag['Value']
65
65
  else:
66
- if not cluster_name and self.cluster_prefix in tag.get('Key'):
66
+ if not cluster_name and any(prefix in tag.get('Key', '') for prefix in self.cluster_prefix):
67
67
  cluster_name = tag['Key']
68
68
  if cluster_name:
69
69
  # cluster_name = cluster_id
@@ -85,7 +85,7 @@ class TagClusterResources(TagClusterOperations):
85
85
  found = True
86
86
  break
87
87
  for tag in tags:
88
- if self.cluster_prefix in tag.get('Key'):
88
+ if any(prefix in tag.get('Key', '') for prefix in self.cluster_prefix):
89
89
  cluster_name = tag['Key']
90
90
  break
91
91
  if not found:
@@ -106,8 +106,8 @@ class TagClusterResources(TagClusterOperations):
106
106
  for item in instance:
107
107
  if item.get('Tags'):
108
108
  for tag in item.get('Tags'):
109
- if self.cluster_prefix in tag.get('Key'):
110
- if tag.get('Key') == cluster_name:
109
+ if any(prefix in tag.get('Key', '') for prefix in self.cluster_prefix):
110
+ if cluster_name in tag.get('Key'):
111
111
  i_tags = [instance_tag for instance_tag in item.get('Tags') if
112
112
  instance_tag.get('Key') != 'Name']
113
113
  return [i_tag for i_tag in i_tags if i_tag.get('Key') != cluster_name]
@@ -149,7 +149,7 @@ class TagClusterResources(TagClusterOperations):
149
149
  # search that not exist permanent tags in the resource
150
150
  if not self.__validate_existing_tag(resource.get(tags)):
151
151
  for tag in resource[tags]:
152
- if self.cluster_prefix in tag.get('Key'):
152
+ if any(prefix in tag.get('Key', '') for prefix in self.cluster_prefix):
153
153
  if tag.get('Key') not in cluster_tags:
154
154
  cluster_tags[tag.get('Key')] = []
155
155
  cluster_ids[tag.get('Key')] = []
@@ -195,7 +195,7 @@ class TagClusterResources(TagClusterOperations):
195
195
  all_tags.extend(vpc_data.get(vpc_id))
196
196
  all_tags = self.__check_name_in_tags(tags=all_tags, resource_id=resource_id)
197
197
  all_tags = self.__filter_resource_tags_by_add_tags(resource.get('Tags'), all_tags)
198
- cluster_tag = [tag for tag in vpc_data.get(vpc_id) if self.cluster_prefix in tag.get('Key')]
198
+ cluster_tag = [tag for tag in vpc_data.get(vpc_id, []) if any(prefix in tag.get('Key', '') for prefix in self.cluster_prefix)]
199
199
  if all_tags:
200
200
  if self.cluster_name:
201
201
  if self.cluster_name in cluster_tag[0].get('Key'):
@@ -224,7 +224,7 @@ class TagClusterResources(TagClusterOperations):
224
224
  for resource in resources_list:
225
225
  if resource.get(tags):
226
226
  for tag in resource[tags]:
227
- if tag['Key'].startswith(f'{self.cluster_prefix}{self.cluster_name}'):
227
+ if any(tag['Key'].startswith(f"{prefix}/{self.cluster_name}") for prefix in self.cluster_prefix):
228
228
  return tag['Key']
229
229
  return ''
230
230
 
@@ -284,7 +284,7 @@ class TagClusterResources(TagClusterOperations):
284
284
  # search that not exist permanent tags in the resource
285
285
  if not self.__validate_existing_tag(tags):
286
286
  for tag in tags:
287
- if self.cluster_prefix in tag.get('Key'):
287
+ if any(prefix in tag.get('Key', '') for prefix in self.cluster_prefix):
288
288
  add_tags = self.__append_input_tags()
289
289
  add_tags.append(tag)
290
290
  cluster_name = tag.get('Key').split('/')[-1]
@@ -472,7 +472,7 @@ class TagClusterResources(TagClusterOperations):
472
472
  if item.get('Tags'):
473
473
  if not self.__validate_existing_tag(item.get('Tags')):
474
474
  for tag in item['Tags']:
475
- if self.cluster_prefix in tag.get('Key'):
475
+ if any(prefix in tag.get('Key', '') for prefix in self.cluster_prefix):
476
476
  all_tags = []
477
477
  instance_tags = self.__get_cluster_tags_by_instance_cluster(cluster_name=tag.get('Key'))
478
478
  if not instance_tags:
@@ -520,7 +520,7 @@ class TagClusterResources(TagClusterOperations):
520
520
  if item.get('Tags'):
521
521
  if not self.__validate_existing_tag(item.get('Tags')):
522
522
  for tag in item['Tags']:
523
- if self.cluster_prefix in tag.get('Key'):
523
+ if any(prefix in tag.get('Key', '') for prefix in self.cluster_prefix):
524
524
  all_tags = []
525
525
  instance_tags = self.__get_cluster_tags_by_instance_cluster(cluster_name=tag.get('Key'))
526
526
  if not instance_tags:
@@ -576,7 +576,7 @@ class TagClusterResources(TagClusterOperations):
576
576
  for vpc in vpcs_data:
577
577
  if vpc.get('Tags'):
578
578
  for tag in vpc.get('Tags'):
579
- if self.cluster_prefix in tag.get('Key'):
579
+ if any(prefix in tag.get('Key', '') for prefix in self.cluster_prefix):
580
580
  vpc_ids[vpc.get('VpcId')] = [tag for tag in vpc.get('Tags') if tag.get('Key') != 'Name']
581
581
  break
582
582
  return vpc_ids
@@ -688,7 +688,7 @@ class TagClusterResources(TagClusterOperations):
688
688
  role_data = role['Role']
689
689
  all_tags = []
690
690
  instance_tags = self.__get_cluster_tags_by_instance_cluster(
691
- cluster_name=f'{self.cluster_prefix}{cluster_key}')
691
+ cluster_name=cluster_key)
692
692
  if not instance_tags:
693
693
  all_tags = self.__append_input_tags(role_data.get('Tags'))
694
694
  else:
@@ -738,7 +738,7 @@ class TagClusterResources(TagClusterOperations):
738
738
  if cluster_name in tag['Key']:
739
739
  all_tags = []
740
740
  instance_tags = self.__get_cluster_tags_by_instance_cluster(
741
- cluster_name=f'{self.cluster_prefix}{cluster_name}')
741
+ cluster_name=cluster_name)
742
742
  if not instance_tags:
743
743
  all_tags = self.__append_input_tags(data.get('Tags'))
744
744
  all_tags.extend(instance_tags)
@@ -822,7 +822,7 @@ class TagClusterResources(TagClusterOperations):
822
822
  if not self.__validate_existing_tag(bucket_tags):
823
823
  add_tags = []
824
824
  instance_tags = self.__get_cluster_tags_by_instance_cluster(
825
- cluster_name=f'{self.cluster_prefix}{cluster_name}')
825
+ cluster_name=cluster_name)
826
826
  if not instance_tags:
827
827
  add_tags = self.__append_input_tags(bucket_tags)
828
828
  add_tags.extend(instance_tags)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloud-governance
3
- Version: 1.1.375
3
+ Version: 1.1.377
4
4
  Summary: Cloud Governance Tool
5
5
  Home-page: https://github.com/redhat-performance/cloud-governance
6
6
  Author: Red Hat
@@ -143,7 +143,7 @@ cloud_governance/common/utils/configs.py,sha256=shFxWt0Kc-GwzcZKYCkHm058ujwdTxn4
143
143
  cloud_governance/common/utils/json_datetime_encoder.py,sha256=_-jzRTe0UqAKTn2E9qaU8SYIxHUoRA5ElWuVA0Y54Xw,338
144
144
  cloud_governance/common/utils/utils.py,sha256=ZUsi4ax2XhDIV-EQ5kJt5Ppd72kmm2psqcg1cNDZrvc,4349
145
145
  cloud_governance/main/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
146
- cloud_governance/main/environment_variables.py,sha256=erhi9cVXRE4-jQ9pPKjj_q_ee38MHDoh9pCq8_nbTzY,29332
146
+ cloud_governance/main/environment_variables.py,sha256=ultgSpJ-WaFP4Q5Sh_pb0B_dfxxpity6mthioDUC7k8,29333
147
147
  cloud_governance/main/environment_variables_exceptions.py,sha256=UR0Ith0P0oshsDZdJRlRq8ZUTt0h8jFvUtrnP4m4AIY,437
148
148
  cloud_governance/main/es_uploader.py,sha256=6Ify5CS2NtUF1xXZ-rMwpYxVzDKfEZhv2vogWFltt98,10656
149
149
  cloud_governance/main/main.py,sha256=4TBiCBO_1z8KpGXb8brPKBmv3jHBl8fl_-Sb80ctYno,18880
@@ -167,7 +167,7 @@ cloud_governance/policy/aws/s3_inactive.py,sha256=NXUUGtJhpqohaWYczSebw-q0Q7RKg3
167
167
  cloud_governance/policy/aws/skipped_resources.py,sha256=D0kbt9dg6Bkl5PgGaqimWvLct6D-JOnerzJ0FkWzGFc,5679
168
168
  cloud_governance/policy/aws/spot_savings_analysis.py,sha256=lGG5qtz8pr7xjLo5BrtVSHGTz928MLwYPbSCaDfpTes,5513
169
169
  cloud_governance/policy/aws/unused_access_key.py,sha256=62_JaQMZLgnmYck0Brp8CTS1CvyRhwcNTXYmFjgWMoY,3542
170
- cloud_governance/policy/aws/zombie_cluster_resource.py,sha256=pwE8MypeqQfSQs--U1hbk5nk1M6x0R_NLs0x-wmOIjI,59626
170
+ cloud_governance/policy/aws/zombie_cluster_resource.py,sha256=Qkd5_Sh74cixaL7yiQgU1OvoEIfGmeKSECb5tNAnQ7I,59675
171
171
  cloud_governance/policy/aws/zombie_snapshots.py,sha256=V48cq4GCG2z-MRwUSE4b5wQcGeI_T1Ah99SiHlTwkvY,3834
172
172
  cloud_governance/policy/aws/cleanup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
173
173
  cloud_governance/policy/aws/cleanup/database_idle.py,sha256=-kITbr5yB1QAi65D6zRO0kdWH1CFPEyd86nJua-dNKM,3632
@@ -214,9 +214,9 @@ cloud_governance/policy/policy_operations/aws/dynamodb_upload_data/cloudtrail_to
214
214
  cloud_governance/policy/policy_operations/aws/dynamodb_upload_data/upload_data_to_dynamodb.py,sha256=6htSixTFRzKc2E8glsQom7uRpenNjmvaIKjb_sYH8ZE,2534
215
215
  cloud_governance/policy/policy_operations/aws/tag_cluster/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
216
216
  cloud_governance/policy/policy_operations/aws/tag_cluster/remove_cluster_tags.py,sha256=uNaDEvF4r8d9gcFpR29WbbWC5ezQSbtrNwe-_rSuemc,25603
217
- cloud_governance/policy/policy_operations/aws/tag_cluster/run_tag_cluster_resouces.py,sha256=3FF70eXrGkqRC1uZ-XaAfoydq5kViw6d_Aplv3G2GPw,5114
217
+ cloud_governance/policy/policy_operations/aws/tag_cluster/run_tag_cluster_resouces.py,sha256=08f661b6YlAsOOWq8YZvuA6wjkKw5jPOgi4BGQziOLc,5163
218
218
  cloud_governance/policy/policy_operations/aws/tag_cluster/tag_cluster_operations.py,sha256=uivH-ZBNS9eXId9EhSk8BVVx5tx5lTX6JZCoPuM6Jx0,3862
219
- cloud_governance/policy/policy_operations/aws/tag_cluster/tag_cluster_resouces.py,sha256=NrQcdeDqcSiRWnQMuZXu1XdoySLuoDuBSnn8XHOSxJg,44380
219
+ cloud_governance/policy/policy_operations/aws/tag_cluster/tag_cluster_resouces.py,sha256=aBDBrkUPILFDsu1z8v4aYmXdDJ-VXVdTaBvGS8hbvyE,44604
220
220
  cloud_governance/policy/policy_operations/aws/tag_non_cluster/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
221
221
  cloud_governance/policy/policy_operations/aws/tag_non_cluster/non_cluster_operations.py,sha256=PUWS0SE7T56BejBa3FRUK-txq70gVHztNAj1JmB-Ra0,9497
222
222
  cloud_governance/policy/policy_operations/aws/tag_non_cluster/remove_non_cluster_tags.py,sha256=d-RKpWSaZi2ALQaA9_MwqxHwzbSpsdyjQTBacJVoOLw,8362
@@ -264,8 +264,8 @@ cloud_governance/policy/policy_runners/elasticsearch/__init__.py,sha256=47DEQpj8
264
264
  cloud_governance/policy/policy_runners/elasticsearch/upload_elastic_search.py,sha256=pOwUJWXjJbyTy8iv3Ap8xJGnqQe-5lZgoR8-vGfAVos,1881
265
265
  cloud_governance/policy/policy_runners/ibm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
266
266
  cloud_governance/policy/policy_runners/ibm/policy_runner.py,sha256=V0E_f7F3hXit0aSq4BlfX1Jd4vjR2NEvOWsJ5upvZ4o,1302
267
- cloud_governance-1.1.375.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
268
- cloud_governance-1.1.375.dist-info/METADATA,sha256=44v-m73tFRCMJQQ9Rs2XIFKqhNYDpF7qEqJcFDiSWWs,11384
269
- cloud_governance-1.1.375.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
270
- cloud_governance-1.1.375.dist-info/top_level.txt,sha256=jfB1fgj7jvx3YZkZA4G6hFeS1RHO7J7XtnbjuMNMRww,17
271
- cloud_governance-1.1.375.dist-info/RECORD,,
267
+ cloud_governance-1.1.377.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
268
+ cloud_governance-1.1.377.dist-info/METADATA,sha256=8hNt339v8vASubbNd00-PGGKeq9WzNVv0cbVRkfX4uQ,11384
269
+ cloud_governance-1.1.377.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
270
+ cloud_governance-1.1.377.dist-info/top_level.txt,sha256=jfB1fgj7jvx3YZkZA4G6hFeS1RHO7J7XtnbjuMNMRww,17
271
+ cloud_governance-1.1.377.dist-info/RECORD,,