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

SWATCH-1731: Refactor swatch-offering-sync Job to use curl and internal endpoint #2571

Merged
merged 1 commit into from Sep 29, 2023

Conversation

Sgitario
Copy link
Contributor

@Sgitario Sgitario commented Sep 27, 2023

Jira issue: SWATCH-1731

Description

For all cronjobs defined in clowdapps, we should migrate to using k8s cronjobs w/ curl against internal endpoints.

Testing

Confirm that the endpoint is executed every day at 2:00.
Alternatively, you can deploy the application and overwrite the OFFERING_SYNC_SCHEDULE environment property with OFFERING_SYNC_SCHEDULE=*/5 * * * * (every 5 min).
Another option is to directly alter the CronJob resource that is generated when installing the Clowd app. The CronJob to modify is named "swatch-subscription-sync-offering-sync".

In the logs of the job created, you should see:

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0100 59 100 59 0 0 34 0 0:00:01 0:00:01 --:--:-- 34100 59 100 59 0 0 34 0 0:00:01 0:00:01 --:--:-- 34
{"detail":"Enqueued 4 numProducts offerings to be synced."}

And in the logs of the swatch-subscription-sync-service:

2023-09-27 05:25:03,203 [thread=http-nio-8000-exec-1] [INFO ] [org.candlepin.subscriptions.security.LogPrincipalFilter] self- Internal API: /api/rhsm-subscriptions/v1/internal/rpc/offerings/sync requested by user: self
2023-09-27 05:25:03,474 [thread=http-nio-8000-exec-1] [INFO ] [org.candlepin.subscriptions.capacity.admin.InternalSubscriptionResource] self- Sync all offerings triggered by self
2023-09-27 05:25:04,493 [thread=http-nio-8000-exec-1] [INFO ] [org.candlepin.subscriptions.product.OfferingSyncController] self- Enqueued numOfferingSyncTasks=4 to sync offerings from upstream in enqueueTimeMillis=1019

So, the call was made and we confirmed that the service processed it.

@Sgitario Sgitario marked this pull request as ready for review September 27, 2023 05:30
@Sgitario Sgitario added the QE Pull request should be approved by QE before merge label Sep 27, 2023
@kflahert
Copy link
Contributor

/retest

@kflahert kflahert self-assigned this Sep 27, 2023
@ssidhaye ssidhaye self-requested a review September 28, 2023 06:31
@ssidhaye
Copy link

After modifying cron schedule for swatch-subscription-sync-offering-sync job , I am able to see correct log messages in swatch-subscription-sync-service logs

2023-09-28 06:45:02,459 [thread=http-nio-8000-exec-1] [INFO ] [org.candlepin.subscriptions.security.LogPrincipalFilter] self- Internal API: /api/rhsm-subscriptions/v1/internal/rpc/offerings/sync requested by user: self
2023-09-28 06:45:02,527 [thread=http-nio-8000-exec-1] [INFO ] [org.candlepin.subscriptions.capacity.admin.InternalSubscriptionResource] self- Sync all offerings triggered by self
2023-09-28 06:45:03,021 [thread=http-nio-8000-exec-1] [INFO ] [org.candlepin.subscriptions.product.OfferingSyncController] self- Enqueued numOfferingSyncTasks=4 to sync offerings from upstream in enqueueTimeMillis=493

@ssidhaye
Copy link

/retest

@ssidhaye
Copy link

/retest

@Sgitario Sgitario merged commit f2bf2d2 into RedHatInsights:main Sep 29, 2023
10 checks passed
@Sgitario Sgitario deleted the SWATCH-1731 branch September 29, 2023 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QE Pull request should be approved by QE before merge
Projects
None yet
3 participants