mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 10:49:15 +00:00
Implement new setup key resource (#178)
This change implements a new resource called SetupKey that manages the lifecycle of setup keys and stores them in secrets. A major change here is that we are also switching to using SSA for resource management. Part of #172 Signed-off-by: Philip Laine <philip.laine@gmail.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package ssautil
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
metav1ac "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
|
||||
)
|
||||
|
||||
func OwnerReference(owner client.Object, scheme *runtime.Scheme) (*metav1ac.OwnerReferenceApplyConfiguration, error) {
|
||||
gvk, err := apiutil.GVKForObject(owner, scheme)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return metav1ac.OwnerReference().
|
||||
WithAPIVersion(gvk.GroupVersion().String()).
|
||||
WithKind(gvk.Kind).
|
||||
WithName(owner.GetName()).
|
||||
WithUID(owner.GetUID()).
|
||||
WithController(true).
|
||||
WithBlockOwnerDeletion(true), nil
|
||||
}
|
||||
Reference in New Issue
Block a user