Skip to content

Commit cd43fd6

Browse files
authored
Merge pull request #81 from replicatedhq/collector-node
Collector node
2 parents 2a3e4e7 + ed8453c commit cd43fd6

17 files changed

+1009
-41
lines changed

config/crds/troubleshoot.replicated.com_analyzers.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,45 @@ spec:
433433
required:
434434
- outcomes
435435
type: object
436+
containerRuntime:
437+
properties:
438+
checkName:
439+
type: string
440+
outcomes:
441+
items:
442+
properties:
443+
fail:
444+
properties:
445+
message:
446+
type: string
447+
uri:
448+
type: string
449+
when:
450+
type: string
451+
type: object
452+
pass:
453+
properties:
454+
message:
455+
type: string
456+
uri:
457+
type: string
458+
when:
459+
type: string
460+
type: object
461+
warn:
462+
properties:
463+
message:
464+
type: string
465+
uri:
466+
type: string
467+
when:
468+
type: string
469+
type: object
470+
type: object
471+
type: array
472+
required:
473+
- outcomes
474+
type: object
436475
customResourceDefinition:
437476
properties:
438477
checkName:
@@ -520,6 +559,45 @@ spec:
520559
- namespace
521560
- name
522561
type: object
562+
distribution:
563+
properties:
564+
checkName:
565+
type: string
566+
outcomes:
567+
items:
568+
properties:
569+
fail:
570+
properties:
571+
message:
572+
type: string
573+
uri:
574+
type: string
575+
when:
576+
type: string
577+
type: object
578+
pass:
579+
properties:
580+
message:
581+
type: string
582+
uri:
583+
type: string
584+
when:
585+
type: string
586+
type: object
587+
warn:
588+
properties:
589+
message:
590+
type: string
591+
uri:
592+
type: string
593+
when:
594+
type: string
595+
type: object
596+
type: object
597+
type: array
598+
required:
599+
- outcomes
600+
type: object
523601
imagePullSecret:
524602
properties:
525603
checkName:

config/crds/troubleshoot.replicated.com_preflights.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,45 @@ spec:
433433
required:
434434
- outcomes
435435
type: object
436+
containerRuntime:
437+
properties:
438+
checkName:
439+
type: string
440+
outcomes:
441+
items:
442+
properties:
443+
fail:
444+
properties:
445+
message:
446+
type: string
447+
uri:
448+
type: string
449+
when:
450+
type: string
451+
type: object
452+
pass:
453+
properties:
454+
message:
455+
type: string
456+
uri:
457+
type: string
458+
when:
459+
type: string
460+
type: object
461+
warn:
462+
properties:
463+
message:
464+
type: string
465+
uri:
466+
type: string
467+
when:
468+
type: string
469+
type: object
470+
type: object
471+
type: array
472+
required:
473+
- outcomes
474+
type: object
436475
customResourceDefinition:
437476
properties:
438477
checkName:
@@ -520,6 +559,45 @@ spec:
520559
- namespace
521560
- name
522561
type: object
562+
distribution:
563+
properties:
564+
checkName:
565+
type: string
566+
outcomes:
567+
items:
568+
properties:
569+
fail:
570+
properties:
571+
message:
572+
type: string
573+
uri:
574+
type: string
575+
when:
576+
type: string
577+
type: object
578+
pass:
579+
properties:
580+
message:
581+
type: string
582+
uri:
583+
type: string
584+
when:
585+
type: string
586+
type: object
587+
warn:
588+
properties:
589+
message:
590+
type: string
591+
uri:
592+
type: string
593+
when:
594+
type: string
595+
type: object
596+
type: object
597+
type: array
598+
required:
599+
- outcomes
600+
type: object
523601
imagePullSecret:
524602
properties:
525603
checkName:

config/crds/zz_generated.deepcopy.go

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ func (in *Analyze) DeepCopyInto(out *Analyze) {
7676
*out = new(StatefulsetStatus)
7777
(*in).DeepCopyInto(*out)
7878
}
79+
if in.ContainerRuntime != nil {
80+
in, out := &in.ContainerRuntime, &out.ContainerRuntime
81+
*out = new(ContainerRuntime)
82+
(*in).DeepCopyInto(*out)
83+
}
84+
if in.Distribution != nil {
85+
in, out := &in.Distribution, &out.Distribution
86+
*out = new(Distribution)
87+
(*in).DeepCopyInto(*out)
88+
}
7989
}
8090

8191
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Analyze.
@@ -677,6 +687,33 @@ func (in *CollectorStatus) DeepCopy() *CollectorStatus {
677687
return out
678688
}
679689

690+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
691+
func (in *ContainerRuntime) DeepCopyInto(out *ContainerRuntime) {
692+
*out = *in
693+
out.AnalyzeMeta = in.AnalyzeMeta
694+
if in.Outcomes != nil {
695+
in, out := &in.Outcomes, &out.Outcomes
696+
*out = make([]*Outcome, len(*in))
697+
for i := range *in {
698+
if (*in)[i] != nil {
699+
in, out := &(*in)[i], &(*out)[i]
700+
*out = new(Outcome)
701+
(*in).DeepCopyInto(*out)
702+
}
703+
}
704+
}
705+
}
706+
707+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerRuntime.
708+
func (in *ContainerRuntime) DeepCopy() *ContainerRuntime {
709+
if in == nil {
710+
return nil
711+
}
712+
out := new(ContainerRuntime)
713+
in.DeepCopyInto(out)
714+
return out
715+
}
716+
680717
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
681718
func (in *Copy) DeepCopyInto(out *Copy) {
682719
*out = *in
@@ -752,6 +789,33 @@ func (in *DeploymentStatus) DeepCopy() *DeploymentStatus {
752789
return out
753790
}
754791

792+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
793+
func (in *Distribution) DeepCopyInto(out *Distribution) {
794+
*out = *in
795+
out.AnalyzeMeta = in.AnalyzeMeta
796+
if in.Outcomes != nil {
797+
in, out := &in.Outcomes, &out.Outcomes
798+
*out = make([]*Outcome, len(*in))
799+
for i := range *in {
800+
if (*in)[i] != nil {
801+
in, out := &(*in)[i], &(*out)[i]
802+
*out = new(Outcome)
803+
(*in).DeepCopyInto(*out)
804+
}
805+
}
806+
}
807+
}
808+
809+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Distribution.
810+
func (in *Distribution) DeepCopy() *Distribution {
811+
if in == nil {
812+
return nil
813+
}
814+
out := new(Distribution)
815+
in.DeepCopyInto(out)
816+
return out
817+
}
818+
755819
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
756820
func (in *Exec) DeepCopyInto(out *Exec) {
757821
*out = *in
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
apiVersion: troubleshoot.replicated.com/v1beta1
22
kind: Analyzer
33
metadata:
4-
name: defaultAnalyzers
4+
name: a
55
spec:
66
analyzers:
7-
- clusterVersion:
7+
- distribution:
88
outcomes:
99
- fail:
10-
when: "< 1.13.0"
11-
message: The application requires at Kubernetes 1.13.0 or later, and recommends 1.15.0.
12-
uri: https://www.kubernetes.io
10+
when: "= docker desktop"
11+
message: "docker for desktop is not allowed"
12+
- fail:
13+
when: "microk8s"
14+
message: "mickrk8s is not prod"
1315
- warn:
14-
when: "< 1.15.0"
15-
message: Your cluster meets the minimum version of Kubernetes, but we recommend you update to 1.15.0 or later.
16-
uri: https://kubernetes.io
16+
when: "!= eks"
17+
message: "YMMV on not eks"
1718
- pass:
18-
when: ">= 1.15.0"
19-
message: Your cluster meets the recommended and required versions of Kubernetes.
19+
message: "good work"
20+
21+

examples/troubleshoot/sample-troubleshoot.yaml

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,4 @@ kind: Collector
33
metadata:
44
name: collector-sample
55
spec:
6-
collectors:
7-
- secret:
8-
name: myapp-postgres
9-
namespace: default
10-
key: uri
11-
includeValue: false
12-
- logs:
13-
selector:
14-
- name=cilium-operator
15-
namespace: kube-system
16-
limits:
17-
maxAge: 30d
18-
maxLines: 10000
19-
- run:
20-
collectorName: ping-google
21-
namespace: default
22-
image: flungo/netutils
23-
command: ["ping"]
24-
args: ["www.google.com"]
25-
timeout: 5s
26-
- http:
27-
collectorName: echo-ip
28-
get:
29-
url: https://api.replicated.com/market/v1/echo/ip
6+
collectors: []

pkg/analyze/analyzer.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,16 @@ func Analyze(analyzer *troubleshootv1beta1.Analyze, getFile getCollectedFileCont
3838
return analyzeImagePullSecret(analyzer.ImagePullSecret, findFiles)
3939
}
4040
if analyzer.DeploymentStatus != nil {
41-
return deploymentStatus(analyzer.DeploymentStatus, getFile)
41+
return analyzeDeploymentStatus(analyzer.DeploymentStatus, getFile)
4242
}
4343
if analyzer.StatefulsetStatus != nil {
44-
return statefulsetStatus(analyzer.StatefulsetStatus, getFile)
44+
return analyzeStatefulsetStatus(analyzer.StatefulsetStatus, getFile)
45+
}
46+
if analyzer.ContainerRuntime != nil {
47+
return analyzeContainerRuntime(analyzer.ContainerRuntime, getFile)
48+
}
49+
if analyzer.Distribution != nil {
50+
return analyzeDistribution(analyzer.Distribution, getFile)
4551
}
4652

4753
return nil, errors.New("invalid analyzer")

0 commit comments

Comments
 (0)