Skip to content

Commit 83f02f4

Browse files
authored
feat: Install goldpinger daemonset if one does not exist when running 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 <[email protected]> * Add missing test data file Signed-off-by: Evans Mungai <[email protected]> * Better naming of create resource functions Signed-off-by: Evans Mungai <[email protected]> --------- Signed-off-by: Evans Mungai <[email protected]>
1 parent 2f78fee commit 83f02f4

File tree

12 files changed

+470
-66
lines changed

12 files changed

+470
-66
lines changed

config/crds/troubleshoot.sh_collectors.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ spec:
348348
type: object
349349
goldpinger:
350350
properties:
351+
collectDelay:
352+
type: string
351353
collectorName:
352354
type: string
353355
exclude:
@@ -374,6 +376,8 @@ spec:
374376
serviceAccountName:
375377
type: string
376378
type: object
379+
serviceAccountName:
380+
type: string
377381
type: object
378382
helm:
379383
properties:

config/crds/troubleshoot.sh_preflights.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,6 +2077,8 @@ spec:
20772077
type: object
20782078
goldpinger:
20792079
properties:
2080+
collectDelay:
2081+
type: string
20802082
collectorName:
20812083
type: string
20822084
exclude:
@@ -2103,6 +2105,8 @@ spec:
21032105
serviceAccountName:
21042106
type: string
21052107
type: object
2108+
serviceAccountName:
2109+
type: string
21062110
type: object
21072111
helm:
21082112
properties:

config/crds/troubleshoot.sh_supportbundles.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,6 +2108,8 @@ spec:
21082108
type: object
21092109
goldpinger:
21102110
properties:
2111+
collectDelay:
2112+
type: string
21112113
collectorName:
21122114
type: string
21132115
exclude:
@@ -2134,6 +2136,8 @@ spec:
21342136
serviceAccountName:
21352137
type: string
21362138
type: object
2139+
serviceAccountName:
2140+
type: string
21372141
type: object
21382142
helm:
21392143
properties:

pkg/analyze/goldpinger_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,18 @@ func TestAnalyzeGoldpinger_podPingsAnalysis(t *testing.T) {
9696
},
9797
},
9898
},
99+
{
100+
name: "no ping errors for one pod",
101+
cao: caoFixture(t, "goldpinger/checkall-one-pod.json"),
102+
want: []*AnalyzeResult{
103+
{
104+
Title: "Pings to \"gp-goldpinger-xn9rg\" pod succeeded",
105+
Message: "Pings to \"gp-goldpinger-xn9rg\" pod from all other pods in the cluster succeeded",
106+
IconKey: "kubernetes",
107+
IsPass: true,
108+
},
109+
},
110+
},
99111
}
100112
for _, tt := range tests {
101113
t.Run(tt.name, func(t *testing.T) {

pkg/apis/troubleshoot/v1beta2/collector_shared.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,11 @@ type Helm struct {
277277
}
278278

279279
type Goldpinger struct {
280-
CollectorMeta `json:",inline" yaml:",inline"`
281-
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
282-
PodLaunchOptions *PodLaunchOptions `json:"podLaunchOptions,omitempty" yaml:"podLaunchOptions,omitempty"`
280+
CollectorMeta `json:",inline" yaml:",inline"`
281+
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
282+
ServiceAccountName string `json:"serviceAccountName,omitempty" yaml:"serviceAccountName,omitempty"`
283+
CollectDelay string `json:"collectDelay,omitempty" yaml:"collectDelay,omitempty"`
284+
PodLaunchOptions *PodLaunchOptions `json:"podLaunchOptions,omitempty" yaml:"podLaunchOptions,omitempty"`
283285
}
284286

285287
type PodLaunchOptions struct {

0 commit comments

Comments
 (0)