From a11e1079cce0573c6b7ca3d24318e0c879ed06e0 Mon Sep 17 00:00:00 2001 From: Dom Del Nano Date: Wed, 5 Oct 2022 14:51:33 -0700 Subject: [PATCH] Add finagle demo to pixie cli Summary: Adds a finagle demo to the pixie cli. I thought this would be a good addition especially with the eBPF talk later this month. As part of Twitter's hackathon week, we created sedarG/finagle-helloworld to demonstrate Pixie's mux protocol tracing. I've modified that repo to match the same setup as the pixie-labs/microservice-kafka repo (using kompose, kustomize, etc). Test Plan: docker-compose example works locally Verify that the client and server work on minikube Reviewers: vihang Reviewed By: vihang Signed-off-by: Dom Del Nano Differential Revision: https://phab.corp.pixielabs.ai/D12353 GitOrigin-RevId: ea4582bf4bf7b63f054967f9f3afbd041b35abf7 --- demos/BUILD.bazel | 8 ++++ demos/README.md | 17 ++++++- demos/finagle/LICENSE | 27 +++++++++++ demos/finagle/finagle.yaml | 95 ++++++++++++++++++++++++++++++++++++++ demos/manifest.json | 8 ++++ 5 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 demos/finagle/LICENSE create mode 100644 demos/finagle/finagle.yaml diff --git a/demos/BUILD.bazel b/demos/BUILD.bazel index 14e3d03f604..d8d05840715 100644 --- a/demos/BUILD.bazel +++ b/demos/BUILD.bazel @@ -17,6 +17,13 @@ load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") load("@px//demos:demo_upload.bzl", "demo_upload") +pkg_tar( + name = "px-finagle", + srcs = glob(["finagle/*"]), + extension = "tar.gz", + strip_prefix = "finagle", +) + pkg_tar( name = "px-kafka", srcs = glob(["kafka/*"]), @@ -39,6 +46,7 @@ pkg_tar( ) ARCHIVES = [ + ":px-finagle", ":px-kafka", ":px-sock-shop", ":px-online-boutique", diff --git a/demos/README.md b/demos/README.md index 5d5acd357e8..de90d962c9a 100644 --- a/demos/README.md +++ b/demos/README.md @@ -31,7 +31,7 @@ bazel run //demos:upload_prod_demo 1. Clone `https://github.com/pixie-io/microservice-kafka` and switch to the `pixie` branch. -2. (optional) Build the container images & update the individual yaml files. +2. (optional) Build the container image & update the individual yaml files. 3. Build a single yaml file for the demo: @@ -41,6 +41,21 @@ kustomize build . > kafka.yaml 4. Copy the yaml file to `pixie/demos/kafka`. +## Updating the `px-finagle` demo + +1. Clone `https://github.com/pixie-io/finagle-helloworld` + +2. (optional) Build the container images & update the individual yaml files. + +3. Build a single yaml file for the demo: + +``` +kustomize . > finagle.yaml +``` + +4. Copy the yaml file to `pixie/demos/finagle`. + + ## Updating the `px-online-boutique` demo Our custom `adservice` image includes the `-XX:+PreserveFramePointer` Java option. To build our custom `adservice` image: diff --git a/demos/finagle/LICENSE b/demos/finagle/LICENSE new file mode 100644 index 00000000000..eb6604cefec --- /dev/null +++ b/demos/finagle/LICENSE @@ -0,0 +1,27 @@ +This code is originally from: https://github.com/SedarG/finagle-helloworld. +Copyright is held by original copyright owners. + +Original License Noted Below. +---------------------------------------------------------------------------------------- + +MIT License + +Copyright (c) 2022 Sedar Gokbulut + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/demos/finagle/finagle.yaml b/demos/finagle/finagle.yaml new file mode 100644 index 00000000000..e0235d3d853 --- /dev/null +++ b/demos/finagle/finagle.yaml @@ -0,0 +1,95 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: px-finagle +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + kompose.cmd: kompose convert -f ../docker/docker-compose.yml + kompose.version: 1.26.1 (a9d05d509) + creationTimestamp: null + labels: + io.kompose.service: finagle-server + name: finagle-server + namespace: px-finagle +spec: + ports: + - name: "9992" + port: 9992 + targetPort: 9992 + selector: + io.kompose.service: finagle-server +status: + loadBalancer: {} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose convert -f ../docker/docker-compose.yml + kompose.version: 1.26.1 (a9d05d509) + creationTimestamp: null + labels: + io.kompose.service: finagle-client + name: finagle-client + namespace: px-finagle +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: finagle-client + strategy: {} + template: + metadata: + annotations: + kompose.cmd: kompose convert -f ../docker/docker-compose.yml + kompose.version: 1.26.1 (a9d05d509) + creationTimestamp: null + labels: + io.kompose.service: finagle-client + spec: + containers: + - args: + - client/run + image: gcr.io/pixie-prod/demos/finagle/hello:1.0 + name: finagle-client + resources: {} + restartPolicy: Always +status: {} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + kompose.cmd: kompose convert -f ../docker/docker-compose.yml + kompose.version: 1.26.1 (a9d05d509) + creationTimestamp: null + labels: + io.kompose.service: finagle-server + name: finagle-server + namespace: px-finagle +spec: + replicas: 1 + selector: + matchLabels: + io.kompose.service: finagle-server + strategy: {} + template: + metadata: + annotations: + kompose.cmd: kompose convert -f ../docker/docker-compose.yml + kompose.version: 1.26.1 (a9d05d509) + creationTimestamp: null + labels: + io.kompose.service: finagle-server + spec: + containers: + - image: gcr.io/pixie-prod/demos/finagle/hello:1.0 + name: finagle-server + ports: + - containerPort: 9992 + resources: {} + restartPolicy: Always +status: {} diff --git a/demos/manifest.json b/demos/manifest.json index f7a65940c06..b5e361a1d4e 100644 --- a/demos/manifest.json +++ b/demos/manifest.json @@ -34,5 +34,13 @@ "To turn off the invoicing delay, run:", " kubectl exec -n px-kafka $INVC_POD -c invoicing -- kill -USR2 $INVC_PID" ] + }, + "px-finagle": { + "description": "Microservice demo that generates thriftmux traffic with finagle.", + "instructions": [ + "Use the px/mux_data script to view the traffic that is continuously generated.", + "Mux tracing is only enabled on newer kernels (>= 5.2) by default.", + "Make sure your system meets these requirements before deploying." + ] } }