Documentation
¶
Index ¶
- Constants
- func CRDExists(mgr ctrl.Manager, gvk schema.GroupVersionKind) (bool, error)
- func CollectBackend(defaultServerImage string, ...)
- func ControllerNamespace() string
- func FindImportmapInLayers(ctx context.Context, layers []ImportmapLayer, fetch LayerFetcher) (string, error)
- func HashScriptDef(script kdexv1alpha1.ScriptDef) string
- func LogConstructor(name string, mgr ctrl.Manager) func(request *reconcile.Request) logr.Logger
- func MakeHandlerByReferencePath(c client.Client, scheme *runtime.Scheme, watcherType client.Object, ...) handler.EventHandler
- func ResolveContents(ctx context.Context, c client.Client, referrer client.Object, ...) (map[string]page.ResolvedContentEntry, bool, ctrl.Result, error)
- func ResolveHost(ctx context.Context, c client.Client, object client.Object, ...) (*kdexv1alpha1.KDexInternalHost, bool, ctrl.Result, error)
- func ResolveKDexObjectReference(ctx context.Context, c client.Client, referrer client.Object, ...) (client.Object, bool, ctrl.Result, error)
- func ResolveOrDefaultFaaSAdaptor(ctx context.Context, c client.Client, referrer client.Object, ...) (client.Object, bool, ctrl.Result, error)
- func ResolveOrDefaultPageArchetype(ctx context.Context, c client.Client, referrer client.Object, ...) (client.Object, bool, ctrl.Result, error)
- func ResolvePage(ctx context.Context, c client.Client, object client.Object, ...) (*kdexv1alpha1.KDexPage, bool, ctrl.Result, error)
- func ResolvePageNavigations(ctx context.Context, c client.Client, object client.Object, ...) (map[string]page.ResolvedNavigation, bool, ctrl.Result, error)
- func ResolveSecrets(ctx context.Context, c client.Client, ...) (kdexv1alpha1.Secrets, error)
- func UniqueBackendRefs(backends []kdexv1alpha1.KDexObjectReference) []kdexv1alpha1.KDexObjectReference
- func UniquePackageRefs(packages []kdexv1alpha1.PackageReference) []kdexv1alpha1.PackageReference
- func UniqueScriptDefs(scripts []kdexv1alpha1.ScriptDef) []kdexv1alpha1.ScriptDef
- type ImportmapLayer
- type KDexFunctionReconciler
- type KDexInternalHostReconciler
- func (r *KDexInternalHostReconciler) PullImportMap(ctx context.Context, imageRef string, secrets kdexv1alpha1.Secrets) (string, error)
- func (r *KDexInternalHostReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)
- func (r *KDexInternalHostReconciler) SetupWithManager(mgr ctrl.Manager) error
- type KDexInternalPackageReferencesReconciler
- type KDexInternalTranslationReconciler
- type KDexInternalUtilityPageReconciler
- type KDexPageReconciler
- type LayerFetcher
Constants ¶
const ( AttrCodegenInputAPIHash = "kdex.dev/codegen-input-api-hash" AttrCodegenInputGenerator = "kdex.dev/codegen-input-generator" )
Attribute keys recorded on KDexFunction.Status.Attributes after a successful codegen run. handleBuildValid edge-triggers re-codegen when the live values differ from these recorded ones — letting users edit spec.api without manually flipping spec.origin.source.regenerate. See kdex-tech/host-manager#40.
const BackendServiceIndexKey = "spec.backend.service.namespacedName"
BackendServiceIndexKey indexes KDexFunctions by the namespaced name of the Service referenced in spec.backend.service. Used by Service/EndpointSlice watches to enqueue dependent functions when a backend Service or its EndpointSlices change.
const ConditionTypePackagesReady = "PackagesReady"
ConditionTypePackagesReady is a host status condition dedicated to the front-end packages image build. Surfacing front-end package state on its own condition (rather than collapsing it into the host's overall Ready/Degraded, which also covers backend functions) lets a front-end package failure be observed independently and keeps it from gating backend function delivery. See kdex-tech/host-manager#117.
const UTILITY_PAGE_FINALIZER = "kdex-tech/kdex-host-utility-page-finalizer"
Variables ¶
This section is empty.
Functions ¶
func CollectBackend ¶
func CollectBackend(defaultServerImage string, requiredBackends *[]kdexv1alpha1.KDexObjectReference, obj client.Object)
func ControllerNamespace ¶
func ControllerNamespace() string
func FindImportmapInLayers ¶ added in v0.2.65
func FindImportmapInLayers(ctx context.Context, layers []ImportmapLayer, fetch LayerFetcher) (string, error)
FindImportmapInLayers selects the right layer from a manifest's layer list and returns the importmap JSON contents.
Selection rules, in order of preference:
- A layer with mediaType "application/vnd.kdex.importmap+json" — the explicit kdex-cli-tools/package_image artifact type.
- A layer with mediaType "application/json" — raw importmap blob, no tarball wrapping.
- ALL layers with mediaType "application/vnd.oci.image.layer.v1.tar+gzip", sorted by Size ASCENDING. Try each in turn; first whose tarball contains importmap.json wins.
Why "smallest tar+gzip first": the auto-build packager (kdex-cli-tools' package_image script) emits TWO tar+gzip layers per packages image — a large layer.tar.gz containing node_modules plus a copy of importmap.json, then a small importmap.layer.tar.gz containing just importmap.json. Iterating manifest.Layers and breaking on the first tar+gzip match (the previous behavior) lands on the big node_modules layer first. Streaming that to find one tiny file is wasteful (hundreds of MB at scale), error-prone, and silently picks the wrong copy if the two importmap.json files disagree. Size-asc selection prefers the dedicated layer.
func HashScriptDef ¶
func HashScriptDef(script kdexv1alpha1.ScriptDef) string
func LogConstructor ¶
func MakeHandlerByReferencePath ¶
func MakeHandlerByReferencePath( c client.Client, scheme *runtime.Scheme, watcherType client.Object, list client.ObjectList, referencePath ...string, ) handler.EventHandler
nolint:gocyclo
func ResolveContents ¶
func ResolveHost ¶
func ResolveOrDefaultFaaSAdaptor ¶ added in v0.2.27
func ResolveOrDefaultPageArchetype ¶ added in v0.2.27
func ResolvePage ¶ added in v0.2.9
func ResolvePageNavigations ¶
func ResolveSecrets ¶ added in v0.2.26
func ResolveSecrets(ctx context.Context, c client.Client, objectStatus *kdexv1alpha1.KDexObjectStatus, namespace string, selector *metav1.LabelSelector) (kdexv1alpha1.Secrets, error)
func UniqueBackendRefs ¶
func UniqueBackendRefs(backends []kdexv1alpha1.KDexObjectReference) []kdexv1alpha1.KDexObjectReference
func UniquePackageRefs ¶
func UniquePackageRefs(packages []kdexv1alpha1.PackageReference) []kdexv1alpha1.PackageReference
func UniqueScriptDefs ¶
func UniqueScriptDefs(scripts []kdexv1alpha1.ScriptDef) []kdexv1alpha1.ScriptDef
Types ¶
type ImportmapLayer ¶ added in v0.2.65
ImportmapLayer is a minimal descriptor of one layer in an OCI image manifest, scoped to what FindImportmapInLayers needs.
type KDexFunctionReconciler ¶
type KDexFunctionReconciler struct {
client.Client
Configuration configuration.NexusConfiguration
ControllerNamespace string
FocalHost string
// FunctionImagePrefix overrides the function-image path segment before
// <func>. nil = unset (default to HostRef.Name+"/"); non-nil = literal
// (may be "" for a flat path). From FUNCTION_IMAGE_PREFIX env in main.go.
FunctionImagePrefix *string
HostHandler *host.HostHandler
RequeueDelay time.Duration
Scheme *runtime.Scheme
}
KDexFunctionReconciler reconciles a KDexFunction object
func (*KDexFunctionReconciler) SetupWithManager ¶
func (r *KDexFunctionReconciler) SetupWithManager(mgr ctrl.Manager) error
type KDexInternalHostReconciler ¶
type KDexInternalHostReconciler struct {
client.Client
Configuration configuration.NexusConfiguration
ControllerNamespace string
FocalHost string
HostHandler *host.HostHandler
Port int32
RequeueDelay time.Duration
Scheme *runtime.Scheme
ServiceName string
// contains filtered or unexported fields
}
KDexInternalHostReconciler reconciles a KDexInternalHost object
func (*KDexInternalHostReconciler) PullImportMap ¶ added in v0.2.9
func (r *KDexInternalHostReconciler) PullImportMap(ctx context.Context, imageRef string, secrets kdexv1alpha1.Secrets) (string, error)
func (*KDexInternalHostReconciler) Reconcile ¶
func (r *KDexInternalHostReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)
nolint:gocyclo
func (*KDexInternalHostReconciler) SetupWithManager ¶
func (r *KDexInternalHostReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type KDexInternalPackageReferencesReconciler ¶
type KDexInternalPackageReferencesReconciler struct {
client.Client
Configuration configuration.NexusConfiguration
ControllerNamespace string
FocalHost string
RequeueDelay time.Duration
Scheme *runtime.Scheme
}
KDexInternalPackageReferencesReconciler reconciles a KDexInternalPackageReferences object
func (*KDexInternalPackageReferencesReconciler) SetupWithManager ¶
func (r *KDexInternalPackageReferencesReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type KDexInternalTranslationReconciler ¶
type KDexInternalTranslationReconciler struct {
client.Client
ControllerNamespace string
FocalHost string
HostHandler *host.HostHandler
RequeueDelay time.Duration
Scheme *runtime.Scheme
}
KDexInternalTranslationReconciler reconciles a KDexInternalTranslation object
func (*KDexInternalTranslationReconciler) SetupWithManager ¶
func (r *KDexInternalTranslationReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type KDexInternalUtilityPageReconciler ¶
type KDexInternalUtilityPageReconciler struct {
client.Client
Configuration configuration.NexusConfiguration
ControllerNamespace string
FocalHost string
HostHandler *host.HostHandler
RequeueDelay time.Duration
Scheme *runtime.Scheme
}
KDexInternalUtilityPageReconciler reconciles a KDexInternalUtilityPage object
func (*KDexInternalUtilityPageReconciler) Reconcile ¶
func (r *KDexInternalUtilityPageReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error)
nolint:gocyclo
func (*KDexInternalUtilityPageReconciler) SetupWithManager ¶
func (r *KDexInternalUtilityPageReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type KDexPageReconciler ¶ added in v0.2.9
type KDexPageReconciler struct {
client.Client
Configuration configuration.NexusConfiguration
ControllerNamespace string
FocalHost string
HostHandler *host.HostHandler
RequeueDelay time.Duration
Scheme *runtime.Scheme
}
KDexPageReconciler reconciles a KDexPage object
func (*KDexPageReconciler) SetupWithManager ¶ added in v0.2.9
func (r *KDexPageReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type LayerFetcher ¶ added in v0.2.65
type LayerFetcher func(ctx context.Context, layer ImportmapLayer) (io.ReadCloser, error)
LayerFetcher returns the blob bytes for the given layer. The caller closes the returned ReadCloser. In production this hits a remote registry; in tests it reads from an in-memory map.