Skip to content

Gather runtime information for the OpenShift Insights Operator

License

Notifications You must be signed in to change notification settings

openshift/insights-runtime-extractor

OpenShift Insights Runtime Extractor

This repository provides a mechanism to gather runtime info from containers to get additional insights on user workloads and make investment decisions that will drive utilization.

The container images built from this repository provides an insights-runtime-extractor feature integrated to the OpenShift Insights Operator.

This feature was proposed and approved by this enhancement.

This repository is composed of multiple components:

  • fingerprints - a collection of self-contained executables that are executed in the container process namespaces to extract runtime information

  • extractor - the "core" engine that queries processes running in containers, detect the relevant fingerprints to run and coordinates their execution to extract information. It is composed of 2 executables:

    • the coordinator, running with high privileges, that does the extraction of the runtime information and store them on the file system.

    • the extractor_server, a simple TCP server that awaits for TCP connection to trigger an extraction from the coordinator and replies with the path of the extracted data on the file system.

  • exporter - the "public" access to the extractor. It is a HTTP server, that, upon an HTTP request, will trigger an extraction by connecting to the extractor_server. It then reads and aggregates all the runtime information from the file system and replies with a JSON payload.

  • runtime-samples - a collection of runtime projects to test the components in its end-to-end (e2e) test suite.

This repository provides two container images:

  • the exporter container that runs the exporter HTTP server

  • the extractor container that runs the extractor_server executable and uses the coordinator and fingerprints for the actual extraction of the runtime information

Both containers are meant to run in a single pod and share their file system using a volume.

Build the container images for development

IMAGE_REGISTRY=quay.io/<my-user-name> make build-image

It builds 2 multi-arch image (amd64 & arm64) images:

  • $IMAGE_REGISTRY/insights-runtime-extractor:latest

  • $IMAGE_REGISTRY/insights-runtime-exporter:latest

Build the development image for Rust

make build-rust-dev-image

This creates a rust-dev Container image that contains all the Rust plumbing to compile and execute the code in extractor

Run the development image and compile the Rust code base

make rust-dev

# you are then inside a container ready to compile the Rust code
make

Test the container images

Prequesites:

  • To test the container images, you must have access to an OpenShift cluster and be logged in with a cluster admin account.

To run the end-to-end (e2e) tests, run the command:

IMAGE_REGISTRY=quay.io/<my-user-name> make e2e-test

Run the extractor

Prequisites:

  • curl, jq, oc are installed on your machine

  • you must have access to an OpenShift cluster and be logged in with a cluster admin account

To deploy the insights-runtime-extractor in the extractor namespace, run the commands:

oc project extractor
oc apply -f https://raw.githubusercontent.com/openshift/insights-runtime-extractor/main/manifests/insights-runtime-extractor-scc.yaml
oc apply -f https://raw.githubusercontent.com/openshift/insights-runtime-extractor/main/manifests/insights-runtime-extractor.yaml

Verify that it is properly deployed:

oc get daemonset -n extractor insights-runtime-extractor

It should display that all the daemonset pods are ready:

NAME                         DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
insights-runtime-extractor   2         2         2       2            2           kubernetes.io/os=linux   20m

Once the insights-runtime-extractor is ready, you can extract all the runtime info by running the script:

export NAMESPACE=extractor
curl -s -L https://raw.githubusercontent.com/openshift/insights-runtime-extractor/main/scripts/extract.sh | bash -s

This command will create a out.json file that contains the extracted runtime info organized by namespace, pod names and container ID:

{
  "jmesnil-dev": {
    "my-quarkus-app-z74cp": {
      "cri-o://0a8819e0edc0fe3769ac092f7e6cc35a596242c3004bc75d42b6eceb2cdf8b90": {
        "os": "rhel",
        "osVersion": "8.6",
        "kind": "Java",
        "kindVersion": "17.0.8",
        "kindImplementer": "Red Hat, Inc.",
        "runtimes": [
          {
            "name": "Quarkus",
            "version": "3.8.4",
          }
      }
    }
  },
  "bob-dev": {
    "my-golang-app-mn7rd": {
      "cri-o://cc934f43953b724f97e57aa02d6c3518d1ddc92f996323d76db9f0a44ec620de": {
        "os": "rhel",
        "osVersion": "9.4",
        "kind": "Golang",
        "kindVersion": "go1.22.6"
      }
    },
    "my-golang-app-mm8jh": {
      "cri-o://47f6c15e0843c84592449d25e5c0b94d5dd2acce3aa126a82cf1fc1e58b6c9ee": {
        "os": "rhel",
        "osVersion": "9.4",
        "kind": "Golang",
        "kindVersion": "go1.22.6"
      }
    },
  }
  [...]
}

Support

The Insights Runtime Extractor is part of Red Hat OpenShift Container Platform. For product-related issues, please file a ticket in Red Hat JIRA for the insights-runtime-extractor component.

License

This project is licensed by the Apache License 2.0. For more information check the LICENSE file.

About

Gather runtime information for the OpenShift Insights Operator

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •