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

[COST-4947] Remove account and region from ProviderInfrastructureMap filter #5049

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

cgoodfred
Copy link
Contributor

@cgoodfred cgoodfred commented Apr 18, 2024

Jira Ticket

COST-4947

Description

This change will remove account and region from the filter for ProviderInfrastructureMap objects when setting infrastructure on a provider object.

Testing

  1. Checkout Main
  2. Restart Koku
  3. Create test customer data: make create-test-customer
  4. Create a ProviderInfrastructureMap record for your cloud provider source (i chose AWS) replacing your UUID.
INSERT INTO api_providerinfrastructuremap (infrastructure_provider_id, infrastructure_type, infrastructure_account, infrastructure_region) VALUES ('90d1a57d-74f0-4818-9d0a-5e4a5855ee03', 'AWS', '', '');
  1. Load the test customer data that goes with your cloud source.
  2. Check the logs for the messages about a cluster running on infrastructure like below:
koku-worker-1  | [2024-04-17 13:48:16,800] INFO a3c1b718-51b8-42ba-baae-f483c1c91a24 42 {'message': 'checking if OCP cluster is running on cloud infrastructure', 'tracing_id': '', 'schema': 'org1234567', 'provider_uuid': 'd03a9693-106d-43f5-a9d5-0540a33c11a6', 'cluster_id': 'my-ocp-cluster-1', 'cluster_alias': 'Test OCP on AWS'}
...
koku-worker-1  | [2024-04-17 13:48:17,060] INFO a3c1b718-51b8-42ba-baae-f483c1c91a24 42 {'message': 'executing trino sql', 'tracing_id': '', 'schema': 'org1234567', 'start_date': datetime.date(2024, 4, 1), 'end_date': datetime.date(2024, 4, 17), 'log_ref': 'reporting_ocpinfrastructure_provider_map.sql'}
...
koku-worker-1  | [2024-04-17 13:48:17,628] INFO a3c1b718-51b8-42ba-baae-f483c1c91a24 42 {'message': 'OCP cluster is running on cloud infrastructure', 'tracing_id': '', 'schema': 'org1234567', 'provider_uuid': 'd03a9693-106d-43f5-a9d5-0540a33c11a6', 'cluster_id': 'my-ocp-cluster-1', 'cluster_alias': 'Test OCP on AWS', 'ocp_provider_uuid': 'd03a9693-106d-43f5-a9d5-0540a33c11a6', 'infra_provider_uuid': '90d1a57d-74f0-4818-9d0a-5e4a5855ee03', 'infra_provider_type': 'AWS-local'}
  1. Go to the sources endpoint and view your cluster and verify it DOES NOT show an infrastructure for the cluster.
  2. Checkout this branch
  3. Repeat steps 5 and 6, this time when you go to the sources endpoint you will notice the cluster HAS been updated with the correct infrastructure.

Release Notes

  • proposed release note
* [COST-4947](https://issues.redhat.com/browse/COST-4947) Remove account and region from ProviderInfrastructureMap filter so an OCP provider can correctly be correlated to its infrastructure if region and account don't match.

@cgoodfred cgoodfred self-assigned this Apr 18, 2024
@cgoodfred cgoodfred added the smoke-tests pr_check will build the image and run minimal required smokes label Apr 18, 2024
Copy link

codecov bot commented Apr 18, 2024

Codecov Report

Merging #5049 (3336539) into main (42ed192) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #5049   +/-   ##
=====================================
  Coverage   94.1%   94.1%           
=====================================
  Files        377     377           
  Lines      31331   31331           
  Branches    3714    3714           
=====================================
  Hits       29493   29493           
  Misses      1172    1172           
  Partials     666     666           

@cgoodfred cgoodfred marked this pull request as ready for review April 18, 2024 13:20
@cgoodfred cgoodfred requested review from a team as code owners April 18, 2024 13:20
@cgoodfred cgoodfred merged commit 860ba12 into main Apr 18, 2024
11 checks passed
@cgoodfred cgoodfred deleted the COST-4947-inframap-region-account-filter branch April 18, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
smoke-tests pr_check will build the image and run minimal required smokes smokes-required
Projects
None yet
2 participants