Skip to content

Commit e8b970d

Browse files
committed
feat(insights): add v1 version
Signed-off-by: Ondrej Pokorny <[email protected]>
1 parent 96c90e0 commit e8b970d

16 files changed

+5042
-1
lines changed

insights/install.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"k8s.io/apimachinery/pkg/runtime"
55
"k8s.io/apimachinery/pkg/runtime/schema"
66

7+
insightsv1 "github.com/openshift/api/insights/v1"
78
insightsv1alpha1 "github.com/openshift/api/insights/v1alpha1"
89
insightsv1alpha2 "github.com/openshift/api/insights/v1alpha2"
910
)
@@ -13,7 +14,7 @@ const (
1314
)
1415

1516
var (
16-
schemeBuilder = runtime.NewSchemeBuilder(insightsv1alpha1.Install, insightsv1alpha2.Install)
17+
schemeBuilder = runtime.NewSchemeBuilder(insightsv1alpha1.Install, insightsv1alpha2.Install, insightsv1.Install)
1718
// Install is a function which adds every version of this group to a scheme
1819
Install = schemeBuilder.AddToScheme
1920
)

insights/v1/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.PHONY: test
2+
test:
3+
make -C ../../tests test GINKGO_EXTRA_ARGS=--focus="insights.openshift.io/v1"

insights/v1/doc.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// +k8s:deepcopy-gen=package,register
2+
// +k8s:defaulter-gen=TypeMeta
3+
// +k8s:openapi-gen=true
4+
5+
// +groupName=insights.openshift.io
6+
// Package v1 is the v1 version of the API.
7+
package v1

insights/v1/register.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package v1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
"k8s.io/apimachinery/pkg/runtime"
6+
"k8s.io/apimachinery/pkg/runtime/schema"
7+
)
8+
9+
var (
10+
GroupName = "insights.openshift.io"
11+
GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
12+
schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
13+
// Install is a function which adds this version to a scheme
14+
Install = schemeBuilder.AddToScheme
15+
16+
// SchemeGroupVersion generated code relies on this name
17+
// Deprecated
18+
SchemeGroupVersion = GroupVersion
19+
// AddToScheme exists solely to keep the old generators creating valid code
20+
// DEPRECATED
21+
AddToScheme = schemeBuilder.AddToScheme
22+
)
23+
24+
// Resource generated code relies on this being here, but it logically belongs to the group
25+
// DEPRECATED
26+
func Resource(resource string) schema.GroupResource {
27+
return schema.GroupResource{Group: GroupName, Resource: resource}
28+
}
29+
30+
// Adds the list of known types to api.Scheme.
31+
func addKnownTypes(scheme *runtime.Scheme) error {
32+
scheme.AddKnownTypes(GroupVersion,
33+
&DataGather{},
34+
&DataGatherList{},
35+
)
36+
metav1.AddToGroupVersion(scheme, GroupVersion)
37+
return nil
38+
}

0 commit comments

Comments
 (0)