-
Notifications
You must be signed in to change notification settings - Fork 95
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
fix: [sc-106256] Add missing uri field to troubleshoot.sh types #1578
Conversation
* implement load additional spec from URIs
* add unit tests
dba164b
to
b6fda31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I tested this out, I could not replace the entire spec with what got downloaded from a uri
. Instead, the specs get merged together
Original spec
apiVersion: troubleshoot.sh/v1beta2
kind: HostPreflight
metadata:
name: my-spec
spec:
uri: https://gist.githubusercontent.com/banjoh/142fabe108e199d42d442cc0017c7064/raw/a75ceff7f1ec40b58fc38c0dde70a20e9453b7f0/filesystem-preflight.yaml
collectors:
- diskUsage:
collectorName: var-lib-kubelet
path: /var/lib/kubelet
Wrongly updated spec
apiVersion: troubleshoot.sh/v1beta2
kind: HostPreflight
metadata:
creationTimestamp: null
name: my-spec
spec:
analyzers:
- filesystemPerformance:
collectorName: Filesystem latency check
outcomes:
- pass:
message: 'Write latency is ok (p99 target < 10ms, actual: {{ .P99 }})'
when: p99 < 10ms
- fail:
message: Write latency is high. p99 target < 10ms, actual:{{ .String }}
collectors:
- diskUsage:
collectorName: var-lib-kubelet
path: /var/lib/kubelet
- filesystemPerformance:
backgroundIOPSWarmupSeconds: 10
backgroundReadIOPS: 50
backgroundReadIOPSJobs: 1
backgroundWriteIOPS: 300
backgroundWriteIOPSJobs: 6
collectorName: Filesystem Latency Two Minute Benchmark
datasync: true
directory: /var/lib/etcd
enableBackgroundIOPS: true
fileSize: 22Mi
timeout: 2m
uri: https://gist.githubusercontent.com/banjoh/142fabe108e199d42d442cc0017c7064/raw/a75ceff7f1ec40b58fc38c0dde70a20e9453b7f0/filesystem-preflight.yaml
status: {}
Expected spec update
apiVersion: troubleshoot.sh/v1beta2
kind: HostPreflight
metadata:
name: fs-preflight
spec:
collectors:
- filesystemPerformance:
collectorName: Filesystem Latency Two Minute Benchmark
timeout: 2m
directory: /var/lib/etcd
fileSize: 22Mi
operationSizeBytes: 2300
datasync: true
enableBackgroundIOPS: true
backgroundIOPSWarmupSeconds: 10
backgroundWriteIOPS: 300
backgroundWriteIOPSJobs: 6
backgroundReadIOPS: 50
backgroundReadIOPSJobs: 1
analyzers:
- filesystemPerformance:
collectorName: Filesystem latency check
outcomes:
- pass:
when: "p99 < 10ms"
message: "Write latency is ok (p99 target < 10ms, actual: {{ .P99 }})"
- fail:
message: "Write latency is high. p99 target < 10ms, actual:{{ .String }}"
Hi @banjoh, I've made changes to the code to follow our design doc. That is, to replace the original one entirely, not merge Updated demo: https://asciinema.org/a/2n6nrYBIByC6SIuTsTSInX1sC Please let me know how it goes. |
Story details: https://app.shortcut.com/replicated/story/106256
Demo: https://asciinema.org/a/c2tGPQrGZt6CM3jJQDZqKBsfv
This PR let
preflight
CLI load spec that hasuri
field, continued from #1574I used Go reflect to extract all unique
.Spec.uri
in all troubleshoot objects. Once the PR is merged, we can perhaps update current logic insupportbundle
CLItroubleshoot/cmd/troubleshoot/cli/run.go
Lines 295 to 302 in 191ebdb