Skip to content

Commit

Permalink
A few more updates when testing with kURL
Browse files Browse the repository at this point in the history
  • Loading branch information
banjoh committed Dec 11, 2023
1 parent d8f61d9 commit eedb830
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 42 deletions.
1 change: 0 additions & 1 deletion config/crds/troubleshoot.sh_analyzers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,6 @@ spec:
type: BoolString
required:
- collectorName
- outcomes
type: object
imagePullSecret:
properties:
Expand Down
2 changes: 0 additions & 2 deletions config/crds/troubleshoot.sh_collectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@ spec:
type: string
serviceAccountName:
type: string
required:
- image
type: object
type: object
helm:
Expand Down
3 changes: 0 additions & 3 deletions config/crds/troubleshoot.sh_preflights.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,6 @@ spec:
type: BoolString
required:
- collectorName
- outcomes
type: object
imagePullSecret:
properties:
Expand Down Expand Up @@ -1907,8 +1906,6 @@ spec:
type: string
serviceAccountName:
type: string
required:
- image
type: object
type: object
helm:
Expand Down
3 changes: 0 additions & 3 deletions config/crds/troubleshoot.sh_supportbundles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,6 @@ spec:
type: BoolString
required:
- collectorName
- outcomes
type: object
imagePullSecret:
properties:
Expand Down Expand Up @@ -1938,8 +1937,6 @@ spec:
type: string
serviceAccountName:
type: string
required:
- image
type: object
type: object
helm:
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/troubleshoot/v1beta2/analyzer_shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ type CertificatesAnalyze struct {

type GoldpingerAnalyze struct {
AnalyzeMeta `json:",inline" yaml:",inline"`
Outcomes []*Outcome `json:"outcomes" yaml:"outcomes"`
Outcomes []*Outcome `json:"outcomes,omitempty" yaml:"outcomes,omitempty"`
CollectorName string `json:"collectorName" yaml:"collectorName"`
FilePath string `json:"filePath,omitempty" yaml:"filePath,omitempty"`
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/troubleshoot/v1beta2/collector_shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ 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"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
PodLaunchOptions *PodLaunchOptions `json:"podLaunchOptions,omitempty" yaml:"podLaunchOptions,omitempty"`
}

type PodLaunchOptions struct {
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
Image string `json:"image" yaml:"image"`
Image string `json:"image,omitempty" yaml:"image,omitempty"`
ImagePullSecret *ImagePullSecrets `json:"imagePullSecret,omitempty" yaml:"imagePullSecret,omitempty"`
ServiceAccountName string `json:"serviceAccountName,omitempty" yaml:"serviceAccountName,omitempty"`
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/apis/troubleshoot/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 18 additions & 13 deletions pkg/collect/goldpinger.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,26 @@ func (c *CollectGoldpinger) runPodAndCollectGPResults(progressChan chan<- interf
rest.InClusterConfig()

namespace := "default"
if c.Collector.PodLaunchOptions.Namespace != "" {
namespace = c.Collector.PodLaunchOptions.Namespace
}

serviceAccountName := ""
if c.Collector.PodLaunchOptions.ServiceAccountName != "" {
serviceAccountName = c.Collector.PodLaunchOptions.ServiceAccountName
if err := checkForExistingServiceAccount(c.Context, c.Client, namespace, serviceAccountName); err != nil {
return nil, err
image := constants.GP_DEFAULT_IMAGE
var imagePullSecret *troubleshootv1beta2.ImagePullSecrets

if c.Collector.PodLaunchOptions != nil {
if c.Collector.PodLaunchOptions.Namespace != "" {
namespace = c.Collector.PodLaunchOptions.Namespace
}
}

image := constants.GP_DEFAULT_IMAGE
if c.Collector.PodLaunchOptions.Image != "" {
image = c.Collector.PodLaunchOptions.Image
if c.Collector.PodLaunchOptions.ServiceAccountName != "" {
serviceAccountName = c.Collector.PodLaunchOptions.ServiceAccountName
if err := checkForExistingServiceAccount(c.Context, c.Client, namespace, serviceAccountName); err != nil {
return nil, err
}
}

if c.Collector.PodLaunchOptions.Image != "" {
image = c.Collector.PodLaunchOptions.Image
}
imagePullSecret = c.Collector.PodLaunchOptions.ImagePullSecret
}

runPodCollectorName := "ts-goldpinger-collector"
Expand All @@ -129,7 +134,7 @@ func (c *CollectGoldpinger) runPodAndCollectGPResults(progressChan chan<- interf
Name: runPodCollectorName,
Namespace: namespace,
Timeout: time.Minute.String(),
ImagePullSecret: c.Collector.PodLaunchOptions.ImagePullSecret,
ImagePullSecret: imagePullSecret,
PodSpec: corev1.PodSpec{
RestartPolicy: corev1.RestartPolicyNever,
ServiceAccountName: serviceAccountName,
Expand Down
3 changes: 1 addition & 2 deletions schemas/analyzer-troubleshoot-v1beta2.json
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,7 @@
"goldpinger": {
"type": "object",
"required": [
"collectorName",
"outcomes"
"collectorName"
],
"properties": {
"annotations": {
Expand Down
3 changes: 0 additions & 3 deletions schemas/collector-troubleshoot-v1beta2.json
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,6 @@
},
"podLaunchOptions": {
"type": "object",
"required": [
"image"
],
"properties": {
"image": {
"type": "string"
Expand Down
6 changes: 1 addition & 5 deletions schemas/preflight-troubleshoot-v1beta2.json
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,7 @@
"goldpinger": {
"type": "object",
"required": [
"collectorName",
"outcomes"
"collectorName"
],
"properties": {
"annotations": {
Expand Down Expand Up @@ -2855,9 +2854,6 @@
},
"podLaunchOptions": {
"type": "object",
"required": [
"image"
],
"properties": {
"image": {
"type": "string"
Expand Down
6 changes: 1 addition & 5 deletions schemas/supportbundle-troubleshoot-v1beta2.json
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,7 @@
"goldpinger": {
"type": "object",
"required": [
"collectorName",
"outcomes"
"collectorName"
],
"properties": {
"annotations": {
Expand Down Expand Up @@ -2901,9 +2900,6 @@
},
"podLaunchOptions": {
"type": "object",
"required": [
"image"
],
"properties": {
"image": {
"type": "string"
Expand Down

0 comments on commit eedb830

Please sign in to comment.