Skip to content

Conversation

@varunraokadaparthi
Copy link
Contributor

Summary

Add support for configuring krkn-ai fitness function query and scenarios via viper config/environment variables. After the krkn-ai container runs in discover mode, the output YAML is automatically updated with user-specified values.

Changes

New Configuration Options

Added two new config keys to KrknAI config:

Config Key Environment Variable Description
krknAI.fitnessQuery KRKN_FITNESS_QUERY Prometheus query for the fitness function
krknAI.scenarios KRKN_SCENARIOS Comma-separated list of scenarios to enable

YAML Update Logic

After runKrknContainer() completes, a new updateKrknConfig() function:

  • Reads the krkn-ai.yaml file from the shared directory
  • Updates fitness_function.query if KRKN_FITNESS_QUERY is set
  • Enables scenarios specified in KRKN_SCENARIOS
  • Writes the updated YAML back

Example Usage

Set the fitness function query

export KRKN_FITNESS_QUERY='sum(kube_pod_container_status_restarts_total)'

Set scenarios to enable (comma-separated)

export KRKN_SCENARIOS='pod_scenarios,container_scenarios,node_cpu_hog,node_memory_hog'

  • pkg/common/config/config.go - Added FitnessQuery and Scenarios config keys
  • pkg/krknai/krknai.go - Added updateKrknConfig() function

Co-authored-by: Cursor AI cursor@cursor.sh

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jan 16, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jan 16, 2026

@varunraokadaparthi: This pull request references SDCICD-1717 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary

Add support for configuring krkn-ai fitness function query and scenarios via viper config/environment variables. After the krkn-ai container runs in discover mode, the output YAML is automatically updated with user-specified values.

Changes

New Configuration Options

Added two new config keys to KrknAI config:

Config Key Environment Variable Description
krknAI.fitnessQuery KRKN_FITNESS_QUERY Prometheus query for the fitness function
krknAI.scenarios KRKN_SCENARIOS Comma-separated list of scenarios to enable

YAML Update Logic

After runKrknContainer() completes, a new updateKrknConfig() function:

  • Reads the krkn-ai.yaml file from the shared directory
  • Updates fitness_function.query if KRKN_FITNESS_QUERY is set
  • Enables scenarios specified in KRKN_SCENARIOS
  • Writes the updated YAML back

Example Usage

Set the fitness function query

export KRKN_FITNESS_QUERY='sum(kube_pod_container_status_restarts_total)'

Set scenarios to enable (comma-separated)

export KRKN_SCENARIOS='pod_scenarios,container_scenarios,node_cpu_hog,node_memory_hog'

  • pkg/common/config/config.go - Added FitnessQuery and Scenarios config keys
  • pkg/krknai/krknai.go - Added updateKrknConfig() function

Co-authored-by: Cursor AI cursor@cursor.sh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 16, 2026
Co-authored-by: Ritu Mundhe <rmundhe@redhat.com>
Copy link

@christophermancini christophermancini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 21, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 21, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christophermancini, varunraokadaparthi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [christophermancini,varunraokadaparthi]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ritmun ritmun merged commit 5aea6d8 into openshift:main Jan 21, 2026
4 checks passed
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 21, 2026

@varunraokadaparthi: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants