Remove BPA from Makefile
[icn.git] / cmd / bpa-operator / vendor / github.com / coreos / prometheus-operator / pkg / apis / monitoring / v1 / register.go
1 // Copyright 2018 The prometheus-operator Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 package v1
16
17 import (
18         metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
19         "k8s.io/apimachinery/pkg/runtime"
20         "k8s.io/apimachinery/pkg/runtime/schema"
21
22         "github.com/coreos/prometheus-operator/pkg/apis/monitoring"
23 )
24
25 // SchemeGroupVersion is the group version used to register these objects
26 var SchemeGroupVersion = schema.GroupVersion{Group: monitoring.GroupName, Version: Version}
27
28 // Resource takes an unqualified resource and returns a Group qualified GroupResource
29 func Resource(resource string) schema.GroupResource {
30         return SchemeGroupVersion.WithResource(resource).GroupResource()
31 }
32
33 var (
34         // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
35         SchemeBuilder      runtime.SchemeBuilder
36         localSchemeBuilder = &SchemeBuilder
37         AddToScheme        = localSchemeBuilder.AddToScheme
38 )
39
40 func init() {
41         // We only register manually written functions here. The registration of the
42         // generated functions takes place in the generated files. The separation
43         // makes the code compile even when the generated files are missing.
44         localSchemeBuilder.Register(addKnownTypes)
45 }
46
47 // Adds the list of known types to api.Scheme.
48 func addKnownTypes(scheme *runtime.Scheme) error {
49         scheme.AddKnownTypes(SchemeGroupVersion,
50                 &Prometheus{},
51                 &PrometheusList{},
52                 &ServiceMonitor{},
53                 &ServiceMonitorList{},
54                 &Alertmanager{},
55                 &AlertmanagerList{},
56                 &PrometheusRule{},
57                 &PrometheusRuleList{},
58         )
59         metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
60         return nil
61 }