mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-08-25 16:07:24 +00:00
feat: upstream enterprise preview --------- Signed-off-by: Oliver Baehler <oliver@sudo-i.net> Co-authored-by: CorentinPtrl <pitrel.corentin@gmail.com>
35 lines
752 B
Go
35 lines
752 B
Go
// Copyright 2020-2026 Project Capsule Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package tenant
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
|
|
|
capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2"
|
|
"github.com/projectcapsule/capsule/pkg/tenant"
|
|
)
|
|
|
|
type OwnerReference struct{}
|
|
|
|
func (o OwnerReference) Object() client.Object {
|
|
return &capsulev1beta2.Tenant{}
|
|
}
|
|
|
|
func (o OwnerReference) Field() string {
|
|
return OwnerKindIndexerFieldName
|
|
}
|
|
|
|
func (o OwnerReference) Func() client.IndexerFunc {
|
|
return func(object client.Object) []string {
|
|
tnt, ok := object.(*capsulev1beta2.Tenant)
|
|
if !ok {
|
|
panic(fmt.Errorf("expected type *capsulev1beta2.Tenant, got %T", tnt))
|
|
}
|
|
|
|
return tenant.GetOwnersWithKinds(tnt)
|
|
}
|
|
}
|