server

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "server",
	Short: "Start plugin server",
	RunE: func(cmd *cobra.Command, args []string) error {
		ctx := context.Background()

		config := ServerConfig{}
		if err := viper.Unmarshal(&config); err != nil {
			return err
		}

		http.HandleFunc("/api/v1/getparams.execute", config.secretsHandler(ctx))

		slog.Info("Server starting...", "listenAddress", config.ListenAddress)
		if err := http.ListenAndServe(config.ListenAddress, nil); err != nil {
			slog.Error("Server Failure", "err", err)
			return err
		}
		return nil
	},
}

Functions

This section is empty.

Types

type PluginInput

type PluginInput struct {
	Parameters *PluginParameters `json:"parameters,omitempty"`
}

type PluginParameters

type PluginParameters struct {
	LabelSelector metav1.LabelSelector `json:"labelSelector,omitempty"`
}

type ResponseBody

type ResponseBody struct {
	Output *ResponseOutput `json:"output,omitempty"`
}

type ResponseOutput

type ResponseOutput struct {
	Parameters []*ResponseParameters `json:"parameters,omitempty"`
}

type ResponseParameters

type ResponseParameters struct {
	Namespace *string `json:"namespace,omitempty"`
}

type ServerConfig

type ServerConfig struct {
	ListenAddress string `mapstructure:"listen-address"`
	ListenToken   string `mapstructure:"listen-token"`

	Local bool `mapstructure:"local"`
}

func (*ServerConfig) GetClient

func (c *ServerConfig) GetClient(req *PluginParameters) (kubernetes.Interface, error)

type ServiceRequest

type ServiceRequest struct {
	ApplicationSetName *string      `json:"applicationSetName,omitempty"`
	Input              *PluginInput `json:"input,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL