reconcilers

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

README

runtime/reconcilers/

Adding a new resource type

  1. Define spec and state schemas in proto/rill/runtime/v1/resource.proto
  2. Define a reconciler for it in runtime/reconcilers/
  3. If the resource should be defined in code files,
    • Define parser logic for it in runtime/compilers/rillv1
    • Define mapping from parser output to catalog in runtime/reconcilers/project_parser.go

When reconcile is invoked

  • When the runtime is restarted
  • When the resource's refs or spec is updated
  • When the resource is deleted (.Meta.Deleted will be true)
  • When the resource is renamed (.Meta.RenamedFrom will be non-nil)
  • When all the resource's refs finish running Reconcile (even if they return an error)
  • When Controller.Retrigger is called for the resource
  • When the retrigger timestamp returned from an earlier invocation of Reconcile falls due

Principles for reconciler development

  • The controller will run only one Reconcile per resource name at a time
  • The implementation of Reconcile should be idempotent
  • Assume Reconcile may be invoked at any time
  • Assume the ctx may be cancelled at any time
  • If the ctx is cancelled, you can assume that Reconcile will be invoked again shortly
  • Calls to Reconcile may run for a long time
  • Reconcile should strive to keep the resource's state valid at all times. The resource may be accessed while Reconcile is running.
  • The Reconciler struct is shared for all resources of the registered type for a given instance ID
  • The Reconciler struct can be used to cache (ephemeral) state in-between invocations of Reconcile for optimization

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalProjectParserName = &runtimev1.ResourceName{Kind: runtime.ResourceKindProjectParser, Name: "parser"}

Functions

This section is empty.

Types

type MetricsViewReconciler

type MetricsViewReconciler struct {
	C *runtime.Controller
}

func (*MetricsViewReconciler) Close

func (*MetricsViewReconciler) Reconcile

type MigrationReconciler

type MigrationReconciler struct {
	C *runtime.Controller
}

func (*MigrationReconciler) Close

func (r *MigrationReconciler) Close(ctx context.Context) error

func (*MigrationReconciler) Reconcile

type ModelReconciler

type ModelReconciler struct {
	C *runtime.Controller
}

func (*ModelReconciler) Close

func (r *ModelReconciler) Close(ctx context.Context) error

func (*ModelReconciler) Reconcile

type ProjectParserReconciler

type ProjectParserReconciler struct {
	C *runtime.Controller
}

func (*ProjectParserReconciler) Close

func (*ProjectParserReconciler) Reconcile

type PullTriggerReconciler

type PullTriggerReconciler struct {
	C *runtime.Controller
}

PullTriggerReconciler reconciles a PullTrigger. When a PullTrigger is created, the reconciler will retrigger the global project parser resource, causing it to pull and reparse the project. It will then delete the PullTrigger resource.

func (*PullTriggerReconciler) Close

func (*PullTriggerReconciler) Reconcile

type RefreshTriggerReconciler

type RefreshTriggerReconciler struct {
	C *runtime.Controller
}

RefreshTriggerReconciler reconciles a RefreshTrigger. When a RefreshTrigger is created, the reconciler will refresh source and model by setting Trigger=true in their specs. After that, it will delete the RefreshTrigger resource.

func (*RefreshTriggerReconciler) Close

func (*RefreshTriggerReconciler) Reconcile

type SourceReconciler

type SourceReconciler struct {
	C *runtime.Controller
}

func (*SourceReconciler) Close

func (r *SourceReconciler) Close(ctx context.Context) error

func (*SourceReconciler) Reconcile

Jump to

Keyboard shortcuts

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