From 9853d93f7dcb37ee5c5bb7faafb6722754b64fda Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Sat, 30 Dec 2023 20:53:28 -0800 Subject: [PATCH] Update crd fuzzer (#91) Signed-off-by: Tamal Saha --- .github/workflows/ci.yml | 6 +++--- .github/workflows/release-tracker.yml | 2 +- .github/workflows/update-crds.yaml | 2 +- Makefile | 1 + apis/kubevault/v1alpha1/conversion_test.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- vendor/kmodules.xyz/crd-schema-fuzz/fuzz.go | 10 +++++++++- vendor/modules.txt | 2 +- 9 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43802df5d..1144f66d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ concurrency: jobs: build: name: Build - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Set up Go 1.21 @@ -42,11 +42,11 @@ jobs: kubernetes: name: Kubernetes - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: build strategy: matrix: - k8s: [v1.19.16, v1.20.15, v1.21.14, v1.22.17, v1.23.17, v1.24.12, v1.25.8, v1.26.3, v1.27.1] + k8s: [v1.20.15, v1.21.14, v1.22.17, v1.23.17, v1.24.12, v1.25.8, v1.26.3, v1.27.1, v1.28.0, v1.29.0] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/release-tracker.yml b/.github/workflows/release-tracker.yml index c53fdf2f8..24d5afa7d 100644 --- a/.github/workflows/release-tracker.yml +++ b/.github/workflows/release-tracker.yml @@ -11,7 +11,7 @@ concurrency: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/update-crds.yaml b/.github/workflows/update-crds.yaml index db98d3e41..464cf2e44 100644 --- a/.github/workflows/update-crds.yaml +++ b/.github/workflows/update-crds.yaml @@ -8,7 +8,7 @@ on: jobs: build: name: Build - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Set up Go 1.21 uses: actions/setup-go@v1 diff --git a/Makefile b/Makefile index 5c8ba96ef..8847862aa 100644 --- a/Makefile +++ b/Makefile @@ -138,6 +138,7 @@ version: .PHONY: clientset clientset: @docker run --rm \ + -u $$(id -u):$$(id -g) \ -v /tmp:/.cache \ -v $$(pwd):$(DOCKER_REPO_ROOT) \ -w $(DOCKER_REPO_ROOT) \ diff --git a/apis/kubevault/v1alpha1/conversion_test.go b/apis/kubevault/v1alpha1/conversion_test.go index 041f879ab..ae5be9182 100644 --- a/apis/kubevault/v1alpha1/conversion_test.go +++ b/apis/kubevault/v1alpha1/conversion_test.go @@ -1087,7 +1087,7 @@ func TestConvert_v1alpha1_RaftSpec_To_v1alpha2_RaftSpec(t *testing.T) { Storage: &v1.PersistentVolumeClaimSpec{ AccessModes: nil, Selector: nil, - Resources: v1.ResourceRequirements{}, + Resources: v1.VolumeResourceRequirements{}, VolumeName: "", StorageClassName: nil, VolumeMode: nil, diff --git a/go.mod b/go.mod index 4ff0ef768..714f708df 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( k8s.io/klog/v2 v2.110.1 k8s.io/kube-openapi v0.0.0-20231129212854-f0671cc7e66a kmodules.xyz/client-go v0.29.4 - kmodules.xyz/crd-schema-fuzz v0.29.0 + kmodules.xyz/crd-schema-fuzz v0.29.1 kmodules.xyz/custom-resources v0.29.0 kmodules.xyz/monitoring-agent-api v0.29.0 kmodules.xyz/offshoot-api v0.29.0 diff --git a/go.sum b/go.sum index f55cf3b47..75398f6af 100644 --- a/go.sum +++ b/go.sum @@ -373,8 +373,8 @@ kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk= kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80= kmodules.xyz/client-go v0.29.4 h1:WW4vlYtzLc9JXrJjcFuJO4DX/kIZ5ia7QtDyhNDUwfI= kmodules.xyz/client-go v0.29.4/go.mod h1:xWlS/1zWkx1sIKCAkzULy9570mHZYi2exDECEoP1ek4= -kmodules.xyz/crd-schema-fuzz v0.29.0 h1:s6ATG46aWyP+SoBQU00/kL/7AS2AEWwkSPwVjU512vM= -kmodules.xyz/crd-schema-fuzz v0.29.0/go.mod h1:n708z9YQqLMP2KNLQVgBcRJw1QpSWLvpNCEi+KJDOYE= +kmodules.xyz/crd-schema-fuzz v0.29.1 h1:zJTlWYOrT5dsVVHW8HGcnR/vaWfxQfNh11QwTtkYpcs= +kmodules.xyz/crd-schema-fuzz v0.29.1/go.mod h1:n708z9YQqLMP2KNLQVgBcRJw1QpSWLvpNCEi+KJDOYE= kmodules.xyz/custom-resources v0.29.0 h1:RaDM2+wSVXiwIvLqmkTVYpwoH83AC8wruXe2p2rOZNY= kmodules.xyz/custom-resources v0.29.0/go.mod h1:MzZyXtxdg1PDxGk3RTTO1Xv3KiVqZnIonSwmxVbagOY= kmodules.xyz/monitoring-agent-api v0.29.0 h1:gpFl6OZrlMLb/ySMHdREI9EwGtnJ91oZBn9H1UFRwB4= diff --git a/vendor/kmodules.xyz/crd-schema-fuzz/fuzz.go b/vendor/kmodules.xyz/crd-schema-fuzz/fuzz.go index 2d1e262c9..23d2a4b72 100644 --- a/vendor/kmodules.xyz/crd-schema-fuzz/fuzz.go +++ b/vendor/kmodules.xyz/crd-schema-fuzz/fuzz.go @@ -3,6 +3,7 @@ package crdfuzz import ( "math/rand" "os" + "strings" "testing" "github.com/google/go-cmp/cmp" @@ -57,7 +58,14 @@ func SchemaFuzzTestForObject(t *testing.T, scheme *runtime.Scheme, obj runtime.O t.Fatalf("Failed to convert type to `runtime.Unstructured`: %v", err) return } - structuralpruning.Prune(pruned, schema, true) + unknownFieldPaths := structuralpruning.PruneWithOptions(obj, schema, true, structuralschema.UnknownFieldPathOptions{ + TrackUnknownFieldPaths: true, + ParentPath: nil, + UnknownFieldPaths: nil, + }) + if len(unknownFieldPaths) > 0 { + t.Fatalf("unknownFieldPaths: %s", strings.Join(unknownFieldPaths, ",")) + } if !cmp.Equal(unstructuredFuzzed, pruned, cmp.Transformer("ObjectMeta", func(m map[string]interface{}) map[string]interface{} { if m["creationTimestamp"] == nil { delete(m, "creationTimestamp") diff --git a/vendor/modules.txt b/vendor/modules.txt index 756a3a3b6..69eecf7da 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1140,7 +1140,7 @@ kmodules.xyz/client-go/meta kmodules.xyz/client-go/openapi kmodules.xyz/client-go/policy/secomp kmodules.xyz/client-go/tools/clusterid -# kmodules.xyz/crd-schema-fuzz v0.29.0 +# kmodules.xyz/crd-schema-fuzz v0.29.1 ## explicit; go 1.21.5 kmodules.xyz/crd-schema-fuzz # kmodules.xyz/custom-resources v0.29.0