Skip to content

Commit d0a0d92

Browse files
committed
Cleaning up name / collectorName
1 parent fd257b5 commit d0a0d92

File tree

10 files changed

+10
-233
lines changed

10 files changed

+10
-233
lines changed

cmd/preflight/cli/root.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@ that a cluster meets the requirements to run an application.`,
2727
},
2828
RunE: func(cmd *cobra.Command, args []string) error {
2929
v := viper.GetViper()
30-
31-
if len(args) == 0 {
32-
return runPreflightsCRD(v)
33-
}
34-
35-
return runPreflightsNoCRD(v, args[0])
30+
return runPreflights(v, args[0])
3631
},
3732
}
3833

cmd/preflight/cli/run_nocrd.go renamed to cmd/preflight/cli/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"gopkg.in/yaml.v2"
2323
)
2424

25-
func runPreflightsNoCRD(v *viper.Viper, arg string) error {
25+
func runPreflights(v *viper.Viper, arg string) error {
2626
fmt.Print(cursor.Hide())
2727
defer fmt.Print(cursor.Show())
2828

cmd/preflight/cli/run_crd.go

Lines changed: 0 additions & 107 deletions
This file was deleted.

cmd/troubleshoot/cli/root.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,7 @@ from a server that can be used to assist when troubleshooting a server.`,
3030
v := viper.GetViper()
3131

3232
logger.SetQuiet(v.GetBool("quiet"))
33-
34-
if len(args) == 0 {
35-
return runTroubleshootCRD(v)
36-
}
37-
38-
return runTroubleshootNoCRD(v, args[0])
33+
return runTroubleshoot(v, args[0])
3934
},
4035
}
4136

cmd/troubleshoot/cli/run_nocrd.go renamed to cmd/troubleshoot/cli/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"gopkg.in/yaml.v2"
2323
)
2424

25-
func runTroubleshootNoCRD(v *viper.Viper, arg string) error {
25+
func runTroubleshoot(v *viper.Viper, arg string) error {
2626
fmt.Print(cursor.Hide())
2727
defer fmt.Print(cursor.Show())
2828

cmd/troubleshoot/cli/run_crd.go

Lines changed: 0 additions & 106 deletions
This file was deleted.

pkg/apis/troubleshoot/v1beta1/collector_shared.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type ClusterResources struct {
1212

1313
type Secret struct {
1414
CollectorMeta `json:",inline" yaml:",inline"`
15-
Name string `json:"name" yaml:"name"`
15+
SecretName string `json:"name" yaml:"name"`
1616
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
1717
Key string `json:"key,omitempty" yaml:"key,omitempty"`
1818
IncludeValue bool `json:"includeValue,omitempty" yaml:"includeValue,omitempty"`

pkg/collect/secret.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ func Secret(ctx *Context, secretCollector *troubleshootv1beta1.Secret) ([]byte,
6060
}
6161

6262
func secret(client *kubernetes.Clientset, secretCollector *troubleshootv1beta1.Secret) (*FoundSecret, []byte, error) {
63-
found, err := client.CoreV1().Secrets(secretCollector.Namespace).Get(secretCollector.Name, metav1.GetOptions{})
63+
found, err := client.CoreV1().Secrets(secretCollector.Namespace).Get(secretCollector.SecretName, metav1.GetOptions{})
6464
if err != nil {
6565
missingSecret := FoundSecret{
6666
Namespace: secretCollector.Namespace,
67-
Name: secretCollector.Name,
67+
Name: secretCollector.SecretName,
6868
SecretExists: false,
6969
}
7070

pkg/collect/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func DeterministicIDForCollector(collector *troubleshootv1beta1.Collect) string
2222
}
2323

2424
if collector.Secret != nil {
25-
unsafeID = fmt.Sprintf("secret-%s-%s", collector.Secret.Namespace, collector.Secret.Name)
25+
unsafeID = fmt.Sprintf("secret-%s-%s", collector.Secret.Namespace, collector.Secret.SecretName)
2626
}
2727

2828
if collector.Logs != nil {

pkg/collect/util_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ func Test_DeterministicIDForCollector(t *testing.T) {
5252
name: "secret",
5353
collector: &troubleshootv1beta1.Collect{
5454
Secret: &troubleshootv1beta1.Secret{
55-
Name: "secret-agent-woman",
56-
Namespace: "top-secret",
55+
SecretName: "secret-agent-woman",
56+
Namespace: "top-secret",
5757
},
5858
},
5959
expect: "secret-top-secret-secret-agent-woman",

0 commit comments

Comments
 (0)