-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(controller): ensure iteration on capsule ownerreferences
Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
- Loading branch information
1 parent
9a3a8b0
commit cde6e15
Showing
6 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2020-2023 Project Capsule Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package namespace | ||
|
||
import ( | ||
"strings" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
capsulev1beta2 "github.com/projectcapsule/capsule/api/v1beta2" | ||
) | ||
|
||
const ( | ||
ObjectReferenceTenantKind = "Tenant" | ||
) | ||
|
||
func isTenantOwnerReference(or metav1.OwnerReference) bool { | ||
parts := strings.Split(or.APIVersion, "/") | ||
if len(parts) != 2 { | ||
return false | ||
} | ||
|
||
group := parts[0] | ||
|
||
return group == capsulev1beta2.GroupVersion.Group && or.Kind == ObjectReferenceTenantKind | ||
} |