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-4407] Add service account support #471

Merged
merged 2 commits into from
Nov 6, 2023

Conversation

chambridge
Copy link
Contributor

@chambridge chambridge commented Nov 3, 2023

  • Add service account support as basic auth is becoming EOL

Test

In order to test checkout the branch.

  • Build the package make install
  • Create a service account
  • Add environment variables HCC_SERVICE_ACCOUNT_ID, HCC_SERVICE_ACCOUNT_SECRET, and HCC_TOKEN_URL (depending on your environment
  • Set your environment
  • Run a command to send OCP data to the service: nise report ocp --insights-upload https://console.redhat.com/api/ingress/v1/upload -s 2023-11-01 --ocp-cluster-id my-test-upload
  • Check listener logs:
[2023-11-03 15:50:09,594] INFO None 1 {'message': "Extracting Payload for msg: {'account': '', 'category': 'tar', 'content_type': 'application/vnd.redhat.hccm.tar+tgz', 'metadata': {'reporter': '', 'stale_timestamp': '0001-01-01T00:00:00Z'}, 'request_id': '09740dcb4f05418c84dd0cc6ccabebc6', 'principal': 'wwwww', 'org_id': 'yyyyyy', 'service': 'hccm', 'size': 974, 'url': 'https'
[2023-11-03 15:50:09,685] INFO None 1 {'message': 'Payload with the request id 09740dcb4f05418c84dd0cc6ccabebc6 from cluster my-test-upload is part of the report with manifest id 4e0e0dde-228e-4166-960f-de536237883e', 'tracing_id': '09740dcb4f05418c84dd0cc6ccabebc6', 'account': '', 'org_id': 'yyyyyyy', 'request_id': '09740dcb4f05418c84dd0cc6ccabebc6', 'cluster_id': 'my-test-upload', 'manifest_uuid': '4e0e0dde-228e-4166-960f-de536237883e'}
[2023-11-03 15:50:09,703] WARNING None 1 {'message': 'Recieved unexpected OCP report from my-test-upload', 'tracing_id': '4e0e0dde-228e-4166-960f-de536237883e', 'account': '', 'org_id': 'yyyyyy', 'request_id': '09740dcb4f05418c84dd0cc6ccabebc6', 'cluster_id': 'my-test-upload', 'manifest_uuid': '4e0e0dde-228e-4166-960f-de536237883e'}

Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Merging #471 (c2bd6d8) into main (4f82260) will decrease coverage by 0.1%.
The diff coverage is 94.7%.

@@           Coverage Diff           @@
##            main    #471     +/-   ##
=======================================
- Coverage   93.5%   93.5%   -0.1%     
=======================================
  Files         60      60             
  Lines       4603    4620     +17     
  Branches     660     662      +2     
=======================================
+ Hits        4306    4319     +13     
- Misses       156     157      +1     
- Partials     141     144      +3     

@chambridge chambridge force-pushed the add-service-account-support branch 2 times, most recently from 12f80f5 to 7ae475b Compare November 3, 2023 20:46
@chambridge chambridge requested a review from a team November 3, 2023 20:47
@chambridge chambridge marked this pull request as ready for review November 3, 2023 20:47
@djnakabaale
Copy link
Contributor

djnakabaale commented Nov 6, 2023

testing instructions look good to me, seeing logs in listener:

[2023-11-06 14:39:08,250] INFO None 1 {'message': "Extracting Payload for msg: {'account': '', 'category': 'tar', 'content_type': 'application/vnd.redhat.hccm.tar+tgz', 'metadata': {'reporter': '', 'stale_timestamp': '0001-01-01T00:00:00Z'}, 'request_id': '7af4b9d15a26426aa46059a7a5e8e70d', 'principal': '11009103', 'org_id': '11009103', 'service': 'hccm', 'size': 171702, 'url': 'https...'}}
[2023-11-06 14:39:08,355] INFO None 1 {'message': 'Payload with the request id 7af4b9d15a26426aa46059a7a5e8e70d from cluster my-test-upload is part of the report with manifest id efbef9fe-e5d0-491d-a05c-f3796bb3524e', 'tracing_id': '7af4b9d15a26426aa46059a7a5e8e70d', 'account': '', 'org_id': 'orgid', 'request_id': '7af4b9d15a26426aa46059a7a5e8e70d', 'cluster_id': 'my-test-upload', 'manifest_uuid': 'efbef9fe-e5d0-491d-a05c-f3796bb3524e'}
[2023-11-06 14:39:08,376] WARNING None 1 {'message': 'Recieved unexpected OCP report from my-test-upload', 'tracing_id': 'efbef9fe-e5d0-491d-a05c-f3796bb3524e', 'account': '', 'org_id': 'orgid', 'request_id': '7af4b9d15a26426aa46059a7a5e8e70d', 'cluster_id': 'my-test-upload', 'manifest_uuid': 'efbef9fe-e5d0-491d-a05c-f3796bb3524e'}

Copy link
Contributor

@djnakabaale djnakabaale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, one nitpick is to update the version number

@chambridge chambridge force-pushed the add-service-account-support branch from 618979e to 0df046e Compare November 6, 2023 14:57
* Add service account support as basic auth is becoming EOL
@chambridge chambridge force-pushed the add-service-account-support branch from 0df046e to 3a21df9 Compare November 6, 2023 14:59
@chambridge
Copy link
Contributor Author

Looks good to me, one nitpick is to update the version number

I've updated the version.

Copy link
Contributor

@djnakabaale djnakabaale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍🏾

@chambridge chambridge merged commit 6922975 into main Nov 6, 2023
4 checks passed
@chambridge chambridge deleted the add-service-account-support branch November 6, 2023 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants