diff --git a/pkg/db/dbpackage.go b/pkg/db/dbpackage.go index f451ff19..368f6a80 100644 --- a/pkg/db/dbpackage.go +++ b/pkg/db/dbpackage.go @@ -36,7 +36,7 @@ type dbPackage struct { } func (p dbPackage) KubeObjectName() string { - return p.Key().String() + return p.Key().NonNSString() } func (p dbPackage) KubeObjectNamespace() string { diff --git a/pkg/db/dbpackagerevision.go b/pkg/db/dbpackagerevision.go index ac3cf419..4af5253d 100644 --- a/pkg/db/dbpackagerevision.go +++ b/pkg/db/dbpackagerevision.go @@ -42,7 +42,7 @@ type dbPackageRevision struct { } func (pr dbPackageRevision) KubeObjectName() string { - return pr.Key().String() + return pr.Key().NonNSString() } func (pr dbPackageRevision) KubeObjectNamespace() string { diff --git a/pkg/db/dbrepository.go b/pkg/db/dbrepository.go index 74ad87b9..fef5154f 100644 --- a/pkg/db/dbrepository.go +++ b/pkg/db/dbrepository.go @@ -38,7 +38,7 @@ type dbRepository struct { } func (r dbRepository) KubeObjectName() string { - return r.Key().String() + return r.Key().NonNSString() } func (r dbRepository) KubeObjectNamespace() string { diff --git a/pkg/repository/repository.go b/pkg/repository/repository.go index d71b4ec0..c38d9dc3 100644 --- a/pkg/repository/repository.go +++ b/pkg/repository/repository.go @@ -39,6 +39,10 @@ func (n PackageRevisionKey) String() string { return fmt.Sprintf("%s.%s.%s.%s.%s", n.Namespace, n.Repository, n.Package, n.Revision, string(n.WorkspaceName)) } +func (n PackageRevisionKey) NonNSString() string { + return fmt.Sprintf("%s.%s.%s.%s", n.Repository, n.Package, n.Revision, string(n.WorkspaceName)) +} + func (n PackageRevisionKey) PackageKey() PackageKey { return PackageKey{ Namespace: n.Namespace, @@ -62,6 +66,10 @@ func (n PackageKey) String() string { return fmt.Sprintf("%s.%s.%s", n.Namespace, n.Repository, n.Package) } +func (n PackageKey) NonNSString() string { + return fmt.Sprintf("%s.%s", n.Repository, n.Package) +} + func (n PackageKey) RepositoryKey() RepositoryKey { return RepositoryKey{ Namespace: n.Namespace, @@ -77,6 +85,10 @@ func (n RepositoryKey) String() string { return fmt.Sprintf("%s.%s", n.Namespace, n.Repository) } +func (n RepositoryKey) NonNSString() string { + return fmt.Sprintf("%s", n.Repository) +} + // PackageRevision is an abstract package version. // We have a single object for both Revision and Resources, because conceptually they are one object. // The best way we've found (so far) to represent them in k8s is as two resources, but they map to the same object.