Documentation
¶
Overview ¶
Package reconcile makes Frontier platform resources match a desired-state file through the admin API. Each resource kind implements Reconciler and registers under its kind, so new kinds plug in without changing the command or file format. PlatformUser is the first kind.
Index ¶
Constants ¶
const KindPlatformUser = "PlatformUser"
KindPlatformUser is the desired-state document kind for platform users.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Op ¶
Op is a single planned change to one (principal, relation). Ref is the desired entry's ref for an add (email or id) and the current principal's id for a remove.
type PlatformUserAPI ¶
type PlatformUserAPI interface {
ListPlatformUsers(context.Context, *connect.Request[frontierv1beta1.ListPlatformUsersRequest]) (*connect.Response[frontierv1beta1.ListPlatformUsersResponse], error)
AddPlatformUser(context.Context, *connect.Request[frontierv1beta1.AddPlatformUserRequest]) (*connect.Response[frontierv1beta1.AddPlatformUserResponse], error)
RemovePlatformUser(context.Context, *connect.Request[frontierv1beta1.RemovePlatformUserRequest]) (*connect.Response[frontierv1beta1.RemovePlatformUserResponse], error)
}
PlatformUserAPI is the subset of the admin API the platform-user reconciler needs. frontierv1beta1connect.AdminServiceClient satisfies it.
type PlatformUserReconciler ¶
type PlatformUserReconciler struct {
// contains filtered or unexported fields
}
PlatformUserReconciler makes platform admins and members match the desired spec.
func NewPlatformUserReconciler ¶
func NewPlatformUserReconciler(client PlatformUserAPI, header string) *PlatformUserReconciler
func (*PlatformUserReconciler) Kind ¶
func (r *PlatformUserReconciler) Kind() string
type PlatformUserSpec ¶
type PlatformUserSpec struct {
Type string `yaml:"type"` // "user" | "serviceuser"
Ref string `yaml:"ref"` // email or uuid for a user; id for a service user
Relation string `yaml:"relation"` // "admin" | "member"
}
PlatformUserSpec is one desired platform-user entry from the YAML spec. Relation is "admin" or "member" — a SpiceDB relation, not an RBAC "role" (a separate concept in Frontier), hence the field name.
type Reconciler ¶
type Reconciler interface {
Kind() string
Reconcile(ctx context.Context, spec []byte, dryRun bool) (Report, error)
}
Reconciler makes a single resource kind match its desired-state spec.
type Report ¶
type Report struct {
Kind string
DryRun bool
Planned []string // the plan, human-readable
Applied int // number actually applied (0 when dryRun)
}
Report summarises what a reconcile did, or would do when dryRun.
func Run ¶
func Run(ctx context.Context, registry map[string]Reconciler, data []byte, dryRun bool) ([]Report, error)
Run dispatches each document in a (possibly multi-document) desired-state file to the reconciler for its kind, in file order. The first error stops the run and returns the reports gathered so far.