service

package
v1.12.0-alpha.1 Latest Latest
Warning

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

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

Documentation

Overview

Package service fetches a module from a registry and parses it into a module.Module, server-side, for the type: module render path. It reuses the shared OCI Helm-chart transport and the Registry model; it does not reuse the addon parsing/packaging layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRenderer

func NewRenderer() api.Renderer

NewRenderer builds the module render service. It reads the Kubernetes client from the kubevela-pkg singleton at call time, not at construction, so callers may register it before the client is configured.

func Register

func Register()

func RenderApplication

func RenderApplication(mod *module.Module, definitionNamespace string) (map[string]interface{}, error)

RenderApplication builds the module's owned Application. It is pure: given a parsed Module it touches no cluster and no registry, which is what lets the whole tier layout be unit-tested against a fixture.

definitionNamespace is where the module's definitions install. The owned Application itself always lives in the system namespace: it is control-plane bookkeeping, so it stays with the control plane even when the capabilities it installs belong to a tenant namespace.

Its name stays module-{module} with no namespace in it, because a module installs once cluster-wide. A second install into a different namespace is meant to fail, and it does: the owned Application is already controlled by the first install's deploy Application, so MustBeControlledByApp rejects the second (pkg/utils/apply/apply.go).

func ResetModuleCache

func ResetModuleCache()

ResetModuleCache empties the module cache. It exists for tests, which would otherwise carry a module from one case into the next.

Types

type MapFS

type MapFS map[string][]byte

MapFS is a minimal read-only in-memory fs.FS built from files keyed by slash-separated path relative to the module root. It synthesizes the directories implied by those keys, which is all ParseModule needs (fs.ReadFile + fs.ReadDir). The OCI fetch adapter builds one; so does the addon package's inline-module reader (pkg/addon), which is why this type is exported rather than kept private to this package.

func (MapFS) Open

func (m MapFS) Open(name string) (fs.File, error)

func (MapFS) ReadDir

func (m MapFS) ReadDir(name string) ([]fs.DirEntry, error)

func (MapFS) ReadFile

func (m MapFS) ReadFile(name string) ([]byte, error)

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service fetches modules. It resolves registries through module.ResolveRegistry over a component.RegistryDataStore — reusing that story's default policy, source rejection, token loading, and not-found reporting.

func NewService

func NewService(store component.RegistryDataStore) *Service

NewService wires the real addon transport. In production the store is module.NewStore(cli) (the vela-module-registry ConfigMap).

func (*Service) FetchModule

func (s *Service) FetchModule(ctx context.Context, registry, moduleName, version string) (*module.Module, error)

FetchModule resolves the registry, fetches the module's files into an fs.FS, and parses them. Resolution is module.ResolveRegistry: an empty name selects the sole registry or the "catalog" default, non-OCI sources are rejected, and unknown names report the configured registries (wrapping ErrRegistryNotFound).

version selects the module package version (the OCI/ECR tag vela module publish writes from _module.cue's version field).

Directories

Path Synopsis
Package api holds the leaf types and injection seam shared between the module render service and the CueX module provider.
Package api holds the leaf types and injection seam shared between the module render service and the CueX module provider.

Jump to

Keyboard shortcuts

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