Configuration
Table of contents
- Clowder configuration
- Broker configuration
- Server configuration
- CloudWatch configuration
- Storage configuration
- Redis configuration
- Metrics configuration
Configuration is done by toml config, default one is config.toml in working directory,
but it can be overwritten by INSIGHTS_RESULTS_AGGREGATOR_CONFIG_FILE env var.
Also each key in config can be overwritten by corresponding env var. For example if you have config
[ocp_recommendations_storage]
db_driver = "postgres"
pg_username = "user"
pg_password = "password"
pg_host = "localhost"
pg_port = 5432
pg_db_name = "aggregator"
pg_params = ""
type = "sql"
and environment variables
INSIGHTS_RESULTS_AGGREGATOR__OCP_RECOMMENDATIONS_STORAGE__DB_DRIVER="postgres"
INSIGHTS_RESULTS_AGGREGATOR__OCP_RECOMMENDATIONS_STORAGE__PG_PASSWORD="your secret password"
the actual driver will be postgres with password “your secret password”
It’s very useful for deploying docker containers and keeping some of your configuration outside of main config file(like passwords).
Clowder configuration
In Clowder environment, some configuration options are injected automatically.
Currently Kafka broker configuration is injected this side. To test this
behavior, it is possible to specify path to Clowder-related configuration file
via ACG_CONFIG environment variable:
export ACG_CONFIG="clowder_config.json"
Broker configuration
Broker configuration is in section [broker] in config file
[broker]
addresses = "localhost:9092"
security_protocol = ""
cert_path = ""
sasl_mechanism = ""
sasl_username = ""
sasl_password = ""
topic = "topic"
timeout = "30s"
payload_tracker_topic = "payload-tracker-topic"
dead_letter_queue_topic = ""
service_name = "insights-results-aggregator"
group = "aggregator"
enabled = true
org_allowlist_file = ""
enable_org_allowlist = false
addressesis a comma separated list of addresses of Kafka brokers; e.g kafka:9093,localhost:9092,kafka_2:9092security_protocolis a value for thesecurity.protocolKafka configuration. Defaults to “”cert_pathis a path to a file containing an SSL certificate, only used ifsecutiy_protocolis properly set toSSLsasl_mechanismis the SASL authentication mechanism to use whenSASL_SSLis set assecurity_protocolsasl_usernameis the SASL username to be used whenSASL_SSLis set assecurity_protocolsasl_passwordis the SASL password to be used whenSASL_SSLis set assecurity_protocoltopicis a topic to consume messages from (DEFAULT: “”)timeoutis the time used as timeout for the Kafka client networking side. See notes abovepayload_tracker_topicis a topic to which messages for the Payload Tracker are published (seeproducerpackage) (DEFAULT: “”)dead_letter_queue_topicis a topic where the non-processed messages will be sent in order to process them later.service_nameis the name of this service as reported to the Payload Tracker (DEFAULT: “”)groupis a kafka group (DEFAULT: “”)enabledis an option to turn broker on (DEFAULT: false)org_allowlist_fileenable_org_allowlist
The offset is stored in the same kafka broker. If it turned off, consuming will be started from the most recent message (DEFAULT: false)
Option names in env configuration:
addresses- INSIGHTS_RESULTS_AGGREGATOR__BROKER__ADDRESSESsecurity_protocol- INSIGHTS_RESULTS_AGGREGATOR__BROKER__SECURITY_PROTOCOLcert_path- INSIGHTS_RESULTS_AGGREGATOR__BROKER__CERT_PATHsasl_mechanism- INSIGHTS_RESULTS_AGGREGATOR__BROKER__SASL_MECHANISMsasl_username- INSIGHTS_RESULTS_AGGREGATOR__BROKER__SASL_USERNAMEsasl_password- INSIGHTS_RESULTS_AGGREGATOR__BROKER__SASL_PASSWORDtopic- INSIGHTS_RESULTS_AGGREGATOR__BROKER__TOPICtimeout- INSIGHTS_RESULTS_AGGREGATOR__BROKER__TIMEOUTpayload_tracker_topic- INSIGHTS_RESULTS_AGGREGATOR__BROKER__PAYLOAD_TRACKER_TOPICdead_letter_queue_topic- INSIGHTS_RESULTS_AGGREGATOR__BROKER__DEAD_LETTER_QUEUE_TOPICservice_name- INSIGHTS_RESULTS_AGGREGATOR__BROKER__SERVICE_NAMEgroup- INSIGHTS_RESULTS_AGGREGATOR__BROKER__GROUPenabled- INSIGHTS_RESULTS_AGGREGATOR__BROKER__ENABLEDorg_allowlist_file- INSIGHTS_RESULTS_AGGREGATOR__BROKER__ORG_ALLOWLIST_FILEenable_org_allowlist- INSIGHTS_RESULTS_AGGREGATOR__BROKER__ENABLE_ORG_ALLOWLIST
About timeout definition
The timeout configuration should be an string that can be parsed by the
function time.ParseDuration from
Golang standard library.
This timeout will be applied as the configuration for dial, read and write timeouts of the Sarama Kafka library.
Server configuration
Server configuration is in section [server] in config file.
[server]
address = ":8080"
api_prefix = "/api/v1/"
api_spec_file = "openapi.json"
debug = true
auth = true
auth_type = "xrh"
maximum_feedback_message_length = 255
addressis host and port which server should listen toapi_prefixis prefix for RestAPI pathapi_spec_fileis the location of a required OpenAPI specifications filedebugis developer mode that enables some special API endpoints not used on production. In production,falseis used every time.authturns on or turns authentication. Please note that this option can be set tofalseonly in devel environment. In production,trueis used every time.auth_typeset type of auth, it means which header to use for authx-rh-identityorAuthorization. Can be used only withauth = true. Possible options:jwt,xrhmaximum_feedback_message_lengthis a maximum possible length of a string for user’s feedback
Please note that if auth configuration option is turned off, not all REST API endpoints will be
usable. Whole REST API schema is satisfied only for auth = true.
CloudWatch configuration
CloudWatch configuration is in section [cloudwatch] in config file
[cloudwatch]
aws_access_id = "a key id"
aws_secret_key = "tshhhh it is a secret"
aws_session_token = ""
aws_region = "us-east-1"
log_group = "platform-dev"
stream_name = "insights-results-aggregator"
debug = false
aws_access_idis an aws access idaws_secret_keyis an aws secret keyaws_session_tokenis an aws session tokenaws_regionis an aws regionlog_groupis a log group for aws loggingstream_nameis a stream name for aws logging. If you’re deploying multiple pods, you can add$HOSTNAMEto the stream name so that they aren’t writing to the same stream at oncedebugis an option to enable debug output of cloudwatch logging
Storage configuration
Two storage backends can be configured separately:
- Storage for OCP recommendations
- Storage for DVO recommendations
For each storage, specific section in configuration file is used:
[ocp_recommendations_storage]
db_driver = "postgres"
pg_username = "user"
pg_password = "password"
pg_host = "localhost"
pg_port = 5432
pg_db_name = "aggregator"
pg_params = ""
log_sql_queries = true
type = "sql"
[dvo_recommendations_storage]
db_driver = "postgres"
pg_username = "user"
pg_password = "password"
pg_host = "localhost"
pg_port = 5432
pg_db_name = "aggregator"
pg_params = ""
log_sql_queries = true
type = "sql"
Actually used storage backend is selected by the following configuration option:
[storage_backend]
use = "ocp_recommendations"
By default OCP recommendations storage is selected if no backend is configured.
Redis configuration
Redis configuration is in section [redis] in config file
[redis]
database = 0
endpoint = "localhost:6379"
password = ""
timeout_seconds = 30
- Please note that Redis databases are numbered from 0 to 15 and that default value is 0
- Also please note that Redis database will be used only if
type=redis
Metrics configuration
Metrics configuration is in section [metrics] in config file
[metrics]
namespace = "mynamespace"
namespaceif defined, it is used asNamespaceargument when creating all the Prometheus metrics exposed by this service.