server

package
v9.4.47+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: Apache-2.0 Imports: 53 Imported by: 0

README

package apiserver

Package apiserver defines the REST endpoints for volume drivers.

The endpoints defined by the docker volume plugins API is a subset of the exposed REST endpoints.

Documentation

Index

Constants

View Source
const (
	// PVCNameLabelKey is used for kubernetes auth provider indicating the name of PVC
	PVCNameLabelKey = "pvc"
	// PVCNamespaceLabelKey is used for kubernetes auth provider indicating the namespace of the PVC
	PVCNamespaceLabelKey = "namespace"
)
View Source
const (
	// GraphDriver is the string returned in the handshake protocol.
	GraphDriver = "GraphDriver"
)
View Source
const (
	// VolumeDriver is the string returned in the handshake protocol.
	VolumeDriver = "VolumeDriver"
)

Variables

View Source
var (
	// OverrideSchedDriverName is set by osd program to override the schedule driver
	OverrideSchedDriverName = ""
)

Functions

func GetVolumeAPIRoutesWithAuth

func GetVolumeAPIRoutesWithAuth(
	name, sdkUds string,
	router *mux.Router,
	serverRegisterRoute ServerRegisterRoute,
	preRouteCheckFn func(http.ResponseWriter, *http.Request) bool,
) (*mux.Router, error)

GetVolumeAPIRoutesWithAuth returns a router with all the volume routes added to the router along with the auth middleware - preRouteCheckFn is a handler that gets executed before the actual volume handler is invoked. It is added for legacy support where negroni middleware was not used

func NewAuthMiddleware

func NewAuthMiddleware() *authMiddleware

NewAuthMiddleware returns a negroni implementation of an http middleware which will intercept the management APIs

func SecurityHandler

func SecurityHandler(authenticators map[string]auth.Authenticator, next http.HandlerFunc) http.HandlerFunc

SecurityHandler implements Authentication and Authorization check at the same time this functionality where not moved to separate functions because of simplicity

func SetClusterAPIRoutesWithAuth

func SetClusterAPIRoutesWithAuth(router *mux.Router, authenticators map[string]auth.Authenticator) (*mux.Router, error)

func SetCredsAPIRoutesWithAuth

func SetCredsAPIRoutesWithAuth(router *mux.Router, authenticators map[string]auth.Authenticator) *mux.Router

func StartClusterAPI

func StartClusterAPI(clusterApiBase string, clusterPort uint16, authenticators map[string]auth.Authenticator) error

StartClusterAPI starts a REST server to receive driver configuration commands from the CLI/UX to control the OSD cluster.

func StartGraphAPI

func StartGraphAPI(name string, restBase string) error

StartGraphAPI starts a REST server to receive GraphDriver commands from the Linux container engine.

func StartVolumeMgmtAPI

func StartVolumeMgmtAPI(
	name, sdkUds string,
	mgmtBase string,
	mgmtPort uint16,
	auth bool,
	authenticators map[string]auth.Authenticator,
) (*http.Server, *http.Server, error)

StartVolumeMgmtAPI starts a REST server to receive volume management API commands

func StartVolumePluginAPI

func StartVolumePluginAPI(
	name, sdkUds string,
	pluginBase string,
	pluginPort uint16,
) error

StartVolumePluginAPI starts a REST server to receive volume API commands from the linux container engine

Types

type AnonRegex

type AnonRegex struct {
	// contains filtered or unexported fields
}

AnonRegex defines a regex replace for a string

type Route

type Route struct {
	// contains filtered or unexported fields
}

Route is a specification and handler for a REST endpoint.

func GetClusterAPIRoutes

func GetClusterAPIRoutes() []*Route

func GetCredAPIRoutes

func GetCredAPIRoutes() []*Route

func GetVolumeAPIRoutes

func GetVolumeAPIRoutes(name, sdkUds string) []*Route

GetVolumeAPIRoutes returns all the volume routes. A driver could use this function if it does not want openstorage to setup the REST server but it sets up its own and wants to add volume routes

func (*Route) GetFn

func (r *Route) GetFn() func(http.ResponseWriter, *http.Request)

func (*Route) GetPath

func (r *Route) GetPath() string

func (*Route) GetVerb

func (r *Route) GetVerb() string

type ServerRegisterRoute

type ServerRegisterRoute func(
	routeFunc func(w http.ResponseWriter, r *http.Request),
	preRouteCheck func(w http.ResponseWriter, r *http.Request) bool,
) func(w http.ResponseWriter, r *http.Request)

ServerRegisterRoute is a callback function used by drivers to run their preRouteChecks before the actual volume route gets invoked This is added for legacy support before negroni middleware was added

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2022 Portworx
Package sdk is the gRPC implementation of the SDK gRPC server Copyright 2022 Portworx

Jump to

Keyboard shortcuts

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