Skip to content

Commit f58f025

Browse files
Allow goldpinger / goldpinger util images to be set in collector spec (#1635)
* Add image parameter to the goldpinger collector * Pass image directly as a function arg Also allow util image to be set in spec * Remove pointless util image override * Update pkg/collect/goldpinger.go Co-authored-by: Evans Mungai <[email protected]> * Simplify image override --------- Co-authored-by: Evans Mungai <[email protected]>
1 parent 2efbc20 commit f58f025

File tree

6 files changed

+19
-1
lines changed

6 files changed

+19
-1
lines changed

config/crds/troubleshoot.sh_collectors.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ spec:
354354
type: string
355355
exclude:
356356
type: BoolString
357+
image:
358+
type: string
357359
namespace:
358360
type: string
359361
podLaunchOptions:

config/crds/troubleshoot.sh_preflights.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,6 +2083,8 @@ spec:
20832083
type: string
20842084
exclude:
20852085
type: BoolString
2086+
image:
2087+
type: string
20862088
namespace:
20872089
type: string
20882090
podLaunchOptions:

pkg/apis/troubleshoot/v1beta2/collector_shared.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ type Helm struct {
279279
type Goldpinger struct {
280280
CollectorMeta `json:",inline" yaml:",inline"`
281281
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
282+
Image string `json:"image,omitempty" yaml:"image,omitempty"`
282283
ServiceAccountName string `json:"serviceAccountName,omitempty" yaml:"serviceAccountName,omitempty"`
283284
CollectDelay string `json:"collectDelay,omitempty" yaml:"collectDelay,omitempty"`
284285
PodLaunchOptions *PodLaunchOptions `json:"podLaunchOptions,omitempty" yaml:"podLaunchOptions,omitempty"`

pkg/collect/goldpinger.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import (
2626
"k8s.io/utils/ptr"
2727
)
2828

29+
var goldpingerImage = "bloomberg/goldpinger:3.10.1"
30+
2931
// Collect goldpinger results from goldpinger service running in a cluster
3032
// The results are stored in goldpinger/check_all.json since we use
3133
// the /check_all endpoint
@@ -299,6 +301,10 @@ func (c *CollectGoldpinger) createGoldpingerRoleBinding(ns string) (*rbacv1.Role
299301
func (c *CollectGoldpinger) createGoldpingerDaemonSet(ns, svcAccName string) (*appsv1.DaemonSet, error) {
300302
ds := &appsv1.DaemonSet{}
301303

304+
if c.Collector.Image != "" {
305+
goldpingerImage = c.Collector.Image
306+
}
307+
302308
ds.ObjectMeta = metav1.ObjectMeta{
303309
Name: "ts-goldpinger",
304310
Namespace: ns,
@@ -320,7 +326,7 @@ func (c *CollectGoldpinger) createGoldpingerDaemonSet(ns, svcAccName string) (*a
320326
Containers: []corev1.Container{
321327
{
322328
Name: "goldpinger-daemon",
323-
Image: "bloomberg/goldpinger:3.10.1",
329+
Image: goldpingerImage,
324330
ImagePullPolicy: corev1.PullIfNotPresent,
325331
Env: []corev1.EnvVar{
326332
{
@@ -479,6 +485,7 @@ func (c *CollectGoldpinger) runPodAndCollectGPResults(url string, progressChan c
479485
namespace := "default"
480486
serviceAccountName := ""
481487
image := constants.GP_DEFAULT_IMAGE
488+
482489
var imagePullSecret *troubleshootv1beta2.ImagePullSecrets
483490

484491
if c.Collector.PodLaunchOptions != nil {

schemas/collector-troubleshoot-v1beta2.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,9 @@
484484
"exclude": {
485485
"oneOf": [{"type": "string"},{"type": "boolean"}]
486486
},
487+
"image": {
488+
"type": "string"
489+
},
487490
"namespace": {
488491
"type": "string"
489492
},

schemas/preflight-troubleshoot-v1beta2.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3148,6 +3148,9 @@
31483148
"exclude": {
31493149
"oneOf": [{"type": "string"},{"type": "boolean"}]
31503150
},
3151+
"image": {
3152+
"type": "string"
3153+
},
31513154
"namespace": {
31523155
"type": "string"
31533156
},

0 commit comments

Comments
 (0)