Skip to content
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
15 changes: 15 additions & 0 deletions pkg/webhook/testdata/cronjob_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,28 @@ limitations under the License.
*/

//go:generate ../../../.run-controller-gen.sh webhook paths=. output:dir=.
//go:generate ../../../.run-controller-gen.sh object paths=. output:dir=.

// +groupName=testdata.kubebuilder.io
// +versionName=v1
// +k8s:deepcopy-gen=package
package cronjob

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"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: "testdata.kubebuilder.io", Version: "v1"}

// 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
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
Expand Down
2 changes: 1 addition & 1 deletion pkg/webhook/testdata/valid-ordered/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (v cronJobValidator) ValidateDelete(ctx context.Context, obj runtime.Object

// +kubebuilder:webhook:webhookVersions=v1,verbs=create;update,path=/validate-testdata-kubebuilder-io-v1-cronjoblist,mutating=false,failurePolicy=fail,matchPolicy=Equivalent,groups=testdata.kubebuilder.io,resources=cronjoblist,versions=v1,name=cronjoblist.testdata.kubebuilder.io,sideEffects=None,admissionReviewVersions=v1;v1beta1,reinvocationPolicy=Never

type cronjobListValidator struct {
type cronJobListValidator struct {
client client.Client
}

Expand Down
102 changes: 102 additions & 0 deletions pkg/webhook/testdata/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 1 addition & 11 deletions test.sh
Copy link
Contributor Author

@mjlshen mjlshen Aug 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was done in line with #1227 (comment) - since pkg/webhook/testdata builds now, it doesn't need to be skipped anymore

Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,4 @@ make lint

header_text "running go test"

for dir in $(find . -name go.mod -exec dirname {} \;); do
# Includes "BadDeepCopy" types that are not supposed to result in
# valid code generation
if [[ "$dir" == "./pkg/deepcopy/testdata" ]]; then continue; fi

# https://github.com/kubernetes-sigs/controller-tools/issues/1227
if [[ "$dir" == "./pkg/webhook/testdata" ]]; then continue; fi

echo "Testing module in $dir"
(cd "$dir" && go test -race ./... -parallel 4)
done
go test -race ./pkg/... ./cmd/... -parallel 4