Skip to content

Commit bb4323d

Browse files
committed
feat: introduce v1alpha2 for Insights DataGather
This commit introduces the v1alpha2 version of the DataGather CRD for Insights. Signed-off-by: Ondrej Pokorny <[email protected]>
1 parent 0f14a21 commit bb4323d

16 files changed

+4414
-1
lines changed

insights/install.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ import (
55
"k8s.io/apimachinery/pkg/runtime/schema"
66

77
insightsv1alpha1 "github.com/openshift/api/insights/v1alpha1"
8+
insightsv1alpha2 "github.com/openshift/api/insights/v1alpha2"
89
)
910

1011
const (
1112
GroupName = "insights.openshift.io"
1213
)
1314

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

insights/v1alpha2/Makefile

+3
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/v1alpha2"

insights/v1alpha2/doc.go

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// +k8s:deepcopy-gen=package,register
2+
// +k8s:defaulter-gen=TypeMeta
3+
// +k8s:openapi-gen=true
4+
5+
// +kubebuilder:validation:Optional
6+
// +groupName=insights.openshift.io
7+
// Package v1alpha2 is the v1alpha2 version of the API.
8+
package v1alpha2

insights/v1alpha2/register.go

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package v1alpha2
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: "v1alpha2"}
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)