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
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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,6 @@ Service that syncs system data from Hosted Candlepin into HBI.
| 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 |
| offering-sync | platform.rhsm-subscriptions.offering-sync | swatch-subscription-sync-offering |
| capacity-ingress | platform.rhsm-subscriptions.subscription-sync | swatch-subscriptions-sync |
| capacity-ingress | platform.rhsm-subscriptions.offering-sync | swatch-subscriptions-sync |
| capacity-ingress | platform.rhsm-subscriptions.capacity-reconcile | swatch-subscriptions-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.OfferingSyncConfiguration;
import org.candlepin.subscriptions.tally.job.SubscriptionSyncConfiguration;
import org.candlepin.subscriptions.task.TaskQueueProperties;
import org.candlepin.subscriptions.user.UserServiceClientConfiguration;
Expand Down Expand Up @@ -81,7 +80,6 @@
SubscriptionSyncConfiguration.class,
CapacityReconciliationWorkerConfiguration.class,
OfferingWorkerConfiguration.class,
OfferingSyncConfiguration.class,
DevModeConfiguration.class,
SecurityConfiguration.class,
MeteringConfiguration.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 @@ -43,7 +43,6 @@ rhsm-subscriptions:
purge-events-schedule: ${PURGE_EVENTS_SCHEDULE:0 0 1 * * ?}
metering-schedule: ${METERING_SCHEDULE:0 30 * * * ?}
subscription-sync-schedule: ${SUBSCRIPTION_SYNC_SCHEDULE:0 0 10 * * ?}
offering-sync-schedule: ${OFFERING_SYNC_SCHEDULE:0 0 2 * * ?}
account-batch-size: ${ACCOUNT_BATCH_SIZE:1}
product-denylist-resource-location: ${PRODUCT_DENYLIST_RESOURCE_LOCATION:}
metering:
Expand Down

This file was deleted.

147 changes: 23 additions & 124 deletions swatch-subscription-sync/deploy/clowdapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ parameters:
value: '3'
- name: KAFKA_SUBSCRIPTIONS_PRUNE_PARTITIONS
value: '3'
- name: CURL_CRON_IMAGE
value: quay.io/app-sre/ubi8-ubi-minimal
- name: CURL_CRON_IMAGE_TAG
value: latest
- name: CURL_CRON_MEMORY_REQUEST
value: 500Mi
- name: CURL_CRON_MEMORY_LIMIT
value: 800Mi
- name: CURL_CRON_CPU_REQUEST
value: 350m
- name: CURL_CRON_CPU_LIMIT
value: 500m
- name: OTEL_SERVICE_NAME
value: swatch-subscription-sync
- name: OTEL_JAVAAGENT_ENABLED
Expand Down Expand Up @@ -601,134 +613,21 @@ objects:
successfulJobsHistoryLimit: 2
restartPolicy: Never
podSpec:
image: ${IMAGE}:${IMAGE_TAG}
initContainers:
- env:
- name: SPRING_PROFILES_ACTIVE
value: liquibase-only
inheritEnv: true
resources:
requests:
cpu: ${CPU_REQUEST}
memory: ${MEMORY_REQUEST}
limits:
cpu: ${CPU_LIMIT}
memory: ${MEMORY_LIMIT}
image: ${CURL_CRON_IMAGE}:${CURL_CRON_IMAGE_TAG}
command:
- /usr/bin/bash
- -c
- >
/usr/bin/curl --fail -H "Origin: https://swatch-subscription-sync-service.redhat.com" -H "x-rh-swatch-psk: ${SWATCH_SELF_PSK}" -X PUT "http://swatch-subscription-sync-service:8000/api/rhsm-subscriptions/v1/internal/rpc/offerings/sync"
env:
- 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: offering-sync,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: PRODUCT_DENYLIST_RESOURCE_LOCATION
value: file:/capacity-denylist/product-denylist.txt
- name: DATABASE_HOST
valueFrom:
secretKeyRef:
name: ${DB_POD}-db
key: db.host
- name: DATABASE_PORT
valueFrom:
secretKeyRef:
name: ${DB_POD}-db
key: db.port
- name: DATABASE_USERNAME
valueFrom:
secretKeyRef:
name: ${DB_POD}-db
key: db.user
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: ${DB_POD}-db
key: db.password
- name: DATABASE_DATABASE
valueFrom:
secretKeyRef:
name: ${DB_POD}-db
key: db.name
- 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}
resources:
requests:
cpu: ${CPU_REQUEST}
memory: ${MEMORY_REQUEST}
limits:
cpu: ${CPU_LIMIT}
memory: ${MEMORY_LIMIT}
volumeMounts:
- name: logs
mountPath: /logs
- name: capacity-denylist
mountPath: /capacity-denylist
volumes:
- name: logs
emptyDir:
- name: capacity-denylist
configMap:
name: capacity-denylist
value: offering-sync

- apiVersion: v1
kind: Secret
Expand Down