Skip to content

Allow custom docURL for check documentation links - #1225

Open
ChrisJr404 wants to merge 1 commit into
FairwindsOps:masterfrom
ChrisJr404:custom-category-doc-url
Open

ChrisJr404 wants to merge 1 commit into
FairwindsOps:masterfrom
ChrisJr404:custom-category-doc-url

Conversation

@ChrisJr404

Copy link
Copy Markdown

This PR fixes #854

Checklist

  • I have signed the CLA
  • I have updated/added any relevant documentation

Description

What's the goal of this PR?

Custom check categories already work, but the "more info" links in the dashboard are still hardcoded to polaris.docs.fairwinds.com/checks/<category>. So if you make a custom category like Business, every link points at a Fairwinds docs page that doesn't exist. This lets you point those links somewhere real.

What changes did you make?

Added an optional docURL field to a check. When it's set, the dashboard uses it for that check's more-info link and for the category's "Refer to the Polaris documentation" link. When it's empty you get the existing Fairwinds link, so nothing changes for anyone who doesn't set it.

The field lands on SchemaCheck, flows through to ResultMessage in makeResult, and two small dashboard helpers (getResultDocumentationLink, getCategoryDocumentationLink) fall back to the old getCategoryLink when it's unset.

Example custom check:

customChecks:
  myBusinessCheck:
    category: Business
    docURL: https://docs.internal.example.com/checks/business
    successMessage: Looks good
    failureMessage: Fix it
    # ...schema...

Added helper tests in pkg/dashboard covering both paths (custom URL when set, default Fairwinds link when unset), and documented the option in docs/customization/custom-checks.md. go build ./... passes and so do the pkg/config, pkg/validator, and pkg/dashboard tests.

What alternative solution should we consider, if any?

Could scope docURL to the category level instead of the check, but checks are where custom config already lives, so keeping it on the check felt more natural and stays backward compatible.

Custom check categories work, but the dashboard doc links were hardcoded
to polaris.docs.fairwinds.com/checks/<category>. A custom category like
Business ends up linking to a Fairwinds docs page that doesn't exist.

Add an optional docURL field on a check and use it for the check and
category doc links when set, falling back to the default Fairwinds link
when it's empty.

Fixes FairwindsOps#854
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
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.

Support custom categories & documentation URLs

2 participants