Skip to content

Commit

Permalink
feat: Install goldpinger daemonset if one does not exist when running…
Browse files Browse the repository at this point in the history
… goldpinger collector (#1619)

* feat: Install goldpinger if one does not exist when running goldpinger 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>

* Add missing test data file

Signed-off-by: Evans Mungai <evans@replicated.com>

* Better naming of create resource functions

Signed-off-by: Evans Mungai <evans@replicated.com>

---------

Signed-off-by: Evans Mungai <evans@replicated.com>
  • Loading branch information
banjoh authored Sep 24, 2024
1 parent 2f78fee commit 83f02f4
Show file tree
Hide file tree
Showing 12 changed files with 470 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 83f02f4

Please sign in to comment.