Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix naming of GroupVersion to be in line with OperatorSDK v1 #173

Merged
merged 1 commit into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion LICENSE-3rdparty.csv
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,6 @@ core,"sigs.k8s.io/controller-runtime/pkg/reconcile",Apache-2.0
core,"sigs.k8s.io/controller-runtime/pkg/recorder",Apache-2.0
core,"sigs.k8s.io/controller-runtime/pkg/runtime/inject",Apache-2.0
core,"sigs.k8s.io/controller-runtime/pkg/runtime/log",Apache-2.0
core,"sigs.k8s.io/controller-runtime/pkg/runtime/scheme",Apache-2.0
core,"sigs.k8s.io/controller-runtime/pkg/scheme",Apache-2.0
core,"sigs.k8s.io/controller-runtime/pkg/source",Apache-2.0
core,"sigs.k8s.io/controller-runtime/pkg/source/internal",Apache-2.0
Expand Down
16 changes: 8 additions & 8 deletions api/v1alpha1/register.go → api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@
// Copyright 2016-2019 Datadog, Inc.

// Package v1alpha1 contains API Schema definitions for the datadoghq v1alpha1 API group
// +k8s:deepcopy-gen=package,register
// +kubebuilder:object:generate=true
// +groupName=datadoghq.com
package v1alpha1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/runtime/scheme"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: "datadoghq.com", Version: "v1alpha1"}
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "datadoghq.com", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

// AddToScheme is a global function that registers this API group & version to a scheme
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)

// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
return GroupVersion.WithKind(kind).GroupKind()
}

// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
return GroupVersion.WithResource(resource).GroupResource()
}
2 changes: 1 addition & 1 deletion api/v1alpha1/test/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

var (
// apiVersion datadoghqv1alpha1 api version
apiVersion = fmt.Sprintf("%s/%s", datadoghqv1alpha1.SchemeGroupVersion.Group, datadoghqv1alpha1.SchemeGroupVersion.Version)
apiVersion = fmt.Sprintf("%s/%s", datadoghqv1alpha1.GroupVersion.Group, datadoghqv1alpha1.GroupVersion.Version)
pullPolicy = v1.PullIfNotPresent
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/kubectl-datadog/agent/upgrade/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func Test_options_upgrade(t *testing.T) {
t.Fatalf("Unable to add DatadogAgent scheme: %v", err)
}

s.AddKnownTypes(datadoghqv1alpha1.SchemeGroupVersion, &datadoghqv1alpha1.DatadogAgent{})
s.AddKnownTypes(datadoghqv1alpha1.GroupVersion, &datadoghqv1alpha1.DatadogAgent{})

tests := []struct {
name string
Expand Down Expand Up @@ -138,7 +138,7 @@ func buildDatadogAgent(image string) *datadoghqv1alpha1.DatadogAgent {
return &datadoghqv1alpha1.DatadogAgent{
TypeMeta: metav1.TypeMeta{
Kind: "DatadogAgent",
APIVersion: fmt.Sprintf("%s/%s", datadoghqv1alpha1.SchemeGroupVersion.Group, datadoghqv1alpha1.SchemeGroupVersion.Version),
APIVersion: fmt.Sprintf("%s/%s", datadoghqv1alpha1.GroupVersion.Group, datadoghqv1alpha1.GroupVersion.Version),
},
ObjectMeta: metav1.ObjectMeta{
Namespace: "datadog-agent",
Expand Down
4 changes: 2 additions & 2 deletions cmd/kubectl-datadog/clusteragent/upgrade/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func Test_options_upgrade(t *testing.T) {
t.Fatalf("Unable to add DatadogAgent scheme: %v", err)
}

s.AddKnownTypes(datadoghqv1alpha1.SchemeGroupVersion, &datadoghqv1alpha1.DatadogAgent{})
s.AddKnownTypes(datadoghqv1alpha1.GroupVersion, &datadoghqv1alpha1.DatadogAgent{})

tests := []struct {
name string
Expand Down Expand Up @@ -113,7 +113,7 @@ func buildDatadogAgent(image string) *datadoghqv1alpha1.DatadogAgent {
return &datadoghqv1alpha1.DatadogAgent{
TypeMeta: metav1.TypeMeta{
Kind: "DatadogAgent",
APIVersion: fmt.Sprintf("%s/%s", datadoghqv1alpha1.SchemeGroupVersion.Group, datadoghqv1alpha1.SchemeGroupVersion.Version),
APIVersion: fmt.Sprintf("%s/%s", datadoghqv1alpha1.GroupVersion.Group, datadoghqv1alpha1.GroupVersion.Version),
},
ObjectMeta: metav1.ObjectMeta{
Namespace: "datadog-agent",
Expand Down
2 changes: 1 addition & 1 deletion controllers/datadogagent/clusteragent.go
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ func buildClusterAgentClusterRole(dda *datadoghqv1alpha1.DatadogAgent, name, age

// ExtendedDaemonsetReplicaSets
rbacRules = append(rbacRules, rbacv1.PolicyRule{
APIGroups: []string{datadoghqv1alpha1.SchemeGroupVersion.Group},
APIGroups: []string{datadoghqv1alpha1.GroupVersion.Group},
Resources: []string{
datadoghqv1alpha1.ExtendedDaemonSetReplicaSetResource,
},
Expand Down
2 changes: 1 addition & 1 deletion controllers/datadogagent/clusteragent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ func TestReconcileDatadogAgent_createNewClusterAgentDeployment(t *testing.T) {

// Register operator types with the runtime scheme.
s := scheme.Scheme
s.AddKnownTypes(datadoghqv1alpha1.SchemeGroupVersion, &datadoghqv1alpha1.DatadogAgent{})
s.AddKnownTypes(datadoghqv1alpha1.GroupVersion, &datadoghqv1alpha1.DatadogAgent{})

type fields struct {
client client.Client
Expand Down
10 changes: 5 additions & 5 deletions controllers/datadogagent/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func TestReconcileDatadogAgent_createNewExtendedDaemonSet(t *testing.T) {

// Register operator types with the runtime scheme.
s := scheme.Scheme
s.AddKnownTypes(datadoghqv1alpha1.SchemeGroupVersion, &datadoghqv1alpha1.DatadogAgent{})
s.AddKnownTypes(datadoghqv1alpha1.SchemeGroupVersion, &edsdatadoghqv1alpha1.ExtendedDaemonSet{})
s.AddKnownTypes(datadoghqv1alpha1.GroupVersion, &datadoghqv1alpha1.DatadogAgent{})
s.AddKnownTypes(datadoghqv1alpha1.GroupVersion, &edsdatadoghqv1alpha1.ExtendedDaemonSet{})
s.AddKnownTypes(appsv1.SchemeGroupVersion, &appsv1.DaemonSet{})

type fields struct {
Expand Down Expand Up @@ -145,7 +145,7 @@ func TestReconcileDatadogAgent_Reconcile(t *testing.T) {

// Register operator types with the runtime scheme.
s := scheme.Scheme
s.AddKnownTypes(datadoghqv1alpha1.SchemeGroupVersion, &datadoghqv1alpha1.DatadogAgent{})
s.AddKnownTypes(datadoghqv1alpha1.GroupVersion, &datadoghqv1alpha1.DatadogAgent{})
s.AddKnownTypes(edsdatadoghqv1alpha1.GroupVersion, &edsdatadoghqv1alpha1.ExtendedDaemonSet{})
s.AddKnownTypes(appsv1.SchemeGroupVersion, &appsv1.DaemonSet{})
s.AddKnownTypes(appsv1.SchemeGroupVersion, &appsv1.Deployment{})
Expand Down Expand Up @@ -206,7 +206,7 @@ func TestReconcileDatadogAgent_Reconcile(t *testing.T) {
_ = c.Create(context.TODO(), &datadoghqv1alpha1.DatadogAgent{
TypeMeta: metav1.TypeMeta{
Kind: "DatadogAgent",
APIVersion: fmt.Sprintf("%s/%s", datadoghqv1alpha1.SchemeGroupVersion.Group, datadoghqv1alpha1.SchemeGroupVersion.Version),
APIVersion: fmt.Sprintf("%s/%s", datadoghqv1alpha1.GroupVersion.Group, datadoghqv1alpha1.GroupVersion.Version),
},
ObjectMeta: metav1.ObjectMeta{
Namespace: resourcesNamespace,
Expand Down Expand Up @@ -246,7 +246,7 @@ func TestReconcileDatadogAgent_Reconcile(t *testing.T) {
_ = c.Create(context.TODO(), &datadoghqv1alpha1.DatadogAgent{
TypeMeta: metav1.TypeMeta{
Kind: "DatadogAgent",
APIVersion: fmt.Sprintf("%s/%s", datadoghqv1alpha1.SchemeGroupVersion.Group, datadoghqv1alpha1.SchemeGroupVersion.Version),
APIVersion: fmt.Sprintf("%s/%s", datadoghqv1alpha1.GroupVersion.Group, datadoghqv1alpha1.GroupVersion.Version),
},
ObjectMeta: metav1.ObjectMeta{
Namespace: resourcesNamespace,
Expand Down