Skip to content
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

agent/agent: Refactor run command #76

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

tupyy
Copy link
Collaborator

@tupyy tupyy commented Nov 18, 2024

The run command has been refractor to make it simpler. The inventory status method does not have a loop anymore and it is called from the agent itself.
The health check state is checked before sending update requests.

The idea is to reorganize the "inventory" and "healthcheck" into a stateless services and let the agent control everything.

This commit does not change the logic of the agent in any way, it just tries to improve organization of the code and the readability.

Signed-of-by: Cosmin Tupangiu [email protected]

@tupyy tupyy requested a review from machacekondra November 18, 2024 10:30
@tupyy tupyy force-pushed the refractor-agent-server branch from 6fe0b98 to cbd0872 Compare November 18, 2024 10:42
Copy link
Collaborator

@machacekondra machacekondra left a comment

Choose a reason for hiding this comment

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

Looks good to me, but the agent is not properly updating the source with credentials URL for some reason, but I really can't find why.

@tupyy tupyy force-pushed the refractor-agent-server branch 7 times, most recently from 8bbfb31 to 2ff77cf Compare November 19, 2024 14:27
@tupyy tupyy requested a review from machacekondra November 19, 2024 14:44
@@ -27,7 +27,7 @@ const (
// DefaultPlannerEndpoint is the default address of the migration planner server
DefaultPlannerEndpoint = "https://localhost:7443"
// DefaultHealthCheck is the default value for health check interval in seconds.
DefaultHealthCheck = 5 * 60 // 5 min
DefaultHealthCheck = 10 // 5 min
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please fix the comment, also maybe explain in comment why it's 10seconds now.

case <-updateTicker.C:
}

// check for health. Send requests only if we have connectivity
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please explain why the code below is not part of case <-updateTicker.C:?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is but I've put it out of the scope for better readability. the select will block until tick or cancel().

The run command has been refractor to make it simpler. The inventory
status method does not have a loop anymore and it is called from the
agent itself.
The health check state is checked before sending update requests.

The idea is to reorganize the "inventory" and "healthcheck" into a
stateless services and let the agent control everything.

This commit does not change the logic of the agent in any way, it just
tries to improve organization of the code and the readability.

Signed-off-by: Cosmin Tupangiu <[email protected]>
@tupyy tupyy force-pushed the refractor-agent-server branch from 2ff77cf to 40b330b Compare November 19, 2024 17:29
@machacekondra machacekondra merged commit 17355b3 into kubev2v:main Nov 19, 2024
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants