-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
apiservices.go
44 lines (39 loc) · 1.22 KB
/
apiservices.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
41
42
43
44
package components
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
apiregv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
v1 "kubevirt.io/api/core/v1"
)
func NewVirtAPIAPIServices(installNamespace string) []*apiregv1.APIService {
apiservices := []*apiregv1.APIService{}
for _, version := range v1.SubresourceGroupVersions {
subresourceAggregatedApiName := version.Version + "." + version.Group
apiservices = append(apiservices, &apiregv1.APIService{
TypeMeta: metav1.TypeMeta{
APIVersion: "apiregistration.k8s.io/v1",
Kind: "APIService",
},
ObjectMeta: metav1.ObjectMeta{
Name: subresourceAggregatedApiName,
Labels: map[string]string{
v1.AppLabel: "virt-api-aggregator",
v1.ManagedByLabel: v1.ManagedByLabelOperatorValue,
},
Annotations: map[string]string{
certificatesSecretAnnotationKey: VirtApiCertSecretName,
},
},
Spec: apiregv1.APIServiceSpec{
Service: &apiregv1.ServiceReference{
Namespace: installNamespace,
Name: VirtApiServiceName,
},
Group: version.Group,
Version: version.Version,
GroupPriorityMinimum: 1000,
VersionPriority: 15,
},
})
}
return apiservices
}