From a539b7d03a9c3254d3068b2f1bd95760940dbb0e Mon Sep 17 00:00:00 2001 From: lumbrjx Date: Fri, 30 Aug 2024 22:13:15 +0100 Subject: [PATCH] Feat :sparkles: Integrate Ebpf Service --- .github/workflows/builds.yml | 13 +- Makefile | 13 ++ README.md | 6 + controller/README.md | 114 ------------------ controller/api/v1/obzev0resource_types.go | 11 +- controller/api/v1/zz_generated.deepcopy.go | 2 +- .../batch.github.com_obzev0resources.yaml | 7 +- controller/config/manager/kustomization.yaml | 2 +- .../samples/batch_v1_obzev0resource.yaml | 10 +- controller/go.mod | 1 + controller/go.sum | 2 + .../controller/obzev0resource_controller.go | 28 ++++- .../client/clientset/versioned/clientset.go | 18 --- .../pkg/client/clientset/versioned/doc.go | 19 --- .../versioned/fake/clientset_generated.go | 18 --- .../client/clientset/versioned/fake/doc.go | 19 --- .../clientset/versioned/fake/register.go | 18 --- .../client/clientset/versioned/scheme/doc.go | 19 --- .../clientset/versioned/scheme/register.go | 18 --- .../v1/batch.github.com_client.go | 18 --- .../typed/batch.github.com/v1/doc.go | 19 --- .../typed/batch.github.com/v1/fake/doc.go | 19 --- .../v1/fake/fake_batch.github.com_client.go | 18 --- .../v1/generated_expansion.go | 18 --- daemon/api/grpc/tcAnalyser/service.go | 2 +- daemon/cmd/cli/main.go | 38 +++--- daemonset.yaml | 15 ++- 27 files changed, 110 insertions(+), 375 deletions(-) delete mode 100644 controller/README.md delete mode 100644 controller/pkg/client/clientset/versioned/clientset.go delete mode 100644 controller/pkg/client/clientset/versioned/doc.go delete mode 100644 controller/pkg/client/clientset/versioned/fake/clientset_generated.go delete mode 100644 controller/pkg/client/clientset/versioned/fake/doc.go delete mode 100644 controller/pkg/client/clientset/versioned/fake/register.go delete mode 100644 controller/pkg/client/clientset/versioned/scheme/doc.go delete mode 100644 controller/pkg/client/clientset/versioned/scheme/register.go delete mode 100644 controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/batch.github.com_client.go delete mode 100644 controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/doc.go delete mode 100644 controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/fake/doc.go delete mode 100644 controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/fake/fake_batch.github.com_client.go delete mode 100644 controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/generated_expansion.go diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index e070f0b..428a526 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -23,7 +23,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Run tests - run: echo "Running tests..." # Replace with actual test command + run: echo "No tests for now..." # Replace with actual test command build-and-push-staging: needs: test @@ -41,12 +41,16 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push Daemon Docker image + - name: Build and push Daemon, Controller Docker images run: | make build-daemon TAG=${{ github.sha }} make push-daemon TAG=${{ github.sha }} docker tag ${{ env.DAEMON_IMAGE_NAME }}:${{ github.sha }} ${{ env.DAEMON_IMAGE_NAME }}:staging docker push ${{ env.DAEMON_IMAGE_NAME }}:staging + make build-controller TAG=${{ github.sha }} + make push-controller TAG=${{ github.sha }} + docker tag ${{ env.CONTROLLER_IMAGE_NAME }}:${{ github.sha }} ${{ env.CONTROLLER_IMAGE_NAME}}:staging + docker push ${{ env.CONTROLLER_IMAGE_NAME}}:staging create-release: if: github.ref == 'refs/heads/release' @@ -72,6 +76,11 @@ jobs: docker push ${{ env.DAEMON_IMAGE_NAME }}:v${{ github.run_number }} docker tag ${{ env.DAEMON_IMAGE_NAME }}:v${{ github.run_number }} ${{ env.DAEMON_IMAGE_NAME }}:latest docker push ${{ env.DAEMON_IMAGE_NAME }}:latest + docker pull ${{ env.CONTROLLER_IMAGE_NAME}}:staging + docker tag ${{ env.CONTROLLER_IMAGE_NAME}}:staging ${{ env.CONTROLLER_IMAGE_NAME}}:v${{ github.run_number }} + docker push ${{ env.CONTROLLER_IMAGE_NAME}}:v${{ github.run_number }} + docker tag ${{ env.CONTROLLER_IMAGE_NAME}}:v${{ github.run_number }} ${{ env.CONTROLLER_IMAGE_NAME}}:latest + docker push ${{ env.CONTROLLER_IMAGE_NAME}}:latest - name: Create GitHub Release uses: actions/create-release@v1 diff --git a/Makefile b/Makefile index d869e05..86dd59c 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,13 @@ build-daemon: fi docker build -f daemon/api/grpc/Dockerfile -t lumbrjx/obzev0-grpc-daemon:$$TAG . +build-controller: + @if [ -z "$$TAG" ]; then \ + echo "Usage: make build-controller TAG="; \ + exit 1; \ + fi + docker build -f controller/Dockerfile -t lumbrjx/obzev0poc:$$TAG . + push-daemon: @if [ -z "$$TAG" ]; then \ echo "Usage: make push-daemon TAG="; \ @@ -46,6 +53,12 @@ push-daemon: fi docker push lumbrjx/obzev0-grpc-daemon:$$TAG +push-controller: + @if [ -z "$$TAG" ]; then \ + echo "Usage: make push-controller TAG="; \ + exit 1; \ + fi + docker push lumbrjx/obzev0poc:$$TAG generate-proto: @if [ -z "$$PROTO_PATH" ]; then \ diff --git a/README.md b/README.md index 04415bc..d8c129a 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,9 @@ Obzev0 is built using a microservices architecture, with the following component - **Controller:** Responsible for watching Custom Resource Definitions (CRDs) representing chaos scenarios and dispatching work to the DaemonSet. - **DaemonSet:** Runs on every node in the Kubernetes cluster and acts as a gRPC server. It executes the chaos scenarios and communicates with the eBPF program in the kernel space. - **eBPF Program:** Written in C, it runs in the kernel space and is responsible for monitoring and manipulating network traffic for performance monitoring. + +## ToDo + +[ ] complete Update/Delete informer functions +[ ] integrate tcAnalyser service in k8s controller grpc calls + diff --git a/controller/README.md b/controller/README.md deleted file mode 100644 index eaf0a19..0000000 --- a/controller/README.md +++ /dev/null @@ -1,114 +0,0 @@ -# controller -// TODO(user): Add simple overview of use/purpose - -## Description -// TODO(user): An in-depth paragraph about your project and overview of use - -## Getting Started - -### Prerequisites -- go version v1.22.0+ -- docker version 17.03+. -- kubectl version v1.11.3+. -- Access to a Kubernetes v1.11.3+ cluster. - -### To Deploy on the cluster -**Build and push your image to the location specified by `IMG`:** - -```sh -make docker-build docker-push IMG=/controller:tag -``` - -**NOTE:** This image ought to be published in the personal registry you specified. -And it is required to have access to pull the image from the working environment. -Make sure you have the proper permission to the registry if the above commands don’t work. - -**Install the CRDs into the cluster:** - -```sh -make install -``` - -**Deploy the Manager to the cluster with the image specified by `IMG`:** - -```sh -make deploy IMG=/controller:tag -``` - -> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin -privileges or be logged in as admin. - -**Create instances of your solution** -You can apply the samples (examples) from the config/sample: - -```sh -kubectl apply -k config/samples/ -``` - ->**NOTE**: Ensure that the samples has default values to test it out. - -### To Uninstall -**Delete the instances (CRs) from the cluster:** - -```sh -kubectl delete -k config/samples/ -``` - -**Delete the APIs(CRDs) from the cluster:** - -```sh -make uninstall -``` - -**UnDeploy the controller from the cluster:** - -```sh -make undeploy -``` - -## Project Distribution - -Following are the steps to build the installer and distribute this project to users. - -1. Build the installer for the image built and published in the registry: - -```sh -make build-installer IMG=/controller:tag -``` - -NOTE: The makefile target mentioned above generates an 'install.yaml' -file in the dist directory. This file contains all the resources built -with Kustomize, which are necessary to install this project without -its dependencies. - -2. Using the installer - -Users can just run kubectl apply -f to install the project, i.e.: - -```sh -kubectl apply -f https://raw.githubusercontent.com//controller//dist/install.yaml -``` - -## Contributing -// TODO(user): Add detailed information on how you would like others to contribute to this project - -**NOTE:** Run `make help` for more information on all potential `make` targets - -More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html) - -## License - -Copyright 2024. - -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. - diff --git a/controller/api/v1/obzev0resource_types.go b/controller/api/v1/obzev0resource_types.go index 15ad534..9caa4e8 100644 --- a/controller/api/v1/obzev0resource_types.go +++ b/controller/api/v1/obzev0resource_types.go @@ -36,13 +36,18 @@ type TcpConfig struct { Client string `json:"client,omitempty"` } +type TcAnalyserConfig struct { + NetIFace string `json:"netIFace,omitempty"` +} + // Obzev0ResourceSpec defines the desired state of Obzev0Resource type Obzev0ResourceSpec struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // Important: Run "make" to regenerate code after modifying this file // Foo is an example field of Obzev0Resource. Edit obzev0resource_types.go to remove/update - Config TcpConfig `json:"config,omitempty"` + LatencyServiceConfig TcpConfig `json:"latencySvcConfig,omitempty"` + TcAnalyserServiceConfig TcAnalyserConfig `json:"tcAnalyserSvcConfig,omitempty"` } // Obzev0ResourceStatus defines the observed state of Obzev0Resource @@ -68,8 +73,8 @@ type Obzev0Resource struct { // Obzev0ResourceList contains a list of Obzev0Resource type Obzev0ResourceList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` + metav1.TypeMeta ` json:",inline"` + metav1.ListMeta ` json:"metadata,omitempty"` Items []Obzev0Resource `json:"items"` } diff --git a/controller/api/v1/zz_generated.deepcopy.go b/controller/api/v1/zz_generated.deepcopy.go index b9de90e..dcab3d3 100644 --- a/controller/api/v1/zz_generated.deepcopy.go +++ b/controller/api/v1/zz_generated.deepcopy.go @@ -86,7 +86,7 @@ func (in *Obzev0ResourceList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Obzev0ResourceSpec) DeepCopyInto(out *Obzev0ResourceSpec) { *out = *in - out.Config = in.Config + out.LatencyServiceConfig = in.LatencyServiceConfig } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Obzev0ResourceSpec. diff --git a/controller/config/crd/bases/batch.github.com_obzev0resources.yaml b/controller/config/crd/bases/batch.github.com_obzev0resources.yaml index 6885694..6286203 100644 --- a/controller/config/crd/bases/batch.github.com_obzev0resources.yaml +++ b/controller/config/crd/bases/batch.github.com_obzev0resources.yaml @@ -39,7 +39,7 @@ spec: spec: description: Obzev0ResourceSpec defines the desired state of Obzev0Resource properties: - config: + latencySvcConfig: description: Foo is an example field of Obzev0Resource. Edit obzev0resource_types.go to remove/update properties: @@ -58,6 +58,11 @@ spec: description: TCP server address type: string type: object + tcAnalyserSvcConfig: + properties: + netIFace: + type: string + type: object type: object status: description: Obzev0ResourceStatus defines the observed state of Obzev0Resource diff --git a/controller/config/manager/kustomization.yaml b/controller/config/manager/kustomization.yaml index 633dcb7..5d52359 100644 --- a/controller/config/manager/kustomization.yaml +++ b/controller/config/manager/kustomization.yaml @@ -5,4 +5,4 @@ kind: Kustomization images: - name: controller newName: lumbrjx/obzev0poc - newTag: 1.0.4 + newTag: 1.0.5-alpha diff --git a/controller/config/samples/batch_v1_obzev0resource.yaml b/controller/config/samples/batch_v1_obzev0resource.yaml index bf97a80..58fc077 100644 --- a/controller/config/samples/batch_v1_obzev0resource.yaml +++ b/controller/config/samples/batch_v1_obzev0resource.yaml @@ -6,11 +6,15 @@ metadata: app.kubernetes.io/managed-by: kustomize name: obzev0resource-sample spec: - config: - reqDelay: 10 - resDelay: 20 + latencySvcConfig: + reqDelay: 0 + resDelay: 0 server: "7090" client: "8080" + tcAnalyserSvcConfig: + netIFace: "eth0" + + status: message: "Server started successfully" diff --git a/controller/go.mod b/controller/go.mod index 6b7a783..97bd97e 100644 --- a/controller/go.mod +++ b/controller/go.mod @@ -16,6 +16,7 @@ require ( require ( github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect + github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect k8s.io/apiserver v0.30.2 // indirect ) diff --git a/controller/go.sum b/controller/go.sum index 1748cd8..7942446 100644 --- a/controller/go.sum +++ b/controller/go.sum @@ -13,6 +13,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU= github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= +github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= diff --git a/controller/internal/controller/obzev0resource_controller.go b/controller/internal/controller/obzev0resource_controller.go index cd9c283..7cc209d 100644 --- a/controller/internal/controller/obzev0resource_controller.go +++ b/controller/internal/controller/obzev0resource_controller.go @@ -9,6 +9,7 @@ import ( "obzev0/common/proto/latency" pb "obzev0/common/proto/latency" + tca "obzev0/common/proto/tcAnalyser" v1 "obzev0/controller/api/v1" @@ -148,27 +149,42 @@ func handleAdd(obj interface{}, conn *grpc.ClientConn) { name := obz.GetName() namespace := obz.GetNamespace() - config := obz.Spec.Config + latencyConfig := obz.Spec.LatencyServiceConfig + tcAConfig := obz.Spec.TcAnalyserServiceConfig klog.Infof("Custom Resource added: %s/%s", namespace, name) - klog.Infof("TCP Server Configuration: %+v", config) + klog.Infof("TCP Server Configuration: %+v", latencyConfig) client := pb.NewLatencyServiceClient(conn) ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) defer cancel() response, err := client.StartTcpServer( ctx, &pb.RequestForTcp{Config: &latency.TcpConfig{ - ReqDelay: config.ReqDelay, - ResDelay: config.ResDelay, - Server: config.Server, - Client: config.Client, + ReqDelay: latencyConfig.ReqDelay, + ResDelay: latencyConfig.ResDelay, + Server: latencyConfig.Server, + Client: latencyConfig.Client, }}, ) + if err != nil { log.Printf("Error calling gRPC method: %v\n", err) } else { fmt.Printf("Response from gRPC server: %s\n", response.Message) } + client2 := tca.NewTcAnalyserServiceClient(conn) + rsp, err := client2.StartUserSpace( + ctx, + &tca.RequestForUserSpace{Config: &tca.TcConfig{ + Interface: tcAConfig.NetIFace, + }}, + ) + + if err != nil { + log.Printf("Error calling gRPC method: %v\n", err) + } else { + fmt.Printf("Response from gRPC server: %s\n", rsp.Message) + } defer conn.Close() } diff --git a/controller/pkg/client/clientset/versioned/clientset.go b/controller/pkg/client/clientset/versioned/clientset.go deleted file mode 100644 index b84dbb0..0000000 --- a/controller/pkg/client/clientset/versioned/clientset.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2024. - -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. -*/ -// Code generated by client-gen. DO NOT EDIT. - -package versioned diff --git a/controller/pkg/client/clientset/versioned/doc.go b/controller/pkg/client/clientset/versioned/doc.go deleted file mode 100644 index 980ac30..0000000 --- a/controller/pkg/client/clientset/versioned/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024. - -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. -*/ -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned diff --git a/controller/pkg/client/clientset/versioned/fake/clientset_generated.go b/controller/pkg/client/clientset/versioned/fake/clientset_generated.go deleted file mode 100644 index cce90c0..0000000 --- a/controller/pkg/client/clientset/versioned/fake/clientset_generated.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2024. - -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. -*/ -// Code generated by client-gen. DO NOT EDIT. - -package fake diff --git a/controller/pkg/client/clientset/versioned/fake/doc.go b/controller/pkg/client/clientset/versioned/fake/doc.go deleted file mode 100644 index 57c8c1b..0000000 --- a/controller/pkg/client/clientset/versioned/fake/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024. - -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. -*/ -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated fake clientset. -package fake diff --git a/controller/pkg/client/clientset/versioned/fake/register.go b/controller/pkg/client/clientset/versioned/fake/register.go deleted file mode 100644 index cce90c0..0000000 --- a/controller/pkg/client/clientset/versioned/fake/register.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2024. - -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. -*/ -// Code generated by client-gen. DO NOT EDIT. - -package fake diff --git a/controller/pkg/client/clientset/versioned/scheme/doc.go b/controller/pkg/client/clientset/versioned/scheme/doc.go deleted file mode 100644 index b00a2a6..0000000 --- a/controller/pkg/client/clientset/versioned/scheme/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024. - -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. -*/ -// Code generated by client-gen. DO NOT EDIT. - -// This package contains the scheme of the automatically generated clientset. -package scheme diff --git a/controller/pkg/client/clientset/versioned/scheme/register.go b/controller/pkg/client/clientset/versioned/scheme/register.go deleted file mode 100644 index 942fefc..0000000 --- a/controller/pkg/client/clientset/versioned/scheme/register.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2024. - -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. -*/ -// Code generated by client-gen. DO NOT EDIT. - -package scheme diff --git a/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/batch.github.com_client.go b/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/batch.github.com_client.go deleted file mode 100644 index ec7f672..0000000 --- a/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/batch.github.com_client.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2024. - -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. -*/ -// Code generated by client-gen. DO NOT EDIT. - -package v1 diff --git a/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/doc.go b/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/doc.go deleted file mode 100644 index 035a225..0000000 --- a/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024. - -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. -*/ -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated typed clients. -package v1 diff --git a/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/fake/doc.go b/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/fake/doc.go deleted file mode 100644 index 3514f7d..0000000 --- a/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/fake/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* -Copyright 2024. - -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. -*/ -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/fake/fake_batch.github.com_client.go b/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/fake/fake_batch.github.com_client.go deleted file mode 100644 index cce90c0..0000000 --- a/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/fake/fake_batch.github.com_client.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2024. - -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. -*/ -// Code generated by client-gen. DO NOT EDIT. - -package fake diff --git a/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/generated_expansion.go b/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/generated_expansion.go deleted file mode 100644 index ec7f672..0000000 --- a/controller/pkg/client/clientset/versioned/typed/batch.github.com/v1/generated_expansion.go +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright 2024. - -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. -*/ -// Code generated by client-gen. DO NOT EDIT. - -package v1 diff --git a/daemon/api/grpc/tcAnalyser/service.go b/daemon/api/grpc/tcAnalyser/service.go index 2bfcf33..adfd0f1 100644 --- a/daemon/api/grpc/tcAnalyser/service.go +++ b/daemon/api/grpc/tcAnalyser/service.go @@ -17,7 +17,7 @@ type TcAnalyserService struct { // metricsChan chan MetricsData } -func (s *TcAnalyserService) StartTcpServer( +func (s *TcAnalyserService) StartUserSpace( ctx context.Context, requestUserSpace *tcAnalyser.RequestForUserSpace, ) (*tcAnalyser.ResponseFromUserSpace, error) { diff --git a/daemon/cmd/cli/main.go b/daemon/cmd/cli/main.go index eb942e5..1d5d1cc 100644 --- a/daemon/cmd/cli/main.go +++ b/daemon/cmd/cli/main.go @@ -5,7 +5,7 @@ import ( "fmt" "log" "obzev0/common/definitions" - "obzev0/common/proto/latency" + "obzev0/common/proto/tcAnalyser" "os" "time" @@ -38,27 +38,31 @@ func main() { log.Fatalf("did not connect: %v", err) } defer conn.Close() - c := latency.NewLatencyServiceClient(conn) + // c := latency.NewLatencyServiceClient(conn) + t := tcAnalyser.NewTcAnalyserServiceClient(conn) - cnf, err := LoadConfig("obzevConf.yaml") - config := &latency.TcpConfig{ - ReqDelay: cnf.Delays.ReqDelay, - ResDelay: cnf.Delays.ResDelay, - Server: cnf.Server.Port, - Client: cnf.Client.Port, - } - println( - config.Client, - config.Server, - config.ResDelay, - config.ReqDelay, - ) + // cnf, err := LoadConfig("obzevConf.yaml") + // config := &latency.TcpConfig{ + // ReqDelay: cnf.Delays.ReqDelay, + // ResDelay: cnf.Delays.ResDelay, + // Server: cnf.Server.Port, + // Client: cnf.Client.Port, + // } + // println( + // config.Client, + // config.Server, + // config.ResDelay, + // config.ReqDelay, + // ) - req := &latency.RequestForTcp{Config: config} + req2 := &tcAnalyser.RequestForUserSpace{ + Config: &tcAnalyser.TcConfig{Interface: "eth0"}, + } + // req := &latency.RequestForTcp{Config: &la} ctx, cancel := context.WithTimeout(context.Background(), time.Second) defer cancel() - res, err := c.StartTcpServer(ctx, req) + res, err := t.StartUserSpace(ctx, req2) if err != nil { log.Fatalf("could not greet: %v", err) } diff --git a/daemonset.yaml b/daemonset.yaml index 72e8630..b7c8ece 100644 --- a/daemonset.yaml +++ b/daemonset.yaml @@ -13,7 +13,7 @@ spec: spec: containers: - name: grpc-server - image: lumbrjx/obzev0-grpc-daemon:1.0.8-alpha + image: lumbrjx/obzev0-grpc-daemon:1.0.8-pre ports: - containerPort: 50051 livenessProbe: @@ -33,6 +33,14 @@ spec: requests: cpu: 250m memory: 64Mi + securityContext: + capabilities: + add: ["SYS_RESOURCE", "SYS_ADMIN"] + runAsUser: 0 + runAsGroup: 0 + privileged: true + allowPrivilegeEscalation: true + readOnlyRootFilesystem: false nodeSelector: node-role.kubernetes.io/worker: "" tolerations: @@ -57,7 +65,4 @@ spec: - key: "node.kubernetes.io/unschedulable" operator: "Exists" effect: "NoSchedule" -# kubectl label node kind-worker node-role.kubernetes.io/worker= -# kubectl label node kind-worker2 node-role.kubernetes.io/worker= -# kubectl label node kind-worker3 node-role.kubernetes.io/worker= -# +