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-1730: Refactor swatch-tally-hourly Job to use curl and internal endpoint #2545

Merged
merged 1 commit into from
Sep 26, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ We have a number of profiles. Each profile activates a subset of components in t

- `api`: Run the user-facing API
- `capacity-ingress`: Run the internal only capacity ingress API
- `capture-hourly-snapshots`: Run the tally job for hourly snapshots
- `kafka-queue`: Run with a kafka queue (instead of the default in-memory queue)
- `liquibase-only`: Run the Liquibase migrations and stop
- `rh-marketplace`: Run the worker responsible for processing tally summaries and
Expand Down Expand Up @@ -667,7 +666,6 @@ Service that syncs system data from Hosted Candlepin into HBI.
| worker | platform.rhsm-subscriptions.billable-usage | swatch-tally |
| worker | platform.rhsm-subscriptions.service-instance-ingress | swatch-tally |
| purge-snapshots | | |
| capture-hourly-snapshots | platform.rhsm-subscriptions.tasks | swatch-tally-hourly |
| rh-marketplace | platform.rhsm-subscriptions.billable-usage | swatch-producer-red-hat-marketplace |
| | platform.rhsm-subscriptions.billable-usage | swatch-producer-aws |
| subscription-sync | platform.rhsm-subscriptions.subscription-sync | swatch-subscription-sync-sync |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import org.candlepin.subscriptions.subscription.SubscriptionServiceConfiguration;
import org.candlepin.subscriptions.subscription.SubscriptionWorkerConfiguration;
import org.candlepin.subscriptions.tally.TallyWorkerConfiguration;
import org.candlepin.subscriptions.tally.job.CaptureHourlySnapshotsConfiguration;
import org.candlepin.subscriptions.tally.job.OfferingSyncConfiguration;
import org.candlepin.subscriptions.tally.job.SubscriptionSyncConfiguration;
import org.candlepin.subscriptions.task.TaskQueueProperties;
Expand All @@ -75,7 +74,6 @@
@Import({
ApiConfiguration.class,
CapacityIngressConfiguration.class,
CaptureHourlySnapshotsConfiguration.class,
LiquibaseUpdateOnlyConfiguration.class,
TallyWorkerConfiguration.class,
RhMarketplaceWorkerConfiguration.class,
Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ spring:

rhsm-subscriptions:
jobs:
capture-hourly-snapshot-schedule: ${CAPTURE_HOURLY_SNAPSHOT_SCHEDULE:0 0 * * * ?}
purge-snapshot-schedule: ${PURGE_SNAPSHOT-SCHEDULE:0 0 1 * * ?}
purge-events-schedule: ${PURGE_EVENTS_SCHEDULE:0 0 1 * * ?}
metering-schedule: ${METERING_SCHEDULE:0 30 * * * ?}
Expand Down

This file was deleted.

109 changes: 15 additions & 94 deletions swatch-tally/deploy/clowdapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -483,107 +483,28 @@ objects:
successfulJobsHistoryLimit: 2
restartPolicy: Never
podSpec:
image: ${IMAGE}:${IMAGE_TAG}
initContainers:
- env:
- name: JAVA_DEBUG
value: ${JAVA_DEBUG}
- name: SPRING_PROFILES_ACTIVE
value: liquibase-only
inheritEnv: true
resources:
requests:
cpu: ${CPU_REQUEST}
memory: ${JOB_MEMORY_REQUEST}
limits:
cpu: ${CPU_LIMIT}
memory: ${JOB_MEMORY_LIMIT}
image: ${CURL_CRON_IMAGE}:${CURL_CRON_IMAGE_TAG}
command:
- /usr/bin/bash
- -c
- >
/usr/bin/curl --fail -H "Origin: https://swatch-tally-service.redhat.com" -H "x-rh-swatch-psk: ${SWATCH_SELF_PSK}" -X PUT "http://swatch-tally-service:8000/api/rhsm-subscriptions/v1/internal/rpc/tally/snapshots"
env:
- name: JAVA_DEBUG
value: ${JAVA_DEBUG}
- name: ENABLE_SPLUNK_HEC
value: ${ENABLE_SPLUNK_HEC}
- name: SPLUNKMETA_namespace
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
- name: SPLUNKMETA_host
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: SPLUNK_HEC_URL
value: ${SPLUNK_HEC_URL}
- name: SPLUNK_HEC_TOKEN
- name: SWATCH_SELF_PSK
valueFrom:
secretKeyRef:
name: splunk-hec-external
key: token
- name: SPLUNK_SOURCE
value: ${SPLUNK_SOURCE}
- name: SPLUNK_SOURCE_TYPE
value: ${SPLUNK_SOURCE_TYPE}
- name: SPLUNK_MESSAGE_FORMAT
value: ${SPLUNK_MESSAGE_FORMAT}
- name: SPLUNK_HEC_CONNECT_TIMEOUT
value: ${SPLUNK_HEC_CONNECT_TIMEOUT}
- name: SPLUNK_HEC_BATCH_SIZE
value: ${SPLUNK_HEC_BATCH_SIZE}
- name: SPLUNK_HEC_TERMINATION_TIMEOUT
value: ${SPLUNK_HEC_TERMINATION_TIMEOUT}
name: swatch-psks
key: self
# This env property is necessary to pass the test check.
- name: SPRING_PROFILES_ACTIVE
value: capture-hourly-snapshots,kafka-queue
- name: JAVA_MAX_MEM_RATIO
value: '85'
- name: GC_MAX_METASPACE_SIZE
value: '256'
- name: LOG_FILE
value: /logs/server.log
- name: LOGGING_LEVEL_ROOT
value: ${LOGGING_LEVEL_ROOT}
- name: LOGGING_LEVEL_ORG_CANDLEPIN
value: ${LOGGING_LEVEL}
- name: INVENTORY_DATABASE_HOST
valueFrom:
secretKeyRef:
name: ${INVENTORY_SECRET_KEY_NAME}
key: db.host
- name: INVENTORY_DATABASE_DATABASE
valueFrom:
secretKeyRef:
name: ${INVENTORY_SECRET_KEY_NAME}
key: ${INVENTORY_SECRET_KEY_NAME_PREFIX}name
- name: INVENTORY_DATABASE_USERNAME
valueFrom:
secretKeyRef:
name: ${INVENTORY_SECRET_KEY_NAME}
key: db.user
- name: INVENTORY_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: ${INVENTORY_SECRET_KEY_NAME}
key: ${INVENTORY_SECRET_KEY_NAME_PREFIX}password
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: ${OTEL_EXPORTER_OTLP_ENDPOINT}
- name: OTEL_SERVICE_NAME
value: ${OTEL_SERVICE_NAME}
- name: OTEL_JAVAAGENT_ENABLED
value: ${OTEL_JAVAAGENT_ENABLED}
value: capture-hourly-snapshots
resources:
requests:
cpu: ${CPU_REQUEST}
memory: ${JOB_MEMORY_REQUEST}
cpu: ${CURL_CRON_CPU_REQUEST}
memory: ${CURL_CRON_MEMORY_REQUEST}
limits:
cpu: ${CPU_LIMIT}
memory: ${JOB_MEMORY_LIMIT}
volumeMounts:
- name: logs
mountPath: /logs
volumes:
- name: logs
emptyDir:
machinePool: ${JOB_MACHINE_POOL}
cpu: ${CURL_CRON_CPU_LIMIT}
memory: ${CURL_CRON_MEMORY_LIMIT}

- name: purge
schedule: ${PURGE_SNAPSHOT_SCHEDULE}
Expand Down