Skip to content

Commit 456e0df

Browse files
committed
RHINENG-21216: add new evaluator - user-evaluation
1 parent 2fc127a commit 456e0df

7 files changed

Lines changed: 111 additions & 3 deletions

File tree

conf/evaluator_upload.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
EVAL_TOPIC=patchman.evaluator.upload
2+
3+
POD_CONFIG=label=upload

conf/evaluator_user_evaluation.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
EVAL_TOPIC=patchman.evaluator.user-evaluation
2+
3+
POD_CONFIG=label=user-evaluation

deploy/clowdapp.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,52 @@ objects:
258258
resources:
259259
limits: {cpu: '${CPU_LIMIT_EVALUATOR_RECALC}', memory: '${MEM_LIMIT_EVALUATOR_RECALC}'}
260260
requests: {cpu: '${CPU_REQUEST_EVALUATOR_RECALC}', memory: '${MEM_REQUEST_EVALUATOR_RECALC}'}
261+
262+
- name: evaluator-user-evaluation
263+
replicas: ${{REPLICAS_EVALUATOR_USER_EVALUATION}}
264+
webServices:
265+
public:
266+
enabled: true
267+
private:
268+
enabled: true
269+
metrics:
270+
enabled: true
271+
podSpec:
272+
image: ${IMAGE}:${IMAGE_TAG}
273+
initContainers:
274+
- name: check-for-db
275+
image: ${IMAGE}:${IMAGE_TAG}
276+
command:
277+
- ./database_admin/check-upgraded.sh
278+
env:
279+
- {name: POD_CONFIG, value: '${DATABASE_ADMIN_CONFIG}'}
280+
command:
281+
- ./scripts/entrypoint.sh
282+
- evaluator
283+
env:
284+
- {name: LOG_LEVEL, value: '${LOG_LEVEL_EVALUATOR_USER_EVALUATION}'}
285+
- {name: GIN_MODE, value: '${GIN_MODE}'}
286+
- {name: SHOW_CLOWDER_VARS, value: ''}
287+
- {name: DB_DEBUG, value: '${DB_DEBUG_EVALUATOR_USER_EVALUATION}'}
288+
- {name: DB_USER, value: evaluator}
289+
- {name: DB_PASSWD, valueFrom: {secretKeyRef: {name: patchman-engine-database-passwords,
290+
key: evaluator-database-password}}}
291+
- {name: KAFKA_GROUP, value: patchman}
292+
- {name: KAFKA_READER_MAX_ATTEMPTS, value: '${KAFKA_READER_MAX_ATTEMPTS}'}
293+
- {name: KAFKA_WRITER_MAX_ATTEMPTS, value: '${KAFKA_WRITER_MAX_ATTEMPTS}'}
294+
- {name: EVAL_TOPIC, value: patchman.evaluator.user-evaluation}
295+
- {name: PAYLOAD_TRACKER_TOPIC, value: platform.payload-status}
296+
- {name: REMEDIATIONS_UPDATE_TOPIC, value: 'platform.remediation-updates.patch'}
297+
- {name: NOTIFICATIONS_TOPIC, value: 'platform.notifications.ingress'}
298+
- {name: SSL_CERT_DIR, value: '${SSL_CERT_DIR}'}
299+
- {name: GOGC, value: '${GOGC}'} # set garbage collection limit for go 1.18
300+
- {name: ENABLE_PROFILER, value: '${ENABLE_PROFILER_EVALUATOR_USER_EVALUATION}'}
301+
- {name: GOMEMLIMIT, value: '${GOMEMLIMIT_EVALUATOR}'}
302+
- {name: POD_CONFIG, value: 'label=user-evaluation;${EVALUATOR_USER_EVALUATION_CONFIG}'}
303+
- {name: CONSOLEDOT_HOSTNAME, value: '${CONSOLEDOT_HOSTNAME}'}
304+
resources:
305+
limits: {cpu: '${CPU_LIMIT_EVALUATOR_USER_EVALUATION}', memory: '${MEM_LIMIT_EVALUATOR_USER_EVALUATION}'}
306+
requests: {cpu: '${CPU_REQUEST_EVALUATOR_USER_EVALUATION}', memory: '${MEM_REQUEST_EVALUATOR_USER_EVALUATION}'}
261307

262308
jobs:
263309
- name: vmaas-sync
@@ -675,6 +721,17 @@ parameters:
675721
- {name: ENABLE_PROFILER_EVALUATOR_RECALC, value: 'false'}
676722
- {name: EVALUATOR_RECALC_CONFIG, value: ''}
677723

724+
# Evaluator - user evaluation
725+
- {name: REPLICAS_EVALUATOR_USER_EVALUATION, value: '1'}
726+
- {name: LOG_LEVEL_EVALUATOR_USER_EVALUATION, value: debug}
727+
- {name: DB_DEBUG_EVALUATOR_USER_EVALUATION, value: 'false'}
728+
- {name: CPU_LIMIT_EVALUATOR_USER_EVALUATION, value: '2'}
729+
- {name: MEM_LIMIT_EVALUATOR_USER_EVALUATION, value: 3000Mi}
730+
- {name: CPU_REQUEST_EVALUATOR_USER_EVALUATION, value: '1'}
731+
- {name: MEM_REQUEST_EVALUATOR_USER_EVALUATION, value: 1500Mi}
732+
- {name: ENABLE_PROFILER_EVALUATOR_USER_EVALUATION, value: 'false'}
733+
- {name: EVALUATOR_USER_EVALUATION_CONFIG, value: ''}
734+
678735
# JOBS
679736
- {name: LOG_LEVEL_JOBS, value: debug}
680737
- {name: DB_DEBUG_JOBS, value: 'false'}

docker-compose.prod.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3.4'
1+
version: "3.4"
22

33
services:
44
db:
@@ -175,6 +175,27 @@ services:
175175
security_opt:
176176
- label=disable
177177

178+
evaluator_user_evaluation:
179+
container_name: evaluator_user_evaluation
180+
image: patchman-engine-app
181+
env_file:
182+
- ./conf/common.env
183+
- ./conf/evaluator_common.env
184+
- ./conf/evaluator_user_evaluation.env
185+
command: ./dev/scripts/docker-compose-entrypoint.sh evaluator
186+
ports:
187+
- 8086:8080
188+
- 9006:9000 # private port - pprof
189+
depends_on:
190+
- db
191+
- platform
192+
volumes:
193+
- ./dev:/go/src/app/dev
194+
- ./dev/database/secrets:/opt/postgresql
195+
- ./dev/kafka/secrets:/opt/kafka
196+
security_opt:
197+
- label=disable
198+
178199
vmaas_sync:
179200
container_name: vmaas_sync
180201
image: patchman-engine-app

docker-compose.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3.4'
1+
version: "3.4"
22

33
services:
44
db:
@@ -170,6 +170,26 @@ services:
170170
security_opt:
171171
- label=disable
172172

173+
evaluator_user_evaluation:
174+
container_name: evaluator_user_evaluation
175+
image: patchman-engine-app
176+
env_file:
177+
- ./conf/common.env
178+
- ./conf/evaluator_common.env
179+
- ./conf/evaluator_user_evaluation.env
180+
- ./conf/gorun.env
181+
command: ./dev/scripts/docker-compose-entrypoint.sh evaluator
182+
ports:
183+
- 8086:8080
184+
- 9006:9000 # private port - pprof
185+
depends_on:
186+
- db
187+
- platform
188+
volumes:
189+
- ./:/go/src/app
190+
security_opt:
191+
- label=disable
192+
173193
vmaas_sync:
174194
container_name: vmaas_sync
175195
image: patchman-engine-app

docs/md/architecture.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ See [component environment variables](../../conf/evaluator_upload.env)
3535
table). After this event all registered systems have to be re-evaluated because the input data for the system evaluation
3636
has changed. See [component environment variables](../../conf/evaluator_recalc.env)
3737

38+
- **evaluator-user-evaluation** - same as the `-upload` instance, but listens for re-evaluation requests from the `manager`
39+
component when user adds system to the template (`patchman.evaluator.user-evaluation` topic). The requests are separated
40+
as when there is a heavy load from inventory at the time it may take very long for systems to be recalculated/updated.
41+
See [component environment variables](../../conf/evaluator_user_evaluation.env)
42+
3843
- **vmaas-sync** - connects to [VMaaS](https://github.com/RedHatInsights/vmaas), and upon receiving notification about
3944
updated data, syncs new advisories into the database, and requests re-evaluation for systems which could be affected by
4045
new advisories. It's done via messaging to the `patchman.evaluator.recalc` Kafka topic and receiving by the

scripts/check-dockercomposes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ sed \
99
-e "s|INSTALL_TOOLS=yes|INSTALL_TOOLS=no|" \
1010
-e "s|target: buildimg|target: runtimeimg|" \
1111
-e "/ - \.\/conf\/gorun.env/ d" \
12-
-e "/ \(db_admin\|db_feed\|manager\|listener\|evaluator_recalc\|evaluator_upload\|vmaas_sync\|admin\|migrate_system_package2\):/,/^$/ {
12+
-e "/ \(db_admin\|db_feed\|manager\|listener\|evaluator_recalc\|evaluator_upload\|evaluator_user_evaluation\|vmaas_sync\|admin\|migrate_system_package2\):/,/^$/ {
1313
s/- \.\/:\/go\/src\/app/- \.\/dev:\/go\/src\/app\/dev\n\
1414
- .\/dev\/database\/secrets:\/opt\/postgresql\n\
1515
- \.\/dev\/kafka\/secrets:\/opt\/kafka/

0 commit comments

Comments
 (0)