Skip to content

Commit 32805f9

Browse files
author
Per Goncalves da Silva
committed
PoC test-operator own go.mod
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent b6f47bc commit 32805f9

27 files changed

+1395
-20
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
bundle.Dockerfile
22
bundle
33
bin
4+
vendor

testdata/operators/test-operator/v1/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test-unit: $(SETUP_ENVTEST)
3434

3535
.PHONY: manifests
3636
manifests: $(CONTROLLER_GEN)
37-
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) crd paths="../api/v1/..." output:dir=dist/chart/crds
37+
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) crd paths="./api/..." output:dir=dist/chart/crds
3838
$(CONTROLLER_GEN) --load-build-tags=$(GO_BUILD_TAGS) rbac:roleName=test-operator-manager-role paths="./..." output:dir=dist/chart/templates
3939

4040
.PHONY: bundle
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
Copyright 2025.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// Package v1 contains API Schema definitions for the testolm v1 API group.
18+
// +kubebuilder:object:generate=false
19+
// +groupName=testolm.operatorframework.io
20+
package v1
21+
22+
import (
23+
"k8s.io/apimachinery/pkg/runtime/schema"
24+
"sigs.k8s.io/controller-runtime/pkg/scheme"
25+
)
26+
27+
var (
28+
// GroupVersion is group version used to register these objects.
29+
GroupVersion = schema.GroupVersion{Group: "testolm.operatorframework.io", Version: "v1"}
30+
31+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
32+
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
33+
34+
// AddToScheme adds the types in this group-version to the given scheme.
35+
AddToScheme = SchemeBuilder.AddToScheme
36+
)
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
Copyright 2025.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// TestOperatorSpec defines the desired state of TestOperator.
24+
type TestOperatorSpec struct {
25+
// +optional
26+
Message string `json:"message,omitempty"`
27+
}
28+
29+
// TestOperatorStatus defines the observed state of TestOperator.
30+
type TestOperatorStatus struct {
31+
Echo string `json:"echo,omitempty"`
32+
}
33+
34+
// +kubebuilder:object:root=true
35+
// +kubebuilder:subresource:status
36+
37+
// TestOperator is the Schema for the testoperators API.
38+
type TestOperator struct {
39+
metav1.TypeMeta `json:",inline"`
40+
metav1.ObjectMeta `json:"metadata,omitempty"`
41+
42+
Spec TestOperatorSpec `json:"spec,omitempty"`
43+
Status TestOperatorStatus `json:"status,omitempty"`
44+
}
45+
46+
// +kubebuilder:object:root=true
47+
48+
// TestOperatorList contains a list of TestOperator.
49+
type TestOperatorList struct {
50+
metav1.TypeMeta `json:",inline"`
51+
metav1.ListMeta `json:"metadata,omitempty"`
52+
Items []TestOperator `json:"items"`
53+
}
54+
55+
func init() {
56+
SchemeBuilder.Register(&TestOperator{}, &TestOperatorList{})
57+
}

testdata/operators/test-operator/v1/api/v1/zz_generated.deepcopy.go

Lines changed: 114 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

testdata/operators/test-operator/v1/cmd/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ import (
3737
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
3838
"sigs.k8s.io/controller-runtime/pkg/webhook"
3939

40-
testolmv1 "github.com/operator-framework/operator-controller/testdata/operators/test-operator/api/v1"
41-
"github.com/operator-framework/operator-controller/testdata/operators/test-operator/v1/internal/controller"
40+
testolmv1 "testolmv1/api/v1"
41+
"testolmv1/internal/controller"
4242
)
4343

4444
var (
Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,91 @@
1-
module v1
1+
module testolmv1
22

3-
go 1.24
3+
go 1.24.3
4+
5+
require (
6+
github.com/stretchr/testify v1.10.0
7+
k8s.io/apimachinery v0.33.2
8+
k8s.io/client-go v0.33.2
9+
k8s.io/klog/v2 v2.130.1
10+
sigs.k8s.io/controller-runtime v0.21.0
11+
)
12+
13+
require (
14+
cel.dev/expr v0.19.1 // indirect
15+
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
16+
github.com/beorn7/perks v1.0.1 // indirect
17+
github.com/blang/semver/v4 v4.0.0 // indirect
18+
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
19+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
20+
github.com/davecgh/go-spew v1.1.1 // indirect
21+
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
22+
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
23+
github.com/felixge/httpsnoop v1.0.4 // indirect
24+
github.com/fsnotify/fsnotify v1.7.0 // indirect
25+
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
26+
github.com/go-logr/logr v1.4.2 // indirect
27+
github.com/go-logr/stdr v1.2.2 // indirect
28+
github.com/go-openapi/jsonpointer v0.21.0 // indirect
29+
github.com/go-openapi/jsonreference v0.20.2 // indirect
30+
github.com/go-openapi/swag v0.23.0 // indirect
31+
github.com/gogo/protobuf v1.3.2 // indirect
32+
github.com/google/btree v1.1.3 // indirect
33+
github.com/google/cel-go v0.23.2 // indirect
34+
github.com/google/gnostic-models v0.6.9 // indirect
35+
github.com/google/go-cmp v0.7.0 // indirect
36+
github.com/google/uuid v1.6.0 // indirect
37+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 // indirect
38+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
39+
github.com/josharian/intern v1.0.0 // indirect
40+
github.com/json-iterator/go v1.1.12 // indirect
41+
github.com/mailru/easyjson v0.7.7 // indirect
42+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
43+
github.com/modern-go/reflect2 v1.0.2 // indirect
44+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
45+
github.com/pkg/errors v0.9.1 // indirect
46+
github.com/pmezard/go-difflib v1.0.0 // indirect
47+
github.com/prometheus/client_golang v1.22.0 // indirect
48+
github.com/prometheus/client_model v0.6.1 // indirect
49+
github.com/prometheus/common v0.62.0 // indirect
50+
github.com/prometheus/procfs v0.15.1 // indirect
51+
github.com/spf13/cobra v1.8.1 // indirect
52+
github.com/spf13/pflag v1.0.5 // indirect
53+
github.com/stoewer/go-strcase v1.3.0 // indirect
54+
github.com/x448/float16 v0.8.4 // indirect
55+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
56+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 // indirect
57+
go.opentelemetry.io/otel v1.33.0 // indirect
58+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 // indirect
59+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0 // indirect
60+
go.opentelemetry.io/otel/metric v1.33.0 // indirect
61+
go.opentelemetry.io/otel/sdk v1.33.0 // indirect
62+
go.opentelemetry.io/otel/trace v1.33.0 // indirect
63+
go.opentelemetry.io/proto/otlp v1.4.0 // indirect
64+
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
65+
golang.org/x/net v0.38.0 // indirect
66+
golang.org/x/oauth2 v0.27.0 // indirect
67+
golang.org/x/sync v0.12.0 // indirect
68+
golang.org/x/sys v0.31.0 // indirect
69+
golang.org/x/term v0.30.0 // indirect
70+
golang.org/x/text v0.23.0 // indirect
71+
golang.org/x/time v0.9.0 // indirect
72+
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
73+
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect
74+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect
75+
google.golang.org/grpc v1.68.1 // indirect
76+
google.golang.org/protobuf v1.36.5 // indirect
77+
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
78+
gopkg.in/inf.v0 v0.9.1 // indirect
79+
gopkg.in/yaml.v3 v3.0.1 // indirect
80+
k8s.io/api v0.33.2 // indirect
81+
k8s.io/apiextensions-apiserver v0.33.0 // indirect
82+
k8s.io/apiserver v0.33.0 // indirect
83+
k8s.io/component-base v0.33.0 // indirect
84+
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
85+
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
86+
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect
87+
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
88+
sigs.k8s.io/randfill v1.0.0 // indirect
89+
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
90+
sigs.k8s.io/yaml v1.4.0 // indirect
91+
)

0 commit comments

Comments
 (0)