Commit Graph

60 Commits

Author SHA1 Message Date
Andrew Reed
7b36e6a1f8 Copy in longhorn client (#454) 2021-10-22 15:24:07 -05:00
Rishabh Bohra
cf03503216 feat: Collect custom resources (#447)
* feat: Collect custom resources
Co-authored-by: Martin Hrabovcin<mhrabovcin@users.noreply.github.com>

Co-authored-by: Andrew Reed <andrew@replicated.com>
2021-10-21 16:49:59 -05:00
Jalaja Ganapathy
372454651e collector/analyzer for host operating system (#443)
* collector/analyzer for host operating system

* address cr comments

* cleanup

* fix invoking the analyzer
code cleanup

* fix cr comments

* add corner case unit-test

* fix kernel version parsing

* address review comments

* add default case

* parse using regex

* added more testcases and fixed the bug found in cr

* few small things
2021-10-12 14:42:23 -07:00
Simon Croome
977fc438ea Remote host collectors (#392)
* Add collect command and remote host collectors

Adds the ability to run a host collector on a set of remote k8s nodes.
Target nodes can be filtered using the --selector flag, with the same
syntax as kubectl.  Existing flags for --collector-image,
--collector-pullpolicy and --request-timeout are used.  To run on a
specified node, --selector="kubernetes.io/hostname=kind-worker2" could
be used.

The collect command is used by the remote collector to output the
results using a "raw" format, which uses the filename as the key, and
the value the output as a escaped json string.  When run manually it
defaults to fully decoded json. The existing block devices,
ipv4interfaces and services host collectors don't decode properly - the
fix is to convert their slice output to a map (fix not included as
unsure what depends on the existing format).

The collect command is also useful for troubleshooting preflight issues.

Examples are included to show remote collector usage.

```
bin/collect --collector-image=croomes/troubleshoot:latest  examples/collect/remote/memory.yaml --namespace test
{
  "kind-control-plane": {
    "system/memory.json": {
      "total": 1304207360
    }
  },
  "kind-worker": {
    "system/memory.json": {
      "total": 1695780864
    }
  },
  "kind-worker2": {
    "system/memory.json": {
      "total": 1726353408
    }
  }
}
```

The preflight command has been updated to run remote collectors.  To run
a host collector remotely it must be specified in the spec as a
`remoteCollector`:

```
apiVersion: troubleshoot.sh/v1beta2
kind: HostPreflight
metadata:
  name: memory
spec:
  remoteCollectors:
    - memory:
        collectorName: memory
  analyzers:
    - memory:
        outcomes:
          - fail:
              when: "< 8Gi"
              message: At least 8Gi of memory is required
          - warn:
              when: "< 32Gi"
              message: At least 32Gi of memory is recommended
          - pass:
              message: The system has as sufficient memory
```

Results for each node are analyzed separately, with the node name
appended to the title:

```
bin/preflight --interactive=false --collector-image=croomes/troubleshoot:latest examples/preflight/remote/memory.yaml --format=json
{memory running 0 1}
{memory completed 1 1}
{
  "fail": [
    {
      "title": "Amount of Memory (kind-worker2)",
      "message": "At least 8Gi of memory is required"
    },
    {
      "title": "Amount of Memory (kind-worker)",
      "message": "At least 8Gi of memory is required"
    },
    {
      "title": "Amount of Memory (kind-control-plane)",
      "message": "At least 8Gi of memory is required"
    }
  ]
}
```

Also added a host collector to allow preflight checks of required kernel
modules, which is the main driver for this change.
2021-10-06 09:03:53 -05:00
Jalaja Ganapathy
a0b3b3f7dc add an unique id to each host preflights (#431)
* add an unique id to each host preflights

* auto generated files

* updated schemas for the new field id

* keeping it consistent with the rest of the spec
2021-09-24 13:29:14 -07:00
Salah Aldeen Al Saleh
1bdd3db8c5 update schemas (#428)
* update schemas

* update controller-gen
2021-09-23 11:03:19 -07:00
John Murphy
e0f6cab5b3 Fix removes control characters from non interactive preflight runs (#394) 2021-07-23 09:46:36 -05:00
Andrew Reed
776934af2b Use updated longhorn-manager fork 2021-06-22 20:20:41 +00:00
Andrew Reed
646f7a6991 Longhorn collector for all CRDs
Also implement a single analyzer as a proof of concept. More analyzers
can be added using the collected CRDs.
2021-05-26 23:37:15 +00:00
divolgin
7a0c6e5383 use containers package instead of go-containerregistry 2021-04-11 21:39:44 +00:00
divolgin
fe414af556 Docker registry collector/analyzer 2021-04-09 16:17:15 +00:00
Andrew Reed
9984fe2caa Get time info from timedated 2021-02-10 20:01:15 +00:00
Andrew Reed
86bc366ec3 Fix build for darwin amd64 2021-02-08 22:47:06 +00:00
Andrew Reed
10a34c2e58 Host preflight (#311)
* Add HostPreflight v1beta2

* Work on TCP Load Balancer

* Host disk usage collector and analyzer

* Host memory analyzer

* TCP port status

* TCP load balancer

* Review changes

Co-authored-by: Marc Campbell <marc.e.campbell@gmail.com>
2021-02-08 16:09:01 -05:00
Marc Campbell
c7fdec0291 Removing Scopeagent 2021-01-28 18:22:48 +00:00
emosbaugh
2bf19eaddf Ceph collectors and analyzers (#295)
* Ceph collectors and analyzers

* updating based on prior pr

* fixes

* fixes
2020-11-13 09:12:42 -08:00
divolgin
5a1321da02 Collector and analyzer for RRD data 2020-11-10 17:19:17 +00:00
divolgin
6e86cdc803 Allow preflight spec to be loaded from a secret 2020-10-01 01:37:37 +00:00
Andrew Lavery
0126fb7d7a Merge remote-tracking branch 'origin/master' into laverya/allow-analyzing-all-files-in-dir 2020-09-08 14:27:26 -04:00
GraysonNull
0e667e9685 scrolling on analyzers table 2020-08-11 15:16:23 +00:00
Marc Campbell
65f957db81 Refactor to support K8s 1.18 2020-06-12 09:28:49 -07:00
Andrew Lavery
1c3496e2f7 go mod tidy 2020-05-27 17:24:17 -04:00
Marc Campbell
661d7fcfc4 Update names 2020-05-27 13:10:46 -07:00
Andrew Lavery
f7aebd0745 remove an unused replace statement 2020-05-13 16:55:41 -04:00
Andrew Lavery
37f75c1a3f use gobwas/glob, not filepath, file matching 2020-04-23 13:13:46 -04:00
Andrew Lavery
2bc9938a2a use filepath.Glob and filepath.Match 2020-04-15 18:59:17 -04:00
Andrew Lavery
5050f46b1e use gobwas/glob to match globs 2020-04-15 18:47:16 -04:00
Andrew Lavery
c262320cea fix build after k8s 1.18 was released 2020-03-26 18:50:23 +00:00
Marc Campbell
8f78827002 Redis 2020-03-20 11:03:49 -07:00
Marc Campbell
77eba55ee8 Abstract, add mysql 2020-03-20 07:19:03 -07:00
Marc Campbell
562a565f1f Adding postgres analyzer 2020-03-19 18:28:13 -07:00
Michael
a1c5247c8b REFACTOR create helper functions for analyzeDistribution 2020-03-12 18:01:05 +00:00
Andrew Lavery
1c66eed2cd move multitype package here from kots 2020-03-09 17:37:27 -07:00
Marc Campbell
6277101574 Use bool string for exclude value 2020-03-05 23:35:21 +00:00
divolgin
5a7b155093 Better integration with embedded kots clusters 2020-03-03 22:30:47 +00:00
Frank Shotwell
10b2941c57 Add scope test instrumentation 2020-01-30 21:01:06 +00:00
divolgin
8e1cb615a5 Don't print usage on error and no double-logging 2019-12-24 22:04:43 +00:00
Marc Campbell
0aafbb79a6 go mod! 2019-12-24 20:00:46 +00:00
Marc Campbell
47c686f352 Replace 2019-12-24 19:50:05 +00:00
Marc Campbell
4a31134d3a go mod tidy 2019-12-24 19:45:01 +00:00
Marc Campbell
3955dab9bc Removing the CRD 2019-12-24 19:26:26 +00:00
bearium
68c76867c7 go mod tidy 2019-12-02 10:36:48 -05:00
bearium
e13cb35c82 added std out support and namespace functionality 2019-12-02 09:56:07 -05:00
Marc Campbell
996a55bf90 Support CGO for calling analysis from other languages 2019-08-28 21:30:59 +00:00
divolgin
2fb3a17783 adding support for generic CLI options. closes #54 2019-08-22 14:25:08 +00:00
divolgin
b6ca58dbcf errors are masked when collector fails 2019-08-20 20:25:55 +00:00
divolgin
920e1efc27 Show progress when collecting support bundle 2019-08-07 20:41:06 +00:00
Marc Campbell
94b47ddb94 Status while running 2019-07-31 18:20:31 +00:00
divolgin
ea58127389 analyze cli cub-command 2019-07-30 23:13:52 +00:00
Marc Campbell
c2fd9cca0c Remove run subcommand 2019-07-26 22:42:09 +00:00