Documentation
¶
Index ¶
- type Client
- func (c *Client) DeleteByHost(ctx context.Context, host string) error
- func (c *Client) EnsureSingleDefault(ctx context.Context, routeToKeep *ingress_v1alpha.HttpRoute) error
- func (c *Client) List(ctx context.Context) ([]*RouteWithMeta, error)
- func (c *Client) Lookup(ctx context.Context, host string) (*ingress_v1alpha.HttpRoute, error)
- func (c *Client) LookupDefault(ctx context.Context) (*ingress_v1alpha.HttpRoute, error)
- func (c *Client) SetDefault(ctx context.Context, appId entity.Id) (*ingress_v1alpha.HttpRoute, error)
- func (c *Client) SetRoute(ctx context.Context, host string, appId entity.Id) (*ingress_v1alpha.HttpRoute, error)
- func (c *Client) UnsetDefault(ctx context.Context) (*ingress_v1alpha.HttpRoute, error)
- type RouteWatcher
- func (rw *RouteWatcher) LoadExistingRoutes(ctx context.Context) error
- func (rw *RouteWatcher) RouteSet() *autotls.RouteSet
- func (rw *RouteWatcher) Start(ctx context.Context) error
- func (rw *RouteWatcher) StartBackground(ctx context.Context, wg *sync.WaitGroup)
- func (rw *RouteWatcher) Watch(ctx context.Context) error
- type RouteWithMeta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a domain-specific client for HttpRoute entities
func (*Client) DeleteByHost ¶
DeleteByHost deletes an http_route by hostname
func (*Client) EnsureSingleDefault ¶
func (c *Client) EnsureSingleDefault(ctx context.Context, routeToKeep *ingress_v1alpha.HttpRoute) error
EnsureSingleDefault removes any default routes but the one specified
func (*Client) List ¶
func (c *Client) List(ctx context.Context) ([]*RouteWithMeta, error)
List returns all http_routes with metadata
func (*Client) LookupDefault ¶
LookupDefault finds the default http_route
func (*Client) SetDefault ¶
func (c *Client) SetDefault(ctx context.Context, appId entity.Id) (*ingress_v1alpha.HttpRoute, error)
SetDefault sets the default route to the provided app
func (*Client) SetRoute ¶
func (c *Client) SetRoute(ctx context.Context, host string, appId entity.Id) (*ingress_v1alpha.HttpRoute, error)
SetRoute creates or updates an http_route for the given host and app
func (*Client) UnsetDefault ¶
UnsetDefault unsets the default route, if any. It returns the route that it unset the default from.
type RouteWatcher ¶ added in v0.3.0
type RouteWatcher struct {
// contains filtered or unexported fields
}
RouteWatcher watches http_route entities and maintains an in-memory set of hosts with configured routes. It implements autotls.RouteWatcher.
func NewRouteWatcher ¶ added in v0.3.0
func NewRouteWatcher(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient) *RouteWatcher
NewRouteWatcher creates a new RouteWatcher.
func (*RouteWatcher) LoadExistingRoutes ¶ added in v0.3.0
func (rw *RouteWatcher) LoadExistingRoutes(ctx context.Context) error
LoadExistingRoutes loads all existing http_route entities into the set. This is synchronous and should be called before starting the TLS server to avoid a race where cert requests arrive before routes are loaded.
func (*RouteWatcher) RouteSet ¶ added in v0.3.0
func (rw *RouteWatcher) RouteSet() *autotls.RouteSet
RouteSet returns the underlying RouteSet for use with autotls.ServeTLS.
func (*RouteWatcher) Start ¶ added in v0.3.0
func (rw *RouteWatcher) Start(ctx context.Context) error
Start loads all existing routes and begins watching for changes. It blocks until the context is cancelled. For more control over timing, use LoadExistingRoutes followed by Watch.
func (*RouteWatcher) StartBackground ¶ added in v0.3.0
func (rw *RouteWatcher) StartBackground(ctx context.Context, wg *sync.WaitGroup)
StartBackground starts the watcher in a goroutine and returns immediately. Use this when you need the watcher running but don't want to block.
type RouteWithMeta ¶
type RouteWithMeta struct {
Route *ingress_v1alpha.HttpRoute
CreatedAt int64
UpdatedAt int64
}
RouteWithMeta includes an http_route with its metadata