reconcile

package
v0.108.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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

View Source
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

type Op struct {
	Action   opAction
	Type     string
	Ref      string
	Relation string
}

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.

func (Op) String

func (o Op) String() string

type PlatformUserAPI

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

func (*PlatformUserReconciler) Reconcile

func (r *PlatformUserReconciler) Reconcile(ctx context.Context, spec []byte, dryRun bool) (Report, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL