Skip to content

Commit

Permalink
feat: Install goldpinger if one does not exist when running goldpinge…
Browse files Browse the repository at this point in the history
…r collector

- Deploy golpinger daemonset if one is not detected in the cluster
- Clean up all deployed resources
- Add delay to allow users to wait for goldpinger to perform checks

Signed-off-by: Evans Mungai <evans@replicated.com>
  • Loading branch information
banjoh committed Sep 24, 2024
1 parent d73082a commit fd6e536
Show file tree
Hide file tree
Showing 11 changed files with 440 additions and 66 deletions.
4 changes: 4 additions & 0 deletions config/crds/troubleshoot.sh_collectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ spec:
type: object
goldpinger:
properties:
collectDelay:
type: string
collectorName:
type: string
exclude:
Expand All @@ -374,6 +376,8 @@ spec:
serviceAccountName:
type: string
type: object
serviceAccountName:
type: string
type: object
helm:
properties:
Expand Down
4 changes: 4 additions & 0 deletions config/crds/troubleshoot.sh_preflights.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2077,6 +2077,8 @@ spec:
type: object
goldpinger:
properties:
collectDelay:
type: string
collectorName:
type: string
exclude:
Expand All @@ -2103,6 +2105,8 @@ spec:
serviceAccountName:
type: string
type: object
serviceAccountName:
type: string
type: object
helm:
properties:
Expand Down
4 changes: 4 additions & 0 deletions config/crds/troubleshoot.sh_supportbundles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2108,6 +2108,8 @@ spec:
type: object
goldpinger:
properties:
collectDelay:
type: string
collectorName:
type: string
exclude:
Expand All @@ -2134,6 +2136,8 @@ spec:
serviceAccountName:
type: string
type: object
serviceAccountName:
type: string
type: object
helm:
properties:
Expand Down
12 changes: 12 additions & 0 deletions pkg/analyze/goldpinger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ func TestAnalyzeGoldpinger_podPingsAnalysis(t *testing.T) {
},
},
},
{
name: "no ping errors for one pod",
cao: caoFixture(t, "goldpinger/checkall-one-pod.json"),
want: []*AnalyzeResult{
{
Title: "Pings to \"gp-goldpinger-xn9rg\" pod succeeded",
Message: "Pings to \"gp-goldpinger-xn9rg\" pod from all other pods in the cluster succeeded",
IconKey: "kubernetes",
IsPass: true,
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
8 changes: 5 additions & 3 deletions pkg/apis/troubleshoot/v1beta2/collector_shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,11 @@ type Helm struct {
}

type Goldpinger struct {
CollectorMeta `json:",inline" yaml:",inline"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
PodLaunchOptions *PodLaunchOptions `json:"podLaunchOptions,omitempty" yaml:"podLaunchOptions,omitempty"`
CollectorMeta `json:",inline" yaml:",inline"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty" yaml:"serviceAccountName,omitempty"`
CollectDelay string `json:"collectDelay,omitempty" yaml:"collectDelay,omitempty"`
PodLaunchOptions *PodLaunchOptions `json:"podLaunchOptions,omitempty" yaml:"podLaunchOptions,omitempty"`
}

type PodLaunchOptions struct {
Expand Down
Loading

0 comments on commit fd6e536

Please sign in to comment.