Skip to content

Commit

Permalink
Remove namespace from package names
Browse files Browse the repository at this point in the history
  • Loading branch information
liamfallon committed Oct 23, 2024
1 parent 8f9aa62 commit 3cd529a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/db/dbpackage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/db/dbpackagerevision.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/db/dbrepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 12 additions & 0 deletions pkg/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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.
Expand Down

0 comments on commit 3cd529a

Please sign in to comment.