Skip to content

Commit

Permalink
RHINENG-13972 pcp generator server setup (#506)
Browse files Browse the repository at this point in the history
* RHINENG-13972 pcp generator server setup

* keep other clowdapp dependencies intact to keep IQE tests running
  • Loading branch information
r14chandra authored Nov 28, 2024
1 parent 28785f5 commit fc6d635
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 89 deletions.
57 changes: 21 additions & 36 deletions clowdapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,23 @@ objects:
optional: true
- name: BYPASS_UNLEASH
value: ${BYPASS_UNLEASH}


- name: pcp-generator
replicas: ${{PCP_GENERATOR_REPLICA_COUNT}}
podSpec:
image: ${IMAGE}:${IMAGE_TAG}
command: ["bash"]
args: ["-c", "python -m ros.processor.pcp_generator"]
resources:
requests:
cpu: ${CPU_REQUEST_ROSRHEL}
memory: ${MEMORY_REQUEST_ROSRHEL}
limits:
cpu: ${CPU_LIMIT_ROSRHEL}
memory: ${MEMORY_LIMIT_ROSRHEL}
env:
- name: CLOWDER_ENABLED
value: ${CLOWDER_ENABLED}
database:
name: ros
version: 13
Expand All @@ -246,40 +262,6 @@ objects:
testing:
iqePlugin: ros

jobs:
- name: org-id-populator
podSpec:
image: quay.io/cloudservices/tenant-utils:latest
command:
- ./org-id-column-populator
- -C
- -a
- account
- -o
- org_id
- -t
- rh_accounts
- --ean-translator-addr
- http://${TENANT_TRANSLATOR_HOST}:${TENANT_TRANSLATOR_PORT}
- --prometheus-push-addr
- ${PROMETHEUS_PUSHGATEWAY}
env:
- name: TENANT_TRANSLATOR_HOST
value: ${TENANT_TRANSLATOR_HOST}
- name: TENANT_TRANSLATOR_PORT
value: ${TENANT_TRANSLATOR_PORT}
- name: LOG_FORMAT
value: ${POPULATOR_LOG_FORMAT}
- name: LOG_BATCH_FREQUENCY
value: '1s'
resources:
limits:
cpu: 300m
memory: 1Gi
requests:
cpu: 50m
memory: 512Mi

parameters:
- description: Enable rbac needs to be "True" or "False"
name: ENABLE_RBAC
Expand All @@ -299,10 +281,13 @@ parameters:
- description: Replica count for garbage collector pod
name: GARBAGE_COLLECTOR_REPLICA_COUNT
value: "1"
- description: Replica count for pcp generator
name: PCP_GENERATOR_REPLICA_COUNT
value: "1"
- description: Image NAME
name: IMAGE
required: true
value: quay.io/redhat-services-prod/insights-management-tenant/insights-resource-optimization/ros-backend
value: quay.io/repository/cloudservices/ros-backend
- description: Image tag
name: IMAGE_TAG
required: true
Expand Down
1 change: 1 addition & 0 deletions ros/lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def build_endpoint_url(ep):
DAYS_UNTIL_STALE = int(os.getenv("DAYS_UNTIL_STALE", '45'))
CW_LOGGING_FORMAT = '%(asctime)s - %(levelname)s - %(funcName)s - %(message)s'
ROS_PROCESSOR_PORT = int(os.getenv("ROS_PROCESSOR_PORT", "8000"))
ROS_PCP_PROCESSOR_PORT = int(os.getenv("ROS_PCP_PROCESSOR_PORT", "8000"))
ROS_API_PORT = int(os.getenv("ROS_API_PORT", "8000"))
# Timeout in seconds to set against keys of deleted systems in a cache
CACHE_TIMEOUT_FOR_DELETED_SYSTEM = int(
Expand Down
53 changes: 0 additions & 53 deletions ros/processor/main.py

This file was deleted.

26 changes: 26 additions & 0 deletions ros/processor/pcp_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import time
from ros.lib.config import get_logger
from prometheus_client import start_http_server
from ros.lib.config import ROS_PCP_PROCESSOR_PORT


logging = get_logger(__name__)


class PCPGenerator:
def __init__(self):
pass

def run(self):
try:
logging.info("Flask server running on port %s", ROS_PCP_PROCESSOR_PORT)
while True:
time.sleep(1)
except Exception as err:
logging.error(err)


if __name__ == "__main__":
start_http_server(ROS_PCP_PROCESSOR_PORT)
processor = PCPGenerator()
processor.run()

0 comments on commit fc6d635

Please sign in to comment.