Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultSchemaTemplates(ctx context.Context, clusterName string, cf *client.Factory, ...) []schema.Template
- func DefaultSchemas(baseSchema *types.APISchemas)
- func DefaultTemplate(ctx context.Context, clusterName string, clientGetter proxy.ClientGetter, ...) schema.Template
- func GetURLPrefix(clusterName string) string
- func NewHandler(cfg *rest.Config, sf schema.Factory, authMiddleware auth.Middleware, ...) (*apiserver.Server, http.Handler, error)
- func NewPrefixed(r *http.Request, schemas *types.APISchemas, prefix string) (types.URLBuilder, error)
- func RoutesWrapper(prefix string) router.RouterFunc
- type APIFunc
- type Aggregator
- type Options
- type PrefixedURLBuilder
- type Response
- type Server
- type StatusCodeGetter
- type UserGroupInfo
- type UserGroupType
Constants ¶
View Source
const ( OrgManagerGroup = "erda-org-manager" OrgOpsGroup = "erda-org-ops" OrgSupportGroup = "erda-org-support" )
Variables ¶
View Source
var ( UserGroups map[string]UserGroupInfo RoleToGroup map[string]string )
View Source
var ( ServiceAccountExpression = `` /* 279-byte string literal not displayed */ ClusterRoleExpression = `` /* 169-byte string literal not displayed */ ClusterRoleBindingExpression = `` /* 1008-byte string literal not displayed */ )
View Source
var ErrConfigRequired = errors.New("rest config is required")
Functions ¶
func DefaultSchemaTemplates ¶
func DefaultSchemaTemplates(ctx context.Context, clusterName string, cf *client.Factory, discovery discovery.DiscoveryInterface, asl accesscontrol.AccessSetLookup) []schema.Template
func DefaultSchemas ¶
func DefaultSchemas(baseSchema *types.APISchemas)
func DefaultTemplate ¶
func DefaultTemplate(ctx context.Context, clusterName string, clientGetter proxy.ClientGetter, asl accesscontrol.AccessSetLookup) schema.Template
func GetURLPrefix ¶
GetURLPrefix get steve API prefix with cluster name
func NewHandler ¶
func NewHandler(cfg *rest.Config, sf schema.Factory, authMiddleware auth.Middleware, next http.Handler, routerFunc router.RouterFunc, prefix string) (*apiserver.Server, http.Handler, error)
NewHandler return an rancher api server and a steve server handler
func NewPrefixed ¶
func NewPrefixed(r *http.Request, schemas *types.APISchemas, prefix string) (types.URLBuilder, error)
func RoutesWrapper ¶
func RoutesWrapper(prefix string) router.RouterFunc
RoutesWrapper wraps a router for steve server with different prefix
Types ¶
type Aggregator ¶
type Aggregator struct { Ctx context.Context Bdl *bundle.Bundle // contains filtered or unexported fields }
func NewAggregator ¶
func NewAggregator(ctx context.Context, bdl *bundle.Bundle) *Aggregator
NewAggregator new an aggregator with steve servers for all current clusters
func (*Aggregator) Add ¶
func (a *Aggregator) Add(clusterInfo *apistructs.ClusterInfo)
Add starts a steve server for k8s cluster with clusterName and add it into aggregator
func (*Aggregator) Delete ¶
func (a *Aggregator) Delete(clusterName string) error
Delete closes a steve server for k8s cluster with clusterName and delete it from aggregator
func (*Aggregator) Serve ¶
func (a *Aggregator) Serve(clusterName string, apiOp *types.APIRequest) error
func (*Aggregator) ServeHTTP ¶
func (a *Aggregator) ServeHTTP(rw http.ResponseWriter, req *http.Request)
ServeHTTP forwards API request to corresponding steve server
type Options ¶
type Options struct { // Controllers If the controllers are passed in the caller must also start the controllers Controllers *steveserver.Controllers ClientFactory *client.Factory AccessSetLookup accesscontrol.AccessSetLookup AuthMiddleware auth.Middleware Next http.Handler Router router.RouterFunc AggregationSecretNamespace string AggregationSecretName string ClusterRegistry string URLPrefix string ClusterName string }
type PrefixedURLBuilder ¶
type PrefixedURLBuilder struct { types.URLBuilder // contains filtered or unexported fields }
func (*PrefixedURLBuilder) RelativeToRoot ¶
func (u *PrefixedURLBuilder) RelativeToRoot(path string) string
type Response ¶
type Response struct { StatusCode int ResponseData interface{} }
func (*Response) WriteList ¶
func (rw *Response) WriteList(apiOp *types.APIRequest, code int, obj types.APIObjectList)
type Server ¶
type Server struct { http.Handler ClientFactory *client.Factory ClusterCache clustercache.ClusterCache SchemaFactory schema.Factory RESTConfig *rest.Config BaseSchemas *types.APISchemas AccessSetLookup accesscontrol.AccessSetLookup APIServer *apiserver.Server ClusterRegistry string URLPrefix string ClusterName string // contains filtered or unexported fields }
func (*Server) ListenAndServe ¶
func (*Server) StartAggregation ¶
type StatusCodeGetter ¶
type StatusCodeGetter struct {
Response *Response
}
func (*StatusCodeGetter) Header ¶
func (scg *StatusCodeGetter) Header() http.Header
func (*StatusCodeGetter) WriteHeader ¶
func (scg *StatusCodeGetter) WriteHeader(code int)
type UserGroupInfo ¶
type UserGroupType ¶
type UserGroupType string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.