Skip to content

OTA-1404: Add Support for a Configuration File: Creation of a Periodic Check #1192

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DavidHurta
Copy link
Contributor

@DavidHurta DavidHurta commented May 14, 2025

The first PR in the series to enable the CVO to read a configuration file periodically for updates.

The goal of this PR is to create a new config-file flag and create a gated periodic check with a placeholder logic.
The following PR will add logic to read, parse, and configure the CVO's verbosity of logs based on the file.


cvo: Add config-file flag
Add a new flag instead of a new environment variable to specify the path of the
configuration file. Using env variables has the benefit of better backwards
compatibility, for example, specifying not used env variable has no impact. Using
a not-implemented flag results in an error. The flag is primarily intended for use
in HyperShift, thus, these topics are relevant.

In case the feature gate does not get into default, we must not drop the flag
out of nowhere, which could cause issues in HyperShift. However, the new API
is very small, and it is not likely for this functionality to be dropped
along the way. An alternative is to use an env variable before the feature gets
into default; however, I do not think this is worth the risk at the moment.


pkg/cvo: Create periodic check for configuration file
Right now, a placeholder log is present.

The log will be exchanged with the actual logic to sync
the configuration file later on.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 14, 2025
Copy link
Contributor

openshift-ci bot commented May 14, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DavidHurta

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

The pull request process is described here

Needs approval from an approver in each of these files:

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 14, 2025
@DavidHurta DavidHurta changed the title WIP: Configuration file support periodic check WIP: Add Support for a Configuration File: Creation of a Periodic Check May 15, 2025
defer utilruntime.HandleCrash()
wait.UntilWithContext(runContext, func(_ context.Context) {
klog.V(4).Infof("Syncing configuration file")
}, time.Second*15)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe 15 seconds is too little; however, the logic won't be that extensive.

@DavidHurta
Copy link
Contributor Author

Testing.

Default Cluster - not run as expected.

$ grep -e "config-file" default-flag.txt 
I0507 19:26:12.201962  121192 cvo.go:485] The ClusterVersionOperatorConfiguration feature gate is disabled, HyperShift is detected or --config-file flag is used; the configuration sync routine will not run.
I0507 19:26:12.201978  121192 cvo.go:501] The ClusterVersionOperatorConfiguration feature gate is disabled or --config-file flag is not used; the configuration file sync routine will not run.

Locally built and run CVO with the flag specified. As expected.

$ ./_output/linux/amd64/cluster-version-operator -v5 start --release-image 4.20.0-0-2025-05-15-124627-test-ci-ln-k4x6l9k-latest --listen="" --config-file=SOMEPATHDOESNOTEXIST > log.log 2>&1
$ grep -E "(config-file|configuration file)" log.log 
I0515 17:45:27.227247   40599 cvo.go:485] The ClusterVersionOperatorConfiguration feature gate is disabled, HyperShift is detected or --config-file flag is used; the configuration sync routine will not run.
I0515 17:45:27.227342   40599 cvo.go:493] Syncing configuration file
I0515 17:45:42.228019   40599 cvo.go:493] Syncing configuration file
I0515 17:45:57.228480   40599 cvo.go:493] Syncing configuration file
I0515 17:46:12.229317   40599 cvo.go:493] Syncing configuration file
I0515 17:46:27.230200   40599 cvo.go:493] Syncing configuration file
I0515 17:46:34.782414   40599 cvo.go:545] Collected cvo configuration file goroutine.

Locally built and run CVO with the flag NOT specified. As expected.

$ grep -E "(config-file|configuration file)" log-notset.log
I0515 18:07:54.731258   42568 cvo.go:498] The ClusterVersionOperatorConfiguration feature gate is disabled or --config-file flag is not used; the configuration file sync routine will not run.

Add a new flag instead of a new environment variable to specify the path of the
configuration file. Using env variables has the benefit of better backwards
compatibility, for example, specifying not used env variable has no impact. Using
a not-implemented flag results in an error. The flag is primarily intended for use
in HyperShift, thus, these topics are relevant.

In case the feature gate does not get into default, we must not drop the flag
out of nowhere, which could cause issues in HyperShift. However, the new API
is very small, and it is not likely for this functionality to be dropped
along the way. An alternative is to use an env variable before the feature gets
into default; however, I do not think this is worth the risk at the moment.
Right now, a placeholder log is present.

The log will be exchanged with the actual logic to sync
the configuration file later on.
@DavidHurta DavidHurta force-pushed the configuration-file-support-periodic-check branch from 293ee72 to 55d2d56 Compare May 15, 2025 16:27
@DavidHurta DavidHurta changed the title WIP: Add Support for a Configuration File: Creation of a Periodic Check OTA-1404: Add Support for a Configuration File: Creation of a Periodic Check May 15, 2025
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 15, 2025
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented May 15, 2025

@DavidHurta: This pull request references OTA-1404 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 story to target the "4.20.0" version, but no target version was set.

In response to this:

The first PR in the series to enable the CVO to read a configuration file periodically for updates.

The goal of this PR is to create a new config-file flag and create a gated periodic check with a placeholder logic.
The following PR will add logic to read, parse, and configure the CVO's verbosity of logs based on the file.


cvo: Add config-file flag
Add a new flag instead of a new environment variable to specify the path of the
configuration file. Using env variables has the benefit of better backwards
compatibility, for example, specifying not used env variable has no impact. Using
a not-implemented flag results in an error. The flag is primarily intended for use
in HyperShift, thus, these topics are relevant.

In case the feature gate does not get into default, we must not drop the flag
out of nowhere, which could cause issues in HyperShift. However, the new API
is very small, and it is not likely for this functionality to be dropped
along the way. An alternative is to use an env variable before the feature gets
into default; however, I do not think this is worth the risk at the moment.


pkg/cvo: Create periodic check for configuration file
Right now, a placeholder log is present.

The log will be exchanged with the actual logic to sync
the configuration file later on.

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 removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 15, 2025
Copy link
Contributor

openshift-ci bot commented May 15, 2025

@DavidHurta: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-hypershift 55d2d56 link true /test e2e-hypershift
ci/prow/e2e-agnostic-operator-devpreview 55d2d56 link false /test e2e-agnostic-operator-devpreview

Full PR test history. Your PR dashboard.

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.

@DavidHurta
Copy link
Contributor Author

The force push has updated commit messages. The failing HyperShift job does not seem to be caused by the PR.

@petr-muller
Copy link
Member

/cc

@openshift-ci openshift-ci bot requested a review from petr-muller May 16, 2025 13:15
@DavidHurta
Copy link
Contributor Author

/hold

Checking out using related libraries.

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 16, 2025
@DavidHurta
Copy link
Contributor Author

/unhold

The periodic checking will be replaced with a more proper solution in a later PR.

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 16, 2025
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants