Skip to content

Commit 0437e9e

Browse files
committed
http collector
1 parent 997a220 commit 0437e9e

File tree

10 files changed

+520
-12
lines changed

10 files changed

+520
-12
lines changed

config/crds/troubleshoot.replicated.com_collectors.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,56 @@ spec:
413413
- namespace
414414
- containerPath
415415
type: object
416+
http:
417+
properties:
418+
get:
419+
properties:
420+
headers:
421+
additionalProperties:
422+
type: string
423+
type: object
424+
insecureSkipVerify:
425+
type: boolean
426+
url:
427+
type: string
428+
required:
429+
- url
430+
type: object
431+
name:
432+
type: string
433+
post:
434+
properties:
435+
body:
436+
type: string
437+
headers:
438+
additionalProperties:
439+
type: string
440+
type: object
441+
insecureSkipVerify:
442+
type: boolean
443+
url:
444+
type: string
445+
required:
446+
- url
447+
type: object
448+
put:
449+
properties:
450+
body:
451+
type: string
452+
headers:
453+
additionalProperties:
454+
type: string
455+
type: object
456+
insecureSkipVerify:
457+
type: boolean
458+
url:
459+
type: string
460+
required:
461+
- url
462+
type: object
463+
required:
464+
- name
465+
type: object
416466
logs:
417467
properties:
418468
limits:

config/crds/troubleshoot.replicated.com_preflights.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,56 @@ spec:
635635
- namespace
636636
- containerPath
637637
type: object
638+
http:
639+
properties:
640+
get:
641+
properties:
642+
headers:
643+
additionalProperties:
644+
type: string
645+
type: object
646+
insecureSkipVerify:
647+
type: boolean
648+
url:
649+
type: string
650+
required:
651+
- url
652+
type: object
653+
name:
654+
type: string
655+
post:
656+
properties:
657+
body:
658+
type: string
659+
headers:
660+
additionalProperties:
661+
type: string
662+
type: object
663+
insecureSkipVerify:
664+
type: boolean
665+
url:
666+
type: string
667+
required:
668+
- url
669+
type: object
670+
put:
671+
properties:
672+
body:
673+
type: string
674+
headers:
675+
additionalProperties:
676+
type: string
677+
type: object
678+
insecureSkipVerify:
679+
type: boolean
680+
url:
681+
type: string
682+
required:
683+
- url
684+
type: object
685+
required:
686+
- name
687+
type: object
638688
logs:
639689
properties:
640690
limits:

config/crds/zz_generated.deepcopy.go

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,11 @@ func (in *Collect) DeepCopyInto(out *Collect) {
358358
*out = new(Copy)
359359
(*in).DeepCopyInto(*out)
360360
}
361+
if in.HTTP != nil {
362+
in, out := &in.HTTP, &out.HTTP
363+
*out = new(HTTP)
364+
(*in).DeepCopyInto(*out)
365+
}
361366
}
362367

363368
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Collect.
@@ -621,6 +626,58 @@ func (in *CustomResourceDefinition) DeepCopy() *CustomResourceDefinition {
621626
return out
622627
}
623628

629+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
630+
func (in *Get) DeepCopyInto(out *Get) {
631+
*out = *in
632+
if in.Headers != nil {
633+
in, out := &in.Headers, &out.Headers
634+
*out = make(map[string]string, len(*in))
635+
for key, val := range *in {
636+
(*out)[key] = val
637+
}
638+
}
639+
}
640+
641+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Get.
642+
func (in *Get) DeepCopy() *Get {
643+
if in == nil {
644+
return nil
645+
}
646+
out := new(Get)
647+
in.DeepCopyInto(out)
648+
return out
649+
}
650+
651+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
652+
func (in *HTTP) DeepCopyInto(out *HTTP) {
653+
*out = *in
654+
if in.Get != nil {
655+
in, out := &in.Get, &out.Get
656+
*out = new(Get)
657+
(*in).DeepCopyInto(*out)
658+
}
659+
if in.Post != nil {
660+
in, out := &in.Post, &out.Post
661+
*out = new(Post)
662+
(*in).DeepCopyInto(*out)
663+
}
664+
if in.Put != nil {
665+
in, out := &in.Put, &out.Put
666+
*out = new(Put)
667+
(*in).DeepCopyInto(*out)
668+
}
669+
}
670+
671+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTP.
672+
func (in *HTTP) DeepCopy() *HTTP {
673+
if in == nil {
674+
return nil
675+
}
676+
out := new(HTTP)
677+
in.DeepCopyInto(out)
678+
return out
679+
}
680+
624681
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
625682
func (in *Ingress) DeepCopyInto(out *Ingress) {
626683
*out = *in
@@ -718,6 +775,28 @@ func (in *Outcome) DeepCopy() *Outcome {
718775
return out
719776
}
720777

778+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
779+
func (in *Post) DeepCopyInto(out *Post) {
780+
*out = *in
781+
if in.Headers != nil {
782+
in, out := &in.Headers, &out.Headers
783+
*out = make(map[string]string, len(*in))
784+
for key, val := range *in {
785+
(*out)[key] = val
786+
}
787+
}
788+
}
789+
790+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Post.
791+
func (in *Post) DeepCopy() *Post {
792+
if in == nil {
793+
return nil
794+
}
795+
out := new(Post)
796+
in.DeepCopyInto(out)
797+
return out
798+
}
799+
721800
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
722801
func (in *Preflight) DeepCopyInto(out *Preflight) {
723802
*out = *in
@@ -964,6 +1043,28 @@ func (in *PreflightStatus) DeepCopy() *PreflightStatus {
9641043
return out
9651044
}
9661045

1046+
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
1047+
func (in *Put) DeepCopyInto(out *Put) {
1048+
*out = *in
1049+
if in.Headers != nil {
1050+
in, out := &in.Headers, &out.Headers
1051+
*out = make(map[string]string, len(*in))
1052+
for key, val := range *in {
1053+
(*out)[key] = val
1054+
}
1055+
}
1056+
}
1057+
1058+
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Put.
1059+
func (in *Put) DeepCopy() *Put {
1060+
if in == nil {
1061+
return nil
1062+
}
1063+
out := new(Put)
1064+
in.DeepCopyInto(out)
1065+
return out
1066+
}
1067+
9671068
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
9681069
func (in *Run) DeepCopyInto(out *Run) {
9691070
*out = *in

config/samples/troubleshoot_v1beta1_collector.yaml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,33 @@ spec:
2222
# image: flungo/netutils
2323
# command: ["ping"]
2424
# args: ["www.google.com"]
25-
# # timeout: 5s
26-
- copy:
27-
selector:
28-
- app=illmannered-cricket-mysql
29-
namespace: default
30-
containerPath: /etc/hosts
25+
# timeout: 5s
26+
# - copy:
27+
# selector:
28+
# - app=illmannered-cricket-mysql
29+
# namespace: default
30+
# containerPath: /etc/hosts
31+
- http:
32+
name: test-get
33+
get:
34+
url: https://api.staging.replicated.com/market/v1/echo/ip
35+
insecureSkipVerify: false
36+
headers: {}
37+
- http:
38+
name: test-post
39+
post:
40+
url: http://httpbin.org/headers
41+
insecureSkipVerify: false
42+
headers:
43+
X-Custom-Header: "post-request"
44+
- http:
45+
name: test-put
46+
put:
47+
url: http://httpbin.org/anything
48+
insecureSkipVerify: false
49+
headers:
50+
X-Custom-Header: "put-request"
51+
- http:
52+
name: test-broken
53+
put:
54+
url: ""

pkg/apis/troubleshoot/v1beta1/collector_shared.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,39 @@ type Copy struct {
4141
ContainerName string `json:"containerName,omitempty" yaml:"containerName,omitempty"`
4242
}
4343

44+
type HTTP struct {
45+
Name string `json:"name" yaml:"name"`
46+
Get *Get `json:"get,omitempty" yaml:"get,omitempty"`
47+
Post *Post `json:"post,omitempty" yaml:"post,omitempty"`
48+
Put *Put `json:"put,omitempty" yaml:"put,omitempty"`
49+
}
50+
51+
type Get struct {
52+
URL string `json:"url" yaml:"url"`
53+
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"`
54+
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`
55+
}
56+
57+
type Post struct {
58+
URL string `json:"url" yaml:"url"`
59+
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"`
60+
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`
61+
Body string `json:"body,omitempty" yaml:"body,omitempty"`
62+
}
63+
64+
type Put struct {
65+
URL string `json:"url" yaml:"url"`
66+
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"`
67+
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`
68+
Body string `json:"body,omitempty" yaml:"body,omitempty"`
69+
}
70+
4471
type Collect struct {
4572
ClusterInfo *ClusterInfo `json:"clusterInfo,omitempty" yaml:"clusterInfo,omitempty"`
4673
ClusterResources *ClusterResources `json:"clusterResources,omitempty" yaml:"clusterResources,omitempty"`
4774
Secret *Secret `json:"secret,omitempty" yaml:"secret,omitempty"`
4875
Logs *Logs `json:"logs,omitempty" yaml:"logs,omitempty"`
4976
Run *Run `json:"run,omitempty" yaml:"run,omitempty"`
5077
Copy *Copy `json:"copy,omitempty" yaml:"copy,omitempty"`
78+
HTTP *HTTP `json:"http,omitempty" yaml:"http,omitempty"`
5179
}

0 commit comments

Comments
 (0)