mirror of
https://github.com/rancher/steve.git
synced 2025-04-27 11:00:48 +00:00
* Add more fields to index when sql-caching is on. Misc changes: - Use the builtin Event class, not events.k8s.io (by looking at the dashboard client code) - Specify full path to the management.cattle.io fields. - Map `Event.type` to `Event._type` for indexing. Use a compound transform-func to first check for a "signal", and then to run all the relevant transformers until either one fails or the list is exhausted. - Includes moving the fakeSummaryCache type into a common area. Use a simpler way of running transforms. * Inline the function to get the gvk key. * Create a '--sql-cache' flag to turn on caching for the steve CLI. * Improve error-handling in object transformer. * Drop the 'GetTransform' function. * Inline the code that transforms a payload into a k8s-unstructured object.
44 lines
963 B
Go
44 lines
963 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/rancher/dynamiclistener/server"
|
|
"github.com/rancher/steve/pkg/debug"
|
|
stevecli "github.com/rancher/steve/pkg/server/cli"
|
|
"github.com/rancher/steve/pkg/version"
|
|
"github.com/rancher/wrangler/v3/pkg/signals"
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
var (
|
|
config stevecli.Config
|
|
debugconfig debug.Config
|
|
)
|
|
|
|
func main() {
|
|
app := cli.NewApp()
|
|
app.Name = "steve"
|
|
app.Version = version.FriendlyVersion()
|
|
app.Usage = ""
|
|
app.Flags = append(
|
|
stevecli.Flags(&config),
|
|
debug.Flags(&debugconfig)...)
|
|
app.Action = run
|
|
|
|
if err := app.Run(os.Args); err != nil {
|
|
logrus.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func run(_ *cli.Context) error {
|
|
ctx := signals.SetupSignalContext()
|
|
debugconfig.MustSetupDebug()
|
|
s, err := config.ToServer(ctx, debugconfig.SQLCache)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return s.ListenAndServe(ctx, config.HTTPSListenPort, config.HTTPListenPort, &server.ListenOpts{DisplayServerLogs: true})
|
|
}
|