-
Notifications
You must be signed in to change notification settings - Fork 786
/
owners.go
40 lines (36 loc) · 888 Bytes
/
owners.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package kube
import (
jenkinsv1 "github.com/jenkins-x/jx-api/pkg/apis/jenkins.io/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func ServiceOwnerRef(svc *corev1.Service) metav1.OwnerReference {
controller := true
return metav1.OwnerReference{
APIVersion: "v1",
Kind: "Service",
Name: svc.Name,
UID: svc.UID,
Controller: &controller,
}
}
func PodOwnerRef(pod *corev1.Pod) metav1.OwnerReference {
controller := true
return metav1.OwnerReference{
APIVersion: "v1",
Kind: "Pod",
Name: pod.Name,
UID: pod.UID,
Controller: &controller,
}
}
func ExtensionOwnerRef(ext *jenkinsv1.Extension) metav1.OwnerReference {
controller := true
return metav1.OwnerReference{
APIVersion: "v1",
Kind: "Extension",
Name: ext.Name,
UID: ext.UID,
Controller: &controller,
}
}