diff --git a/go.mod b/go.mod index a6d81fac6..7ab6e3e5b 100644 --- a/go.mod +++ b/go.mod @@ -23,6 +23,7 @@ require ( google.golang.org/grpc v1.58.3 google.golang.org/protobuf v1.33.0 k8s.io/api v0.29.0 + k8s.io/apiextensions-apiserver v0.29.0 k8s.io/apimachinery v0.29.1 k8s.io/client-go v0.29.0 k8s.io/klog/v2 v2.110.1 @@ -103,7 +104,6 @@ require ( gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect - k8s.io/apiextensions-apiserver v0.29.0 // indirect k8s.io/component-base v0.29.0 // indirect k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect diff --git a/vendor/github.com/openshift/dpu-operator/api/v1/dpuoperatorconfig_types.go b/vendor/github.com/openshift/dpu-operator/api/v1/dpuoperatorconfig_types.go index 1835377fa..da55d1eed 100644 --- a/vendor/github.com/openshift/dpu-operator/api/v1/dpuoperatorconfig_types.go +++ b/vendor/github.com/openshift/dpu-operator/api/v1/dpuoperatorconfig_types.go @@ -41,6 +41,7 @@ type DpuOperatorConfigStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status +//+kubebuilder:resource:scope=Cluster // DpuOperatorConfig is the Schema for the dpuoperatorconfigs API type DpuOperatorConfig struct { diff --git a/vendor/github.com/openshift/dpu-operator/api/v1/zz_generated.deepcopy.go b/vendor/github.com/openshift/dpu-operator/api/v1/zz_generated.deepcopy.go index 9ebe084eb..1bdd7bb1c 100644 --- a/vendor/github.com/openshift/dpu-operator/api/v1/zz_generated.deepcopy.go +++ b/vendor/github.com/openshift/dpu-operator/api/v1/zz_generated.deepcopy.go @@ -113,12 +113,27 @@ func (in *DpuOperatorConfigStatus) DeepCopy() *DpuOperatorConfigStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkFunction) DeepCopyInto(out *NetworkFunction) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkFunction. +func (in *NetworkFunction) DeepCopy() *NetworkFunction { + if in == nil { + return nil + } + out := new(NetworkFunction) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ServiceFunctionChain) DeepCopyInto(out *ServiceFunctionChain) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec + in.Spec.DeepCopyInto(&out.Spec) out.Status = in.Status } @@ -164,17 +179,14 @@ func (in *ServiceFunctionChainList) DeepCopy() *ServiceFunctionChainList { return out } -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ServiceFunctionChainList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ServiceFunctionChainSpec) DeepCopyInto(out *ServiceFunctionChainSpec) { *out = *in + if in.NetworkFunctions != nil { + in, out := &in.NetworkFunctions, &out.NetworkFunctions + *out = make([]NetworkFunction, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceFunctionChainSpec. diff --git a/vendor/k8s.io/client-go/util/testing/fake_handler.go b/vendor/k8s.io/client-go/util/testing/fake_handler.go deleted file mode 100644 index 712a64643..000000000 --- a/vendor/k8s.io/client-go/util/testing/fake_handler.go +++ /dev/null @@ -1,139 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package testing - -import ( - "io" - "net/http" - "net/url" - "reflect" - "sync" -) - -// TestInterface is a simple interface providing Errorf, to make injection for -// testing easier (insert 'yo dawg' meme here). -type TestInterface interface { - Errorf(format string, args ...interface{}) - Logf(format string, args ...interface{}) -} - -// LogInterface is a simple interface to allow injection of Logf to report serving errors. -type LogInterface interface { - Logf(format string, args ...interface{}) -} - -// FakeHandler is to assist in testing HTTP requests. Notice that FakeHandler is -// not thread safe and you must not direct traffic to except for the request -// you want to test. You can do this by hiding it in an http.ServeMux. -type FakeHandler struct { - RequestReceived *http.Request - RequestBody string - StatusCode int - ResponseBody string - // For logging - you can use a *testing.T - // This will keep log messages associated with the test. - T LogInterface - - // Enforce "only one use" constraint. - lock sync.Mutex - requestCount int - hasBeenChecked bool - - SkipRequestFn func(verb string, url url.URL) bool -} - -func (f *FakeHandler) SetResponseBody(responseBody string) { - f.lock.Lock() - defer f.lock.Unlock() - f.ResponseBody = responseBody -} - -func (f *FakeHandler) ServeHTTP(response http.ResponseWriter, request *http.Request) { - f.lock.Lock() - defer f.lock.Unlock() - - if f.SkipRequestFn != nil && f.SkipRequestFn(request.Method, *request.URL) { - response.Header().Set("Content-Type", "application/json") - response.WriteHeader(f.StatusCode) - response.Write([]byte(f.ResponseBody)) - return - } - - f.requestCount++ - if f.hasBeenChecked { - panic("got request after having been validated") - } - - f.RequestReceived = request - response.Header().Set("Content-Type", "application/json") - response.WriteHeader(f.StatusCode) - response.Write([]byte(f.ResponseBody)) - - bodyReceived, err := io.ReadAll(request.Body) - if err != nil && f.T != nil { - f.T.Logf("Received read error: %v", err) - } - f.RequestBody = string(bodyReceived) - if f.T != nil { - f.T.Logf("request body: %s", f.RequestBody) - } -} - -func (f *FakeHandler) ValidateRequestCount(t TestInterface, count int) bool { - ok := true - f.lock.Lock() - defer f.lock.Unlock() - if f.requestCount != count { - ok = false - t.Errorf("Expected %d call, but got %d. Only the last call is recorded and checked.", count, f.requestCount) - } - f.hasBeenChecked = true - return ok -} - -// ValidateRequest verifies that FakeHandler received a request with expected path, method, and body. -func (f *FakeHandler) ValidateRequest(t TestInterface, expectedPath, expectedMethod string, body *string) { - f.lock.Lock() - defer f.lock.Unlock() - if f.requestCount != 1 { - t.Logf("Expected 1 call, but got %v. Only the last call is recorded and checked.", f.requestCount) - } - f.hasBeenChecked = true - - expectURL, err := url.Parse(expectedPath) - if err != nil { - t.Errorf("Couldn't parse %v as a URL.", expectedPath) - } - if f.RequestReceived == nil { - t.Errorf("Unexpected nil request received for %s", expectedPath) - return - } - if f.RequestReceived.URL.Path != expectURL.Path { - t.Errorf("Unexpected request path for request %#v, received: %q, expected: %q", f.RequestReceived, f.RequestReceived.URL.Path, expectURL.Path) - } - if e, a := expectURL.Query(), f.RequestReceived.URL.Query(); !reflect.DeepEqual(e, a) { - t.Errorf("Unexpected query for request %#v, received: %q, expected: %q", f.RequestReceived, a, e) - } - if f.RequestReceived.Method != expectedMethod { - t.Errorf("Unexpected method: %q, expected: %q", f.RequestReceived.Method, expectedMethod) - } - if body != nil { - if *body != f.RequestBody { - t.Errorf("Received body:\n%s\n Doesn't match expected body:\n%s", f.RequestBody, *body) - } - } -} diff --git a/vendor/k8s.io/client-go/util/testing/fake_openapi_handler.go b/vendor/k8s.io/client-go/util/testing/fake_openapi_handler.go deleted file mode 100644 index a7b0d590b..000000000 --- a/vendor/k8s.io/client-go/util/testing/fake_openapi_handler.go +++ /dev/null @@ -1,167 +0,0 @@ -/* -Copyright 2021 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package testing - -import ( - "encoding/json" - "io" - "io/fs" - "net/http" - "net/http/httptest" - "os" - "path/filepath" - "strings" - "sync" - - "k8s.io/kube-openapi/pkg/handler3" - "k8s.io/kube-openapi/pkg/spec3" -) - -type FakeOpenAPIServer struct { - HttpServer *httptest.Server - ServedDocuments map[string]*spec3.OpenAPI - RequestCounters map[string]int -} - -// Creates a mock OpenAPIV3 server as it would be on a standing kubernetes -// API server. -// -// specsPath - Give a path to some test data organized so that each GroupVersion -// has its own OpenAPI V3 JSON file. -// -// i.e. apps/v1beta1 is stored in /apps/v1beta1.json -func NewFakeOpenAPIV3Server(specsPath string) (*FakeOpenAPIServer, error) { - mux := &testMux{ - counts: map[string]int{}, - } - server := httptest.NewServer(mux) - - openAPIVersionedService := handler3.NewOpenAPIService() - err := openAPIVersionedService.RegisterOpenAPIV3VersionedService("/openapi/v3", mux) - if err != nil { - return nil, err - } - - grouped := make(map[string][]byte) - var testV3Specs = make(map[string]*spec3.OpenAPI) - - addSpec := func(path string) { - file, err := os.Open(path) - if err != nil { - panic(err) - } - - defer file.Close() - vals, err := io.ReadAll(file) - if err != nil { - panic(err) - } - - rel, err := filepath.Rel(specsPath, path) - if err == nil { - grouped[rel[:(len(rel)-len(filepath.Ext(rel)))]] = vals - } - } - - filepath.WalkDir(specsPath, func(path string, d fs.DirEntry, err error) error { - if filepath.Ext(path) != ".json" || d.IsDir() { - return nil - } - - addSpec(path) - return nil - }) - - for gv, jsonSpec := range grouped { - spec := &spec3.OpenAPI{} - err = json.Unmarshal(jsonSpec, spec) - if err != nil { - return nil, err - } - - testV3Specs[gv] = spec - openAPIVersionedService.UpdateGroupVersion(gv, spec) - } - - return &FakeOpenAPIServer{ - HttpServer: server, - ServedDocuments: testV3Specs, - RequestCounters: mux.counts, - }, nil -} - -//////////////////////////////////////////////////////////////////////////////// -// Tiny Test HTTP Mux -//////////////////////////////////////////////////////////////////////////////// -// Implements the mux interface used by handler3 for registering the OpenAPI -// handlers - -type testMux struct { - lock sync.Mutex - prefixMap map[string]http.Handler - pathMap map[string]http.Handler - counts map[string]int -} - -func (t *testMux) Handle(path string, handler http.Handler) { - t.lock.Lock() - defer t.lock.Unlock() - - if t.pathMap == nil { - t.pathMap = make(map[string]http.Handler) - } - t.pathMap[path] = handler -} - -func (t *testMux) HandlePrefix(path string, handler http.Handler) { - t.lock.Lock() - defer t.lock.Unlock() - - if t.prefixMap == nil { - t.prefixMap = make(map[string]http.Handler) - } - t.prefixMap[path] = handler -} - -func (t *testMux) ServeHTTP(w http.ResponseWriter, req *http.Request) { - t.lock.Lock() - defer t.lock.Unlock() - - if t.counts == nil { - t.counts = make(map[string]int) - } - - if val, exists := t.counts[req.URL.Path]; exists { - t.counts[req.URL.Path] = val + 1 - } else { - t.counts[req.URL.Path] = 1 - } - - if handler, ok := t.pathMap[req.URL.Path]; ok { - handler.ServeHTTP(w, req) - return - } - - for k, v := range t.prefixMap { - if strings.HasPrefix(req.URL.Path, k) { - v.ServeHTTP(w, req) - return - } - } - - w.WriteHeader(http.StatusNotFound) -} diff --git a/vendor/k8s.io/client-go/util/testing/remove_file.go b/vendor/k8s.io/client-go/util/testing/remove_file.go deleted file mode 100644 index 976b9afaf..000000000 --- a/vendor/k8s.io/client-go/util/testing/remove_file.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2023 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package testing - -import ( - "os" - "testing" -) - -// CloseAndRemove is a helper to close and remove test file. -func CloseAndRemove(t *testing.T, files ...*os.File) { - t.Helper() - // We should close it first before remove a file, it's not only a good practice, - // but also can avoid failed file removing on Windows OS. - for _, f := range files { - if f == nil { - continue - } - if err := f.Close(); err != nil { - t.Fatalf("Error closing %s: %v", f.Name(), err) - } - if err := os.Remove(f.Name()); err != nil { - t.Fatalf("Error removing %s: %v", f.Name(), err) - } - } -} diff --git a/vendor/k8s.io/client-go/util/testing/tmpdir.go b/vendor/k8s.io/client-go/util/testing/tmpdir.go deleted file mode 100644 index 73c1edb80..000000000 --- a/vendor/k8s.io/client-go/util/testing/tmpdir.go +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright 2016 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package testing - -import ( - "os" -) - -// MkTmpdir creates a temporary directory based upon the prefix passed in. -// If successful, it returns the temporary directory path. The directory can be -// deleted with a call to "os.RemoveAll(...)". -// In case of error, it'll return an empty string and the error. -func MkTmpdir(prefix string) (string, error) { - tmpDir, err := os.MkdirTemp(os.TempDir(), prefix) - if err != nil { - return "", err - } - return tmpDir, nil -} - -// MkTmpdirOrDie does the same work as "MkTmpdir", except in case of -// errors, it'll trigger a panic. -func MkTmpdirOrDie(prefix string) string { - tmpDir, err := MkTmpdir(prefix) - if err != nil { - panic(err) - } - return tmpDir -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 2950f8c09..c651edc87 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -747,7 +747,6 @@ k8s.io/client-go/util/flowcontrol k8s.io/client-go/util/homedir k8s.io/client-go/util/keyutil k8s.io/client-go/util/retry -k8s.io/client-go/util/testing k8s.io/client-go/util/workqueue # k8s.io/component-base v0.29.0 ## explicit; go 1.21