Skip to content

refactor(CLI): Make check command more modular#15293

Open
adleong wants to merge 5 commits into
mainfrom
alex-check-please
Open

refactor(CLI): Make check command more modular#15293
adleong wants to merge 5 commits into
mainfrom
alex-check-please

Conversation

@adleong
Copy link
Copy Markdown
Member

@adleong adleong commented May 19, 2026

We slightly refactor the linkerd check command into more modular and reusable pieces. In particular, we split the configureAndRunChecks function into two pieces: ConfigureChecks and RunChecks, making both of them public. This allows them to be invoked individually and to potentially modify the HealthChecker in between.

To further support that use-case, we add a InsertCategoriesBefore function to the HealthChecker that allows inserting checks at particular locations in the order rather than only being able to append them to the end.

adleong added 4 commits May 13, 2026 23:37
Signed-off-by: Alex Leong <alex@buoyant.io>
Signed-off-by: Alex Leong <alex@buoyant.io>
Signed-off-by: Alex Leong <alex@buoyant.io>
@adleong adleong requested a review from a team as a code owner May 19, 2026 23:45
@cratelyn cratelyn requested review from alpeb and zaharidichev May 20, 2026 16:09
Signed-off-by: Alex Leong <alex@buoyant.io>
Comment thread cli/cmd/check.go
CliVersionOverride string
}

var CheckOptions *checkOptions
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What do you think about making the checkOptions struct public, instead of introducing this public var? The newCmdCheck() function would need to become public as well, and refactored to receive a pointer to that struct, instantiated by the caller. Similar to what was done with NewCmdInject() to provide more flexibility there.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

unfortunately, making newCmdCheck public wouldn't be sufficient for adding new checks to the Healthchecker because the cmd that newCmdCheck returns always uses the same list of checks.

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.

3 participants