Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for Openstack #403

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ PCW has three main flows :
c. Volumes in all regions defined
d. VPC's ( deletion of VPC means deletion of all assigned to VPC entities first ( security groups , networks etc. ))
- For GCE deleting disks, images & network resources (check details in [ocw/lib/gce.py](ocw/lib/gce.py))
- For Openstack deleting instances, images & keypairs (check details in [ocw/lib/openstack.py](ocw/lib/openstack.py)
3. **Dump entities quantity ( implemented in [ocw/lib/dumpstate.py](ocw/lib/dumpstate.py) )**. To be able to react fast on possible bugs in PCW and/or unexpected creation of many resources there is ability to dump real time data from each CSP into defined InfluxDB instance. This allow building real-time dashboards and/or setup notification flow.


Expand All @@ -55,7 +54,7 @@ Configuration of PCW happens via a global config file in `/etc/pcw.ini`. See [te

### CSP credentials
To be able to connect to CSP PCW needs Service Principal details. Depending on namespaces defined in `pcw.ini` PCW will expect some JSON files to be created
under `/var/pcw/[namespace name]/[Azure/EC2/GCE/Openstack].json`. See [templates/var/example_namespace/](templates/var/example_namespace/) for examples.
under `/var/pcw/[namespace name]/[Azure/EC2/GCE].json`. See [templates/var/example_namespace/](templates/var/example_namespace/) for examples.

PCW supports email notifications about left-over instances. See the `notify` section therein and their corresponding comments.

Expand Down
3 changes: 0 additions & 3 deletions ocw/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class ProviderChoice(ChoiceEnum):
GCE = 'Google'
EC2 = 'EC2'
AZURE = 'Azure'
OSTACK = 'Openstack'

@staticmethod
def from_str(provider):
Expand All @@ -30,8 +29,6 @@ def from_str(provider):
return ProviderChoice.EC2
if provider.upper() == ProviderChoice.AZURE:
return ProviderChoice.AZURE
if provider.upper() == ProviderChoice.OSTACK:
return ProviderChoice.OSTACK
raise ValueError(f"{provider} is not convertable to ProviderChoice")


Expand Down
4 changes: 0 additions & 4 deletions ocw/lib/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from ocw.lib.azure import Azure
from ocw.lib.ec2 import EC2
from ocw.lib.gce import GCE
from ocw.lib.openstack import Openstack
from ocw.lib.eks import EKS
from ocw.lib.emailnotify import send_mail, send_cluster_notification
from ocw.enums import ProviderChoice
Expand All @@ -26,9 +25,6 @@ def cleanup_run():
if ProviderChoice.GCE in providers:
GCE(namespace).cleanup_all()

if ProviderChoice.OSTACK in providers:
Openstack(namespace).cleanup_all()

except Exception as ex:
logger.exception("[%s] Cleanup failed!", namespace)
send_mail(f'{type(ex).__name__} on Cleanup in [{namespace}]', traceback.format_exc())
Expand Down
116 changes: 0 additions & 116 deletions ocw/lib/openstack.py

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ oauth2client
google-api-python-client==2.131.0
google-cloud-storage==2.16.0
openqa_client
openstacksdk~=3.1.0
python-dateutil
apscheduler
kubernetes
Expand Down
6 changes: 0 additions & 6 deletions templates/pcw.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ ec2-max-age-days = 1
gce-skip-networks = default,tf-network
# Max age of data storage resources ( used in Azure and GCE )
max-age-hours = 1
# Max age for images in Openstack
openstack-image-max-age-days = 3
# Max age for VM's in Openstack
openstack-vm-max-age-days = 1
# Max age for keys in Openstack
openstack-key-max-days = 1
# Specify with which namespace, we will do the cleanup.
# if not specifed default/namespaces list will be taken instead
namespaces = qac, sapha
Expand Down
181 changes: 0 additions & 181 deletions tests/test_openstack.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_pcwconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_get_namespaces_for_feature_default_feature_exists_namespace_in_feature(
def test_get_providers_for_not_existed_feature(pcw_file):
providers = PCWConfig.get_providers_for('get_providers_for', 'not_existent')
assert type(providers) is list
assert not {'EC2', 'AZURE', 'GCE', 'OSTACK'} ^ set(providers)
assert not {'EC2', 'AZURE', 'GCE'} ^ set(providers)


def test_get_providers_for_existed_feature(pcw_file):
Expand Down
5 changes: 1 addition & 4 deletions webui/PCWConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ def get_feature_property(feature: str, feature_property: str, namespace: str | N
'cleanup/ec2-max-age-days': {'default': -1, 'return_type': int},
'cleanup/gce-bucket': {'default': None, 'return_type': str},
'cleanup/max-age-hours': {'default': 24 * 7, 'return_type': int},
'cleanup/openstack-image-max-age-days': {'default': 3, 'return_type': int},
'cleanup/openstack-vm-max-age-days': {'default': 1, 'return_type': int},
'cleanup/openstack-key-max-days': {'default': 1, 'return_type': int},
'updaterun/default_ttl': {'default': 44400, 'return_type': int},
'notify/to': {'default': None, 'return_type': str},
'notify/age-hours': {'default': 12, 'return_type': int},
Expand Down Expand Up @@ -94,7 +91,7 @@ def get_namespaces_for(feature: str) -> list:
@staticmethod
def get_providers_for(feature: str, namespace: str):
return ConfigFile().getList(f'{feature}.namespace.{namespace}/providers',
ConfigFile().getList(f'{feature}/providers', ['EC2', 'AZURE', 'GCE', 'OSTACK']))
ConfigFile().getList(f'{feature}/providers', ['EC2', 'AZURE', 'GCE']))

@staticmethod
def get_k8s_clusters_for_provider(namespace: str, provider: str) -> list:
Expand Down