-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b229d56
commit a4824db
Showing
22 changed files
with
212 additions
and
1,274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package cli | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
func Server() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "server", | ||
Short: "start the collector server", | ||
Long: `...`, | ||
PreRun: func(cmd *cobra.Command, args []string) { | ||
viper.BindPFlag("port", cmd.Flags().Lookup("port")) | ||
}, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
|
||
return nil | ||
}, | ||
} | ||
|
||
cmd.Flags().Int("port", 8000, "port to bind to") | ||
|
||
viper.BindPFlags(cmd.Flags()) | ||
|
||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"strings" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
func RootCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "collector", | ||
Short: "Run the cluster-side server for bundle collection", | ||
Long: ``, | ||
SilenceUsage: true, | ||
} | ||
|
||
cobra.OnInitialize(initConfig) | ||
|
||
cmd.AddCommand(Server()) | ||
|
||
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_")) | ||
return cmd | ||
} | ||
|
||
func InitAndExecute() { | ||
if err := RootCmd().Execute(); err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func initConfig() { | ||
viper.SetEnvPrefix("TROUBLESHOT") | ||
viper.AutomaticEnv() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package main | ||
|
||
import "github.com/replicatedhq/troubleshoot/cmd/collector/cli" | ||
|
||
func main() { | ||
cli.InitAndExecute() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
apiVersion: troubleshoot.replicated.com/v1beta1 | ||
kind: CollectorJob | ||
metadata: | ||
labels: | ||
controller-tools.k8s.io: "1.0" | ||
name: collectorjob-sample | ||
spec: | ||
# Add fields here | ||
foo: bar | ||
collector: | ||
name: collector-sample | ||
namespace: default |
Oops, something went wrong.