Skip to content

Commit c6b62b7

Browse files
committed
Support resolving dependencies of Function packages
This fixes the PackageDependencyManager to allow Function packages to depend on other packages. Previously this wasn't supported because we never tried to parse a Function package's package metadata when loading dependencies. I'm guessing no-one noticed this because no-one tried to make a function package with dependencies. I think doing so is valid though - e.g. a function that's hardcoded to compose resources from a specific provider should depend on that provider. Signed-off-by: Nic Cope <[email protected]>
1 parent 5ba0282 commit c6b62b7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/controller/pkg/revision/dependency.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ func NewPackageDependencyManager(c client.Client, nd dag.NewDAGFn, t v1beta1.Pac
7373
}
7474

7575
// Resolve resolves package dependencies.
76-
func (m *PackageDependencyManager) Resolve(ctx context.Context, pkg runtime.Object, pr v1.PackageRevision) (found, installed, invalid int, err error) { //nolint:gocognit // TODO(negz): Can this be refactored for less complexity?
76+
func (m *PackageDependencyManager) Resolve(ctx context.Context, meta runtime.Object, pr v1.PackageRevision) (found, installed, invalid int, err error) { //nolint:gocognit // TODO(negz): Can this be refactored for less complexity?
7777
// If we are inactive, we don't need to resolve dependencies.
7878
if pr.GetDesiredState() == v1.PackageRevisionInactive {
7979
return 0, 0, 0, nil
8080
}
8181

82-
pack, ok := xpkg.TryConvertToPkg(pkg, &pkgmetav1.Provider{}, &pkgmetav1.Configuration{})
82+
pack, ok := xpkg.TryConvertToPkg(meta, &pkgmetav1.Provider{}, &pkgmetav1.Function{}, &pkgmetav1.Configuration{})
8383
if !ok {
8484
return found, installed, invalid, errors.New(errNotMeta)
8585
}

0 commit comments

Comments
 (0)