Skip to content

Commit

Permalink
http collector
Browse files Browse the repository at this point in the history
  • Loading branch information
divolgin committed Jul 19, 2019
1 parent 997a220 commit 0437e9e
Show file tree
Hide file tree
Showing 10 changed files with 520 additions and 12 deletions.
50 changes: 50 additions & 0 deletions config/crds/troubleshoot.replicated.com_collectors.yaml
Expand Up @@ -413,6 +413,56 @@ spec:
- namespace
- containerPath
type: object
http:
properties:
get:
properties:
headers:
additionalProperties:
type: string
type: object
insecureSkipVerify:
type: boolean
url:
type: string
required:
- url
type: object
name:
type: string
post:
properties:
body:
type: string
headers:
additionalProperties:
type: string
type: object
insecureSkipVerify:
type: boolean
url:
type: string
required:
- url
type: object
put:
properties:
body:
type: string
headers:
additionalProperties:
type: string
type: object
insecureSkipVerify:
type: boolean
url:
type: string
required:
- url
type: object
required:
- name
type: object
logs:
properties:
limits:
Expand Down
50 changes: 50 additions & 0 deletions config/crds/troubleshoot.replicated.com_preflights.yaml
Expand Up @@ -635,6 +635,56 @@ spec:
- namespace
- containerPath
type: object
http:
properties:
get:
properties:
headers:
additionalProperties:
type: string
type: object
insecureSkipVerify:
type: boolean
url:
type: string
required:
- url
type: object
name:
type: string
post:
properties:
body:
type: string
headers:
additionalProperties:
type: string
type: object
insecureSkipVerify:
type: boolean
url:
type: string
required:
- url
type: object
put:
properties:
body:
type: string
headers:
additionalProperties:
type: string
type: object
insecureSkipVerify:
type: boolean
url:
type: string
required:
- url
type: object
required:
- name
type: object
logs:
properties:
limits:
Expand Down
101 changes: 101 additions & 0 deletions config/crds/zz_generated.deepcopy.go
Expand Up @@ -358,6 +358,11 @@ func (in *Collect) DeepCopyInto(out *Collect) {
*out = new(Copy)
(*in).DeepCopyInto(*out)
}
if in.HTTP != nil {
in, out := &in.HTTP, &out.HTTP
*out = new(HTTP)
(*in).DeepCopyInto(*out)
}
}

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

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Get) DeepCopyInto(out *Get) {
*out = *in
if in.Headers != nil {
in, out := &in.Headers, &out.Headers
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}

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

// 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
if in.Get != nil {
in, out := &in.Get, &out.Get
*out = new(Get)
(*in).DeepCopyInto(*out)
}
if in.Post != nil {
in, out := &in.Post, &out.Post
*out = new(Post)
(*in).DeepCopyInto(*out)
}
if in.Put != nil {
in, out := &in.Put, &out.Put
*out = new(Put)
(*in).DeepCopyInto(*out)
}
}

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

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Ingress) DeepCopyInto(out *Ingress) {
*out = *in
Expand Down Expand Up @@ -718,6 +775,28 @@ func (in *Outcome) DeepCopy() *Outcome {
return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Post) DeepCopyInto(out *Post) {
*out = *in
if in.Headers != nil {
in, out := &in.Headers, &out.Headers
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}

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

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Preflight) DeepCopyInto(out *Preflight) {
*out = *in
Expand Down Expand Up @@ -964,6 +1043,28 @@ func (in *PreflightStatus) DeepCopy() *PreflightStatus {
return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Put) DeepCopyInto(out *Put) {
*out = *in
if in.Headers != nil {
in, out := &in.Headers, &out.Headers
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}

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

// 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
Expand Down
36 changes: 30 additions & 6 deletions config/samples/troubleshoot_v1beta1_collector.yaml
Expand Up @@ -22,9 +22,33 @@ spec:
# image: flungo/netutils
# command: ["ping"]
# args: ["www.google.com"]
# # timeout: 5s
- copy:
selector:
- app=illmannered-cricket-mysql
namespace: default
containerPath: /etc/hosts
# timeout: 5s
# - copy:
# selector:
# - app=illmannered-cricket-mysql
# namespace: default
# containerPath: /etc/hosts
- http:
name: test-get
get:
url: https://api.staging.replicated.com/market/v1/echo/ip
insecureSkipVerify: false
headers: {}
- http:
name: test-post
post:
url: http://httpbin.org/headers
insecureSkipVerify: false
headers:
X-Custom-Header: "post-request"
- http:
name: test-put
put:
url: http://httpbin.org/anything
insecureSkipVerify: false
headers:
X-Custom-Header: "put-request"
- http:
name: test-broken
put:
url: ""
28 changes: 28 additions & 0 deletions pkg/apis/troubleshoot/v1beta1/collector_shared.go
Expand Up @@ -41,11 +41,39 @@ type Copy struct {
ContainerName string `json:"containerName,omitempty" yaml:"containerName,omitempty"`
}

type HTTP struct {
Name string `json:"name" yaml:"name"`
Get *Get `json:"get,omitempty" yaml:"get,omitempty"`
Post *Post `json:"post,omitempty" yaml:"post,omitempty"`
Put *Put `json:"put,omitempty" yaml:"put,omitempty"`
}

type Get struct {
URL string `json:"url" yaml:"url"`
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"`
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`
}

type Post struct {
URL string `json:"url" yaml:"url"`
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"`
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`
Body string `json:"body,omitempty" yaml:"body,omitempty"`
}

type Put struct {
URL string `json:"url" yaml:"url"`
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"`
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`
Body string `json:"body,omitempty" yaml:"body,omitempty"`
}

type Collect struct {
ClusterInfo *ClusterInfo `json:"clusterInfo,omitempty" yaml:"clusterInfo,omitempty"`
ClusterResources *ClusterResources `json:"clusterResources,omitempty" yaml:"clusterResources,omitempty"`
Secret *Secret `json:"secret,omitempty" yaml:"secret,omitempty"`
Logs *Logs `json:"logs,omitempty" yaml:"logs,omitempty"`
Run *Run `json:"run,omitempty" yaml:"run,omitempty"`
Copy *Copy `json:"copy,omitempty" yaml:"copy,omitempty"`
HTTP *HTTP `json:"http,omitempty" yaml:"http,omitempty"`
}

0 comments on commit 0437e9e

Please sign in to comment.