server

package
v1.15.0-pre.3 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 37 Imported by: 19

Documentation

Overview

Package server Cilium API

Cilium
Schemes:
  unix
Host: localhost
BasePath: /v1
Version: v1beta1

Consumes:
  - application/json

Produces:
  - application/octet-stream
  - application/json

swagger:meta

Index

Constants

This section is empty.

Variables

View Source
var (
	// SwaggerJSON embedded version of the swagger document used at generation time
	SwaggerJSON json.RawMessage
	// FlatSwaggerJSON embedded flattened version of the swagger document used at generation time
	FlatSwaggerJSON json.RawMessage
)
View Source
var APICell = cell.Provide(newAPI)

APICell provides the restapi.CiliumAPIAPI type, populated with the request handlers. This cell is an alternative to 'Cell' when only the API type is required and not the full server implementation.

View Source
var (
	AdminEnableFlag = "enable-cilium-api-server-access"
)
View Source
var Cell = cell.Module(
	"cilium-api-server",
	"cilium API server",

	cell.Provide(newForCell),
	APICell,
)

Cell implements the cilium API REST API server when provided the required request handlers.

View Source
var (
	// ServerCtx and ServerCancel
	ServerCtx, _ = context.WithCancel(context.Background())
)
View Source
var SpecCell = cell.Module(
	"cilium-api-spec",
	"cilium API Specification",

	cell.Config(defaultServerConfig),
	cell.Provide(newSpec),
)

Functions

This section is empty.

Types

type Server

type Server struct {
	EnabledListeners []string
	CleanupTimeout   time.Duration
	GracefulTimeout  time.Duration
	MaxHeaderSize    int

	SocketPath string

	Host         string
	Port         int
	ListenLimit  int
	KeepAlive    time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration

	TLSHost           string
	TLSPort           int
	TLSCertificate    string
	TLSCertificateKey string
	TLSCACertificate  string
	TLSListenLimit    int
	TLSKeepAlive      time.Duration
	TLSReadTimeout    time.Duration
	TLSWriteTimeout   time.Duration
	// contains filtered or unexported fields
}

Server for the cilium API API

func NewServer

func NewServer(api *restapi.CiliumAPIAPI) *Server

NewServer creates a new api cilium API server but does not configure it

func (*Server) ConfigureAPI

func (s *Server) ConfigureAPI()

ConfigureAPI configures the API and handlers.

func (*Server) ConfigureFlags

func (s *Server) ConfigureFlags()

ConfigureFlags configures the additional flags defined by the handlers. Needs to be called before the parser.Parse

func (*Server) Fatalf

func (s *Server) Fatalf(f string, args ...interface{})

Fatalf logs message either via defined user logger or via system one if no user logger is defined. Exits with non-zero status after printing

func (*Server) GetAPI added in v0.15.7

func (s *Server) GetAPI() *restapi.CiliumAPIAPI

GetAPI returns the configured API. Modifications on the API must be performed before server is started.

func (*Server) GetHandler

func (s *Server) GetHandler() http.Handler

GetHandler returns a handler useful for testing

func (*Server) HTTPListener

func (s *Server) HTTPListener() (net.Listener, error)

HTTPListener returns the http listener

func (*Server) Listen

func (s *Server) Listen() error

Listen creates the listeners for the server

func (*Server) Logf

func (s *Server) Logf(f string, args ...interface{})

Logf logs message either via defined user logger or via system one if no user logger is defined.

func (*Server) Serve

func (s *Server) Serve() error

func (*Server) SetAPI

func (s *Server) SetAPI(api *restapi.CiliumAPIAPI)

SetAPI configures the server with the specified API. Needs to be called before Serve

func (*Server) SetHandler

func (s *Server) SetHandler(handler http.Handler)

SetHandler allows for setting a http handler on this server

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown server and clean up resources

func (*Server) Start added in v0.15.7

func (s *Server) Start(hive.HookContext) (err error)

Start the server

func (*Server) Stop added in v0.15.7

func (s *Server) Stop(ctx hive.HookContext) error

func (*Server) TLSListener

func (s *Server) TLSListener() (net.Listener, error)

TLSListener returns the https listener

func (*Server) UnixListener

func (s *Server) UnixListener() (*net.UnixListener, error)

UnixListener returns the domain socket listener

type ServerConfig added in v0.15.7

type ServerConfig struct {
	EnableCiliumAPIServerAccess []string
}

func (ServerConfig) Flags added in v0.15.7

func (cfg ServerConfig) Flags(flags *pflag.FlagSet)

type Spec added in v0.15.7

type Spec struct {
	*loads.Document

	// DeniedAPIs is a set of APIs that are administratively disabled.
	DeniedAPIs api.PathSet
}

Directories

Path Synopsis
bgp

Jump to

Keyboard shortcuts

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