Documentation
¶
Overview ¶
Package config reads the configuration of `beekeeper serve`: a YAML file with the installation, the listeners, the OIDC issuer, the organizations and their principals, the host-access check, the leases, placement's policy and retention. Unset values take their defaults, and Load refuses a file that is invalid or has unknown fields.
Index ¶
Constants ¶
const ( DefaultAPIAddress = ":8080" DefaultMetricsAddress = ":9090" DefaultUsernameClaim = "email" DefaultGroupsClaim = "groups" DefaultLease = 30 * time.Second DefaultTaskRetention = 7 * 24 * time.Hour DefaultSessionRetention = 30 * 24 * time.Hour DefaultLeaderElection = "beekeeper" // MinHeartbeat is the shortest heartbeat lease: runners send a heartbeat // every third of it. MinHeartbeat = 3 * time.Second )
The defaults.
Variables ¶
var DefaultHostAccess = HostAccess{Group: v1alpha1.GroupVersion.Group, Resource: "runners", Verb: "get"}
DefaultHostAccess asks whether a person may get runners in the organization's namespace.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Installation is the installation runners register on.
Installation string `json:"installation"`
// Listen are the addresses Beekeeper serves on.
Listen Listen `json:"listen"`
// OIDC is the issuer every caller's token comes from.
OIDC OIDC `json:"oidc"`
// Organizations are the only source of the namespace, organization and
// principal map.
Organizations []Organization `json:"organizations"`
// HostAccess is the SubjectAccessReview that says a person may use an
// organization's namespace.
HostAccess HostAccess `json:"hostAccess"`
// Leases are the heartbeat, offer-answer and placement-failure windows.
Leases Leases `json:"leases"`
// Placement is placement's policy.
Placement Placement `json:"placement"`
// Retention is how long ended tasks and sessions are kept.
Retention Retention `json:"retention"`
// LeaderElection is the Lease that elects the coordinator.
LeaderElection LeaderElection `json:"leaderElection"`
}
Config is the configuration of `beekeeper serve`.
func (*Config) Namespaces ¶
Namespaces are the organizations' namespaces.
func (*Config) Organization ¶
func (c *Config) Organization(namespace string) (Organization, bool)
Organization returns the organization of a namespace.
func (*Config) OrganizationNamed ¶
func (c *Config) OrganizationNamed(name string) (Organization, bool)
OrganizationNamed returns the organization of a name.
type HostAccess ¶
type HostAccess struct {
Group string `json:"group"`
Resource string `json:"resource"`
Verb string `json:"verb"`
}
HostAccess is the resource attributes of the SubjectAccessReview that says a person may use an organization's namespace.
type LeaderElection ¶
type LeaderElection struct {
// Namespace holds the Lease. Empty is the namespace Beekeeper runs in.
Namespace string `json:"namespace"`
// Name is the Lease's name.
Name string `json:"name"`
}
LeaderElection is the Lease that elects the coordinator.
type Leases ¶
type Leases struct {
// Heartbeat is how long a started session may go without a heartbeat
// before its task is lost. Runners send one every third of it.
Heartbeat metav1.Duration `json:"heartbeat"`
// OfferAnswer is how long a runner has to answer an offer. No answer
// counts as a decline.
OfferAnswer metav1.Duration `json:"offerAnswer"`
// PlacementFailure is how soon after its start a failed session counts
// as a placement failure, which places the task again.
PlacementFailure metav1.Duration `json:"placementFailure"`
}
Leases are the coordinator's windows.
type Listen ¶
type Listen struct {
// API serves the runner API, the MCP endpoint and the health probes.
API string `json:"api"`
// Metrics serves Prometheus metrics.
Metrics string `json:"metrics"`
}
Listen are the addresses Beekeeper serves on.
type OIDC ¶
type OIDC struct {
// IssuerURL is the issuer, such as Dex. Its keys come from discovery.
IssuerURL string `json:"issuerURL"`
// CAFile is a PEM bundle trusted for the issuer besides the system's
// roots, such as a lab issuer's own CA.
CAFile string `json:"caFile,omitempty"`
// Audience is Beekeeper's client ID: every token's aud must contain it.
Audience string `json:"audience"`
// UsernameClaim is the claim that holds a person's username.
UsernameClaim string `json:"usernameClaim"`
// UsernamePrefix is prepended to the username.
UsernamePrefix string `json:"usernamePrefix"`
// GroupsClaim is the claim that holds a person's groups.
GroupsClaim string `json:"groupsClaim"`
// GroupsPrefix is prepended to every group.
GroupsPrefix string `json:"groupsPrefix"`
}
OIDC is the issuer of every caller's token and how a person's token maps to a Kubernetes username and groups, the way the kube-apiserver maps it.
type Organization ¶
type Organization struct {
// Name is the organization's name, a DNS label.
Name string `json:"name"`
// Namespace holds the organization's runners, tasks, sessions and
// subscriptions.
Namespace string `json:"namespace"`
// Principal is the organization's own identity, as which its workflows
// offer and cancel tasks.
Principal Principal `json:"principal"`
}
Organization is an organization, its namespace and its principal.
type Pace ¶
type Pace struct {
WeekLength *metav1.Duration `json:"weekLength,omitempty"`
ShortWindowStop *float64 `json:"shortWindowStop,omitempty"`
Headroom *float64 `json:"headroom,omitempty"`
StaleAfter *metav1.Duration `json:"staleAfter,omitempty"`
ReservePerSession *v1alpha1.Usage `json:"reservePerSession,omitempty"`
}
Pace are the default pace rules.
type Placement ¶
type Placement struct {
// AffinityWait is how long a task waits for its preferred runner.
AffinityWait metav1.Duration `json:"affinityWait"`
// DeclineBackoff is how long a runner that declined a task isn't
// offered it again.
DeclineBackoff metav1.Duration `json:"declineBackoff"`
// Limits are the default pressure bounds for runners that set none.
Limits v1alpha1.PressureLimits `json:"limits"`
// Pace are the default pace rules for subscriptions that set none.
Pace Pace `json:"pace"`
}
Placement is placement's policy. Unset values take placement.DefaultPolicy's.