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

feat: add --add-default-collectors flag to preflight #1448

Closed
wants to merge 1 commit into from

Conversation

xavpaice
Copy link
Member

@xavpaice xavpaice commented Feb 5, 2024

For the preflight binary, add a --add-default-collectors flag, default true.

If set to false, do not add cluster-resources and cluster-info to the list of collectors in a preflight.

Fixes: #1447

Checklist

  • New and existing tests pass locally with introduced changes.
  • Tests for the changes have been added (for bug fixes / features)
  • The commit message(s) are informative and highlight any breaking changes
  • Any documentation required has been added/updated. For changes to https://troubleshoot.sh/ create a PR here

Does this PR introduce a breaking change?

  • Yes
  • No

@xavpaice xavpaice added the type::feature New feature or request label Feb 5, 2024
@xavpaice xavpaice requested a review from a team as a code owner February 5, 2024 01:28
@xavpaice
Copy link
Member Author

xavpaice commented Feb 5, 2024

Test:

spec:

apiVersion: troubleshoot.sh/v1beta2
kind: Preflight
metadata:
  name: connectivity
spec:
  collectors:
    - runPod:
        name: connectivity
        namespace: default
        podSpec:
          containers:
            - name: wget
              image: busybox:1
              command: ["wget"]
              args: ["-O", "-", "https://docs.replicated.com"]

  analyzers:
    - textAnalyze:
        checkName: "connectivity"
        fileName: connectivity/connectivity.log
        regex: 'title=\"Replicated Docs\"'
        outcomes:
          - pass:
              when: "true"
              message: Successful download from from https://docs.replicated.com
          - fail:
              message: Was unable to download from https://docs.replicated.com

Set flag false:

$ time ./bin/preflight --interactive=false --add-default-collectors=false ./preflight.yaml
name: run-pod              status: running         completed: 0    total: 1   
name: run-pod              status: completed       completed: 1    total: 1   

   --- PASS connectivity
      --- Successful download from from https://docs.replicated.com
--- PASS   connectivity
PASS
./bin/preflight --interactive=false --add-default-collectors=false   0.06s user 0.03s system 1% cpu 7.369 total

Default (true):

$ time ./bin/preflight --interactive=false ./preflight.yaml 
name: cluster-resources    status: running         completed: 0    total: 3   
name: cluster-resources    status: completed       completed: 1    total: 3   
name: run-pod              status: running         completed: 1    total: 3   
name: run-pod              status: completed       completed: 2    total: 3   
name: cluster-info         status: running         completed: 2    total: 3   
name: cluster-info         status: completed       completed: 3    total: 3   

   --- PASS connectivity
      --- Successful download from from https://docs.replicated.com
--- PASS   connectivity
PASS
./bin/preflight --interactive=false ../reliability-matrix/dev/preflight.yaml  0.37s user 0.10s system 0% cpu 1:06.46 total

@xavpaice
Copy link
Member Author

xavpaice commented Feb 5, 2024

Closing - there's an alternate which works better (use exclude)

@xavpaice xavpaice closed this Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to skip cluster-resources collector
2 participants