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 ¶
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 RenderApplication ¶
func RenderApplication(mod *module.Module, definitionNamespace string, place *v1alpha1.Placement) (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).
place is the installer's placement request. Nil means they did not ask. An explicit placement marker on a module-level object or an enabled line, a runtime default on the module or an enabled line, or a non-nil place, partitions each auxiliary tier by class and adds the topology policies and deploy steps that put each class where it belongs. A disabled line is checked for a bad marker and then ignored, because it installs nothing. An absent marker is hub, and so is an explicit hub default, so neither leaves the flat shape on its own. With neither a runtime marker nor a request, the Application is the flat shape this function has always returned.
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 ¶
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.
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).