Skip to content

Latest commit

 

History

History
404 lines (199 loc) · 12.5 KB

api.md

File metadata and controls

404 lines (199 loc) · 12.5 KB

API Reference

Packages

eno.azure.io/v1

Resource Types

Binding

Bindings map a specific Kubernetes resource to a ref exposed by a synthesizer. Compositions use bindings to populate inputs supported by their synthesizer.

Appears in:

Field Description Default Validation
key string Key determines which ref this binding binds to. Opaque.
resource ResourceBinding

Composition

Compositions represent a collection of related, synthesized resources.

For example: when managing Postgres with Eno, one would create a composition per distinct instance of Postgres, all referencing a single synthesizer resource.

Changing the spec of a composition will result in re-synthesis.

Eno guarantees that a composition's resources will be deleted before the composition finishes deletion by holding a finalizer on it. To delete the composition while leaving the resources in place, set the annotation eno.azure.io/deletion-strategy to "orphan".

Field Description Default Validation
apiVersion string eno.azure.io/v1
kind string Composition
metadata ObjectMeta Refer to Kubernetes API documentation for fields of metadata.
spec CompositionSpec
status CompositionStatus

CompositionSpec

Appears in:

Field Description Default Validation
synthesizer SynthesizerRef Compositions are synthesized by a Synthesizer, referenced by name.
bindings Binding array Synthesizers can accept Kubernetes resources as inputs.
Bindings allow compositions to specify which resource to use for a particular input "reference".
Declaring extra bindings not (yet) supported by the synthesizer is valid.

CompositionStatus

Appears in:

Field Description Default Validation
currentSynthesis Synthesis
previousSynthesis Synthesis

Ref

Ref defines a synthesizer input. Inputs are typed using the Kubernetes API - they are just normal Kubernetes resources. The consumer (synthesizer) specifies the resource's kind/group, while the producer (composition) specifies a specific resource name/namespace.

Compositions that use the synthesizer will be re-synthesized when the resource bound to this ref changes. Re-synthesis happens automatically while honoring the globally configured cooldown period.

Appears in:

Field Description Default Validation
key string Key corresponds to bindings to this ref.
resource ResourceRef
defer boolean Allows control over re-synthesis when inputs changed.
A non-deferred input will trigger a synthesis immediately, whereas a
deferred input will respect the cooldown period.

ResourceBinding

A reference to a specific resource name and optionally namespace.

Appears in:

Field Description Default Validation
name string
namespace string

ResourceRef

A reference to a resource kind/group.

Appears in:

Field Description Default Validation
kind string
group string

Symphony

Symphony is a set of variations on a composition. Useful for creating several compositions that use a common set of bindings but different synthesizers.

This pattern is highly opinionated for use-cases in which a single "unit of management" includes multiple distinct components. For example: deploying many instances of an application that is comprised of several components (Wordpress, etc.).

Field Description Default Validation
apiVersion string eno.azure.io/v1
kind string Symphony
metadata ObjectMeta Refer to Kubernetes API documentation for fields of metadata.
spec SymphonySpec
status SymphonyStatus

SymphonySpec

Appears in:

Field Description Default Validation
variations Variation array Each variation will result in the creation of a composition.
Synthesizer refs must be unique across variations.
Removing a variation will cause the composition to be deleted!
bindings Binding array Bindings are inherited from all compositions managed by this symphony.

SymphonyStatus

Appears in:

Field Description Default Validation
observedGeneration integer
synthesized Time
reconciled Time
ready Time
synthesizers SynthesizerRef array

Synthesis

A synthesis is the result of synthesizing a composition. In other words: it's a collection of resources returned from a synthesizer.

Appears in:

Field Description Default Validation
uuid string A random UUID scoped to this particular synthesis operation.
Used internally for strict ordering semantics.
observedCompositionGeneration integer The value of the composition's metadata.generation at the time the synthesis began.
This is a min i.e. a newer composition may have been used.
observedSynthesizerGeneration integer The value of the synthesizer's metadata.generation at the time the synthesis began.
This is a min i.e. a newer composition may have been used.
podCreation Time Time at which the most recent synthesizer pod was created.
synthesized Time Time at which the synthesis completed i.e. resourceSlices was written
reconciled Time Time at which the synthesis's resources were reconciled into real Kubernetes resources.
ready Time Time at which the synthesis's reconciled resources became ready.
attempts integer Counter used internally to calculate back off when retrying failed syntheses.

Synthesizer

Synthesizers are any process that can run in a Kubernetes container that implements the KRM Functions Specification.

Synthesizer processes are given some metadata about the composition they are synthesizing, and are expected to return a set of Kubernetes resources. Essentially they generate the desired state for a set of Kubernetes resources.

Eno honors a handful of annotations on resources emitted from synthesizers. They are consumed by Eno i.e. are not passed to the "real", reconciled resource.

  • eno.azure.io/reconcile-interval: How often to correct for any configuration drift. Accepts durations parsable by time.ParseDuration.
  • eno.azure.io/disable-updates: Ensure that the resource exists but never update it. Useful for populating resources you expect another user/process to mutate.
  • eno.azure.io/readiness: CEL expression used to assert that the resource is ready. More details below.
  • eno.azure.io/readiness-*: Same as above, allows for multiple readiness checks. All checks must pass for the resource to be considered ready.
  • eno.azure.io/readiness-group: (int, default: 0) Eno will not create or update this resource until all resoruces in lower-valued groups have become ready.

Readiness expressions can return either bool or a Kubernetes condition struct. If a condition is returned it will be used as the resource's readiness time, otherwise the controller will use wallclock time at the first moment it noticed the truthy value. When possible, match on a timestamp to preserve accuracy.

Example matching on a condition:



	self.status.conditions.filter(item, item.type == 'Test' && item.status == 'False')


Example matching on a boolean:



	self.status.foo == 'bar'


A special resource can be returned from synthesizers: eno.azure.io/v1.Patch. Example:

	 # - Nothing will happen if the resource doesn't exist
	 # - Patches are only applied when they would result in a change
	 # - Deleting the Patch will not delete the referenced resource
		apiVersion: eno.azure.io/v1
		kind: Patch
		metadata:
			name: resource-to-be-patched
			namespace: default
		patch:
			apiVersion: v1
			kind: ConfigMap
			ops: # standard jsonpatch operations
			  - { "op": "add", "path": "/data/hello", "value": "world" }
			  - { "op": "add", "path": "/metadata/deletionTimestamp", "value": "anything" } # setting any deletion timestamp will delete the resource

Field Description Default Validation
apiVersion string eno.azure.io/v1
kind string Synthesizer
metadata ObjectMeta Refer to Kubernetes API documentation for fields of metadata.
spec SynthesizerSpec
status SynthesizerStatus

SynthesizerRef

Appears in:

Field Description Default Validation
name string

SynthesizerSpec

Appears in:

Field Description Default Validation
image string Copied opaquely into the container's image property.
command string array Copied opaquely into the container's command property. [synthesize]
execTimeout Duration Timeout for each execution of the synthesizer command. 10s
podTimeout Duration Pods are recreated after they've existed for at least the pod timeout interval.
This helps close the loop in failure modes where a pod may be considered ready but not actually able to run.
2m
reconcileInterval Duration Synthesized resources can optionally be reconciled at a given interval.
Per-resource jitter will be applied to avoid spikes in request rate.
refs Ref array Refs define the Synthesizer's input schema without binding it to specific
resources.

SynthesizerStatus

Appears in:

Variation

Appears in:

Field Description Default Validation
labels object (keys:string, values:string) Used to populate the composition's metadata.labels.
synthesizer SynthesizerRef Used to populate the composition's spec.synthesizer.
bindings Binding array Variation-specific bindings get merged with Symphony bindings and take
precedence over them.