Documentation
¶
Index ¶
- func StandardStorageProvider(obj builderresource.Object, fn StoreFn, trackGeneration bool) serverapiserver.StorageProvider
- type Server
- func (s *Server) Build() (*start.ApoxyServerOptions, error)
- func (s *Server) DisableAuthorization() *Server
- func (s *Server) WithAdditionalSchemeInstallers(fns ...func(*runtime.Scheme) error) *Server
- func (s *Server) WithConfigFns(...) *Server
- func (s *Server) WithEvents(store StoreFn) *Server
- func (s *Server) WithGenerationTracking() *Server
- func (s *Server) WithOpenAPIDefinitions(name, version string, defs openapicommon.GetOpenAPIDefinitions) *Server
- func (s *Server) WithOptionsFns(fns ...func(*ServerOptions) *ServerOptions) *Server
- func (s *Server) WithResourceAndStorage(obj builderresource.Object, fn StoreFn) *Server
- func (s *Server) WithResourceAndStorageProvider(obj builderresource.Object, sp serverapiserver.StorageProvider) *Server
- func (s *Server) WithSchemeKinds(gv schema.GroupVersion, objs ...runtime.Object) *Server
- func (s *Server) WithStorage(gvr schema.GroupVersionResource, sp serverapiserver.StorageProvider) *Server
- func (s *Server) WithoutEtcd() *Server
- type ServerOptions
- type StoreFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StandardStorageProvider ¶
func StandardStorageProvider(obj builderresource.Object, fn StoreFn, trackGeneration bool) serverapiserver.StorageProvider
StandardStorageProvider returns the same kine/etcd-backed genericregistry.Store provider that WithResourceAndStorage would install, for callers that need to wrap or share it (e.g. a main resource plus a custom subresource over one logical store).
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server builds an API server without going through apiserver-runtime's sample-apiserver command wiring.
func NewServerBuilder ¶
func NewServerBuilder() *Server
func (*Server) DisableAuthorization ¶
func (*Server) WithAdditionalSchemeInstallers ¶
func (*Server) WithConfigFns ¶
func (s *Server) WithConfigFns(fns ...func(*genericapiserver.RecommendedConfig) *genericapiserver.RecommendedConfig) *Server
func (*Server) WithEvents ¶
WithEvents serves the upstream events.k8s.io/v1 Events API from this server, backed by store (which must be persistent + watchable, e.g. kine, via the same StoreFn seam as WithResourceAndStorage). Callers get LIST/GET/WATCH/CREATE/UPDATE/DELETE and the client-go events broadcaster works against it unchanged.
Events is an upstream k8s type, not a builderresource.Object, so it can't go through WithResourceAndStorage. Everything specific to Events is baked in here -- the GroupVersionResource, the namespaced scope, the "event" singular, the eventsv1 scheme install, and the {group, __internal} storage-version alias the generic store's codec needs -- so the call site is just WithEvents(store) with no room to get those wrong.
It is a deliberate opt-in, not a server default, for two reasons:
- The store carries no TTL, so the CALLER owns Event GC (a pruner). Serving Events does not bound their growth; defaulting it on would hand every consumer an unbounded Events table.
- Serving Events here is a LOCAL surface: direct/loopback clients see it. It is never aggregated into a host kube-apiserver -- the host owns the built-in events.k8s.io group and an APIService cannot override it -- so a host cluster's `kubectl get events` shows the host's Events, not these. Reach these through this server's own (loopback) endpoint.
func (*Server) WithGenerationTracking ¶
WithGenerationTracking enables CRD-style metadata.generation handling on every resource subsequently registered with WithResourceAndStorage: PrepareForCreate sets generation=1, and PrepareForUpdate bumps it when the object's Spec field has changed (compared via apiequality.Semantic.DeepEqual). Off by default — opt-in so existing consumers (apoxy-cloud's project apiserver, etc.) keep their current behavior until they're independently audited for the change.
Resources without a Spec field are unaffected (no field to compare, no generation bump). Per-type PrepareForUpdater hooks continue to fire after the generation bump.
func (*Server) WithOpenAPIDefinitions ¶
func (s *Server) WithOpenAPIDefinitions(name, version string, defs openapicommon.GetOpenAPIDefinitions) *Server
func (*Server) WithOptionsFns ¶
func (s *Server) WithOptionsFns(fns ...func(*ServerOptions) *ServerOptions) *Server
func (*Server) WithResourceAndStorage ¶
func (s *Server) WithResourceAndStorage(obj builderresource.Object, fn StoreFn) *Server
func (*Server) WithResourceAndStorageProvider ¶
func (s *Server) WithResourceAndStorageProvider(obj builderresource.Object, sp serverapiserver.StorageProvider) *Server
WithResourceAndStorageProvider registers a kind in the scheme and mounts an arbitrary StorageProvider at its GVR — like WithResourceAndStorage, but the caller supplies the finished provider instead of a StoreFn, and the status subresource is NOT wired (providers that shape responses, e.g. redaction, would otherwise be bypassed by the status route's raw parent reads). Compose the provider from StandardStorageProvider to reuse the default genericregistry.Store construction.
func (*Server) WithSchemeKinds ¶
WithSchemeKinds registers additional kinds in both the API and OpenAPI schemes — needed for custom subresource payload kinds (a WithStorage subresource whose storage News a type no resource.Object registers).
func (*Server) WithStorage ¶
func (s *Server) WithStorage(gvr schema.GroupVersionResource, sp serverapiserver.StorageProvider) *Server
WithStorage registers a StorageProvider at an arbitrary GVR. If the Resource contains "/", it is mounted as a subresource; otherwise as a top-level resource. The returned rest.Storage's implemented rest.* interfaces drive method routing (GET/LIST/WATCH/POST/...); methods not implemented yield 405 from the generic apiserver handler.
Unlike WithResourceAndStorage, this does NOT register the kind in the API scheme. Callers wire the scheme themselves via WithAdditionalSchemeInstallers; intentional for cases where one Go type is mounted at multiple GVRs (e.g. a top-level resource shared with per-parent subresources) and the scheme registration should not be duplicated.
func (*Server) WithoutEtcd ¶
type ServerOptions ¶
type ServerOptions = start.ServerOptions
type StoreFn ¶
type StoreFn func(*runtime.Scheme, *genericregistry.Store, *generic.StoreOptions)