Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
L3n41c committed Oct 8, 2024
1 parent 4a3f1d5 commit 93ce5e4
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 139 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ bin/$(PLATFORM)/yq: Makefile
hack/install-yq.sh v4.31.2

bin/$(PLATFORM)/golangci-lint: Makefile
hack/golangci-lint.sh -b "bin/$(PLATFORM)" v1.59.1
hack/golangci-lint.sh -b "bin/$(PLATFORM)" v1.61.0

bin/$(PLATFORM)/operator-sdk: Makefile
hack/install-operator-sdk.sh v1.34.1
Expand Down
32 changes: 32 additions & 0 deletions api/k8s.io/policy/v1beta1/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2024-present Datadog, Inc.

package v1beta1

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

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "policy", Version: "v1beta1"}

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

// 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 GroupVersion.WithKind(kind).GroupKind()
}

// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return GroupVersion.WithResource(resource).GroupResource()
}
4 changes: 4 additions & 0 deletions api/k8s.io/policy/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,7 @@ type PodSecurityPolicyList struct {
// items is a list of schema objects.
Items []PodSecurityPolicy `json:"items" protobuf:"bytes,2,rep,name=items"`
}

func init() {
SchemeBuilder.Register(&PodSecurityPolicy{}, &PodSecurityPolicyList{})
}
2 changes: 2 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (

datadoghqv1alpha1 "github.com/DataDog/datadog-operator/api/datadoghq/v1alpha1"
datadoghqv2alpha1 "github.com/DataDog/datadog-operator/api/datadoghq/v2alpha1"
psppolicyv1beta1 "github.com/DataDog/datadog-operator/api/k8s.io/policy/v1beta1"
"github.com/DataDog/datadog-operator/internal/controller"
"github.com/DataDog/datadog-operator/internal/controller/metrics"

Expand Down Expand Up @@ -65,6 +66,7 @@ func init() {
utilruntime.Must(datadoghqv1alpha1.AddToScheme(scheme))
utilruntime.Must(edsdatadoghqv1alpha1.AddToScheme(scheme))
utilruntime.Must(datadoghqv2alpha1.AddToScheme(scheme))
utilruntime.Must(psppolicyv1beta1.AddToScheme(scheme))
// +kubebuilder:scaffold:scheme
}

Expand Down
13 changes: 11 additions & 2 deletions config/crd/bases/v1/datadoghq.com_datadogagents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2157,6 +2157,9 @@ spec:
type: string
type: array
x-kubernetes-list-type: set
required:
- namespace
- secrets
type: object
type: array
x-kubernetes-list-type: atomic
Expand Down Expand Up @@ -4139,10 +4142,13 @@ spec:
description: The ConfigMap to select from
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?
type: string
optional:
description: Specify whether the ConfigMap must be defined
Expand All @@ -4156,10 +4162,13 @@ spec:
description: The Secret to select from
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?
type: string
optional:
description: Specify whether the Secret must be defined
Expand Down
Loading

0 comments on commit 93ce5e4

Please sign in to comment.