Skip to content

Commit

Permalink
adding errors to all collectors
Browse files Browse the repository at this point in the history
  • Loading branch information
divolgin committed Jul 23, 2019
1 parent 4716a0d commit be2fa18
Show file tree
Hide file tree
Showing 16 changed files with 282 additions and 153 deletions.
6 changes: 6 additions & 0 deletions cmd/troubleshoot/cli/run_nocrd.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ func runCollectors(v *viper.Viper, collector troubleshootv1beta1.Collector) (str
return
}

// empty dir name will make tar fail
if collectorDir == "" {
fmt.Printf("pod %s did not return any files\n", newPod.Name)
return
}

collectorDirs = append(collectorDirs, collectorDir)

if err := client.Delete(context.Background(), newPod); err != nil {
Expand Down
22 changes: 12 additions & 10 deletions config/crds/troubleshoot.replicated.com_collectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ spec:
type: object
copy:
properties:
collectorName:
type: string
containerName:
type: string
containerPath:
Expand All @@ -419,14 +421,14 @@ spec:
items:
type: string
type: array
collectorName:
type: string
command:
items:
type: string
type: array
containerName:
type: string
name:
type: string
namespace:
type: string
selector:
Expand All @@ -436,12 +438,13 @@ spec:
timeout:
type: string
required:
- name
- selector
- namespace
type: object
http:
properties:
collectorName:
type: string
get:
properties:
headers:
Expand All @@ -455,8 +458,6 @@ spec:
required:
- url
type: object
name:
type: string
post:
properties:
body:
Expand Down Expand Up @@ -487,11 +488,11 @@ spec:
required:
- url
type: object
required:
- name
type: object
logs:
properties:
collectorName:
type: string
limits:
properties:
maxAge:
Expand All @@ -515,6 +516,8 @@ spec:
items:
type: string
type: array
collectorName:
type: string
command:
items:
type: string
Expand All @@ -523,19 +526,18 @@ spec:
type: string
imagePullPolicy:
type: string
name:
type: string
namespace:
type: string
timeout:
type: string
required:
- name
- namespace
- image
type: object
secret:
properties:
collectorName:
type: string
includeValue:
type: boolean
key:
Expand Down
22 changes: 12 additions & 10 deletions config/crds/troubleshoot.replicated.com_preflights.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,8 @@ spec:
type: object
copy:
properties:
collectorName:
type: string
containerName:
type: string
containerPath:
Expand All @@ -683,14 +685,14 @@ spec:
items:
type: string
type: array
collectorName:
type: string
command:
items:
type: string
type: array
containerName:
type: string
name:
type: string
namespace:
type: string
selector:
Expand All @@ -700,12 +702,13 @@ spec:
timeout:
type: string
required:
- name
- selector
- namespace
type: object
http:
properties:
collectorName:
type: string
get:
properties:
headers:
Expand All @@ -719,8 +722,6 @@ spec:
required:
- url
type: object
name:
type: string
post:
properties:
body:
Expand Down Expand Up @@ -751,11 +752,11 @@ spec:
required:
- url
type: object
required:
- name
type: object
logs:
properties:
collectorName:
type: string
limits:
properties:
maxAge:
Expand All @@ -779,6 +780,8 @@ spec:
items:
type: string
type: array
collectorName:
type: string
command:
items:
type: string
Expand All @@ -787,19 +790,18 @@ spec:
type: string
imagePullPolicy:
type: string
name:
type: string
namespace:
type: string
timeout:
type: string
required:
- name
- namespace
- image
type: object
secret:
properties:
collectorName:
type: string
includeValue:
type: boolean
key:
Expand Down
21 changes: 21 additions & 0 deletions config/crds/zz_generated.deepcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,21 @@ func (in *CollectorList) DeepCopyObject() runtime.Object {
return nil
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CollectorMeta) DeepCopyInto(out *CollectorMeta) {
*out = *in
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CollectorMeta.
func (in *CollectorMeta) DeepCopy() *CollectorMeta {
if in == nil {
return nil
}
out := new(CollectorMeta)
in.DeepCopyInto(out)
return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CollectorRef) DeepCopyInto(out *CollectorRef) {
*out = *in
Expand Down Expand Up @@ -592,6 +607,7 @@ func (in *CollectorStatus) DeepCopy() *CollectorStatus {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Copy) DeepCopyInto(out *Copy) {
*out = *in
out.CollectorMeta = in.CollectorMeta
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
*out = make([]string, len(*in))
Expand Down Expand Up @@ -639,6 +655,7 @@ func (in *CustomResourceDefinition) DeepCopy() *CustomResourceDefinition {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Exec) DeepCopyInto(out *Exec) {
*out = *in
out.CollectorMeta = in.CollectorMeta
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
*out = make([]string, len(*in))
Expand Down Expand Up @@ -691,6 +708,7 @@ func (in *Get) DeepCopy() *Get {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HTTP) DeepCopyInto(out *HTTP) {
*out = *in
out.CollectorMeta = in.CollectorMeta
if in.Get != nil {
in, out := &in.Get, &out.Get
*out = new(Get)
Expand Down Expand Up @@ -790,6 +808,7 @@ func (in *LogLimits) DeepCopy() *LogLimits {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Logs) DeepCopyInto(out *Logs) {
*out = *in
out.CollectorMeta = in.CollectorMeta
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
*out = make([]string, len(*in))
Expand Down Expand Up @@ -1135,6 +1154,7 @@ func (in *Put) DeepCopy() *Put {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Run) DeepCopyInto(out *Run) {
*out = *in
out.CollectorMeta = in.CollectorMeta
if in.Command != nil {
in, out := &in.Command, &out.Command
*out = make([]string, len(*in))
Expand All @@ -1160,6 +1180,7 @@ func (in *Run) DeepCopy() *Run {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Secret) DeepCopyInto(out *Secret) {
*out = *in
out.CollectorMeta = in.CollectorMeta
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Secret.
Expand Down
16 changes: 8 additions & 8 deletions config/samples/troubleshoot_v1beta1_collector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@ spec:
# maxAge: 30d
# maxLines: 10000
# - run:
# name: ping-google
# collectorName: ping-google
# namespace: default
# image: flungo/netutils
# command: ["ping"]
# args: ["www.google.com"]
# timeout: 5s
- exec:
name: mysql-vars
collectorName: mysql-vars
selector:
- app=mysql
namespace: default
command: ["mysql"]
args: ["-ureplicated", "-ppassword", "-e", "show processlist"]
timeout: 60m
- exec:
name: hosts
collectorName: hosts
selector:
- app=graphql-api
namespace: default
command: ["cat"]
args: ["/etc/hosts"]
timeout: 60m
- exec:
name: broken
collectorName: broken
selector:
- app=graphql-api
namespace: default
Expand All @@ -53,26 +53,26 @@ spec:
# namespace: default
# containerPath: /etc/hosts
- http:
name: test-get
collectorName: test-get
get:
url: https://api.staging.replicated.com/market/v1/echo/ip
insecureSkipVerify: false
headers: {}
- http:
name: test-post
collectorName: test-post
post:
url: http://httpbin.org/headers
insecureSkipVerify: false
headers:
X-Custom-Header: "post-request"
- http:
name: test-put
collectorName: test-put
put:
url: http://httpbin.org/anything
insecureSkipVerify: false
headers:
X-Custom-Header: "put-request"
- http:
name: test-broken
collectorName: test-broken
put:
url: ""
Loading

0 comments on commit be2fa18

Please sign in to comment.