-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(adapters): Extract common functionalites for reconcilation of na…
…tive policies Signed-off-by: Anurag Rajawat <[email protected]>
- Loading branch information
1 parent
c460dc3
commit 98355cc
Showing
4 changed files
with
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2023 Authors of Nimbus | ||
|
||
package common | ||
|
||
type Request struct { | ||
Name string | ||
Namespace string | ||
} |
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,13 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2023 Authors of Nimbus | ||
|
||
package util | ||
|
||
import ( | ||
"strings" | ||
) | ||
|
||
func ExtractNpName(kspName string) string { | ||
words := strings.Split(kspName, "-") | ||
return strings.Join(words[:len(words)-1], "-") | ||
} |
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,12 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright 2023 Authors of Nimbus | ||
|
||
package util | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
func IsOrphan(ownerRefs []metav1.OwnerReference, ownerKind string) bool { | ||
return len(ownerRefs) == 0 || ownerRefs[0].Kind != ownerKind | ||
} |