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) (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 ¶
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).