Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RUN INSTALL_PKGS=" \

FROM centos:8
COPY --from=builder /go/src/github.com/openshift/cluster-node-tuning-operator/_output/cluster-node-tuning-operator /usr/bin/
COPY --from=builder /go/src/github.com/openshift/cluster-node-tuning-operator/_output/performance-profile-creator /usr/bin/
COPY manifests/*.yaml manifests/image-references /manifests/
ENV APP_ROOT=/var/lib/tuned
ENV PATH=${APP_ROOT}/bin:${PATH}
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RUN INSTALL_PKGS=" \

FROM registry.ci.openshift.org/ocp/4.11:base
COPY --from=builder /go/src/github.com/openshift/cluster-node-tuning-operator/_output/cluster-node-tuning-operator /usr/bin/
COPY --from=builder /go/src/github.com/openshift/cluster-node-tuning-operator/_output/performance-profile-creator /usr/bin/
COPY manifests/*.yaml manifests/image-references /manifests/
ENV APP_ROOT=/var/lib/tuned
ENV PATH=${APP_ROOT}/bin:${PATH}
Expand Down
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ clone-tuned:
cd $(TUNED_DIR) && git checkout $(TUNED_COMMIT) && cd .. && \
rm -rf $(TUNED_DIR)/.git)

build: $(BINDATA) pkg/generated
build: $(BINDATA) pkg/generated build-performance-profile-creator
$(GO_BUILD_RECIPE)
ln -sf $(PACKAGE_BIN) $(OUT_DIR)/openshift-tuned

Expand Down Expand Up @@ -190,3 +190,15 @@ pao-functests-only:
cluster-clean-pao:
@echo "Cleaning up performance addons artifacts"
hack/clean-deploy.sh

# Performance Profile Creator (PPC)
.PHONY: build-performance-profile-creator
build-performance-profile-creator:
@echo "Building Performance Profile Creator (PPC)"
LDFLAGS="-s -w -X ${PACKAGE}/cmd/performance-profile-creator/version.Version=${REV} "; \
$(GO) build -v $(LDFLAGS) -o $(OUT_DIR)/performance-profile-creator ./cmd/performance-profile-creator

.PHONY: performance-profile-creator-tests
performance-profile-creator-tests: build-performance-profile-creator
@echo "Running Performance Profile Creator Tests"
hack/run-perf-profile-creator-functests.sh
41 changes: 31 additions & 10 deletions cmd/performance-profile-creator/README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,66 @@
# Performance Profile Creator (PPC)

A tool to automate the process of creating Performance Profile using the user supplied profile parameters.

## Software Components
1. A CLI tool part of the Performance Addon Operator image

1. A CLI tool part of the Node Tuning Operator image

## Flow

1. PPC consumes a must-gather output.
1. PPC output is a bunch of YAML data (PAO profile + NTO tuned part).

## Things to note before running Performance Profile Creator
1. Performance Profile Creator is present as an entrypoint (in /usr/local/bin/performance-profile-creator) in the Performance Addon Operator image.

1. Performance Profile Creator is present as an entrypoint (in /usr/bin/performance-profile-creator) in the Node Tuning Operator image.
1. It is assumed that we have a must-gather directory available where we run the tool.
1. Option 1: Run must-gather tool like below and use its output dir when you run PPC.

```bash
oc adm must-gather --image=quay.io/openshift-kni/performance-addon-operator-must-gather:4.9-snapshot --dest-dir=<dir>
```

1. Option 2: Use an existing must-gather tarball decompressed to a directory.

## Building Performance Profile Creator binary and image

Developers can build the Performance Profile Creator images from the source tree using make targets.
1. Setup Environment variables

1. Setup Environment variables

```bash
export REGISTRY_NAMESPACE=<your quay.io namespace>
export IMAGE_TAG=<the image tag to use> #defaults to "latest"
export IMAGE_BUILD_CMD=podman
```

1. To build from Performance Profile Creator source:

```bash
make create-performance-profile
make build-performance-profile-creator
```

1. To build the Performance addon Operator image from source:

```bash
make operator-container
make local-image
```
Alternatively, you can pull the latest master upstream image. In the following examples, TAG has the format major.minor-snapshot. For example, the TAG for OpenShift 4.11 will be 4.11-snapshot:

Alternatively, you can pull the latest master upstream image. In the following examples, TAG has the format major.minor. For example, the TAG for OpenShift 4.11 will be 4.11:

```bash
podman pull quay.io/openshift-kni/performance-addon-operator:4.11-snapshot
podman pull quay.io/openshift/origin-cluster-node-tuning-operator:4.11
```

## Running Performance Profile Creator

Depending on how the must-gather directory was set up the operator can now run the Performance Profile Creator tool with the required parameters.

PPC Tool help output:

```bash
$ podman run --entrypoint performance-profile-creator quay.io/openshift-kni/performance-addon-operator:4.11-snapshot -h
$ podman run --entrypoint performance-profile-creator quay.io/openshift/origin-cluster-node-tuning-operator:4.11 -h
A tool that automates creation of Performance Profiles

Usage:
Expand All @@ -66,21 +82,25 @@ Flags:
```

1. Option 1: Example of using must-gather output dir (obtained after running must gather manually) along with required arguments

```bash
podman run --entrypoint performance-profile-creator -v /path/to/must-gather-output:/must-gather:z \
quay.io/openshift-kni/performance-addon-operator:4.11-snapshot --must-gather-dir-path /must-gather \
quay.io/openshift/origin-cluster-node-tuning-operator:4.11 --must-gather-dir-path /must-gather \
--reserved-cpu-count 20 --mcp-name worker-cnf --rt-kernel false > performance-profile.yaml
```

1. Option 2: Example of using an existing must-gather tarball which is decompressed to a directory along with required arguments

```bash
podman run --entrypoint performance-profile-creator -v /path/to/decompressed-tarball:/must-gather:z \
quay.io/openshift-kni/performance-addon-operator:4.11-snapshot --must-gather-dir-path /must-gather \
quay.io/openshift/origin-cluster-node-tuning-operator:4.11 --must-gather-dir-path /must-gather \
--reserved-cpu-count 20 --mcp-name worker-cnf --rt-kernel false > performance-profile.yaml
```

## Running Performance Profile Creator using Wrapper script

1. Example of how the following wrapper script can be used to create a performance profle:

```bash
./hack/run-perf-profile-creator.sh -t must-gather.tar.gz -- --mcp-name=worker-cnf --reserved-cpu-count=20 \
--rt-kernel=false --split-reserved-cpus-across-numa=true --topology-manager-policy=restricted \
Expand All @@ -90,6 +110,7 @@ Flags:
## Discovery mode

To learn about the key details of the cluster you want to create a profile for, you may use the `discovery` (aka `info`) mode:

```bash
./hack/run-perf-profile-creator.sh -t must-gather.tar.gz -- --info=log

Expand Down
14 changes: 7 additions & 7 deletions hack/run-perf-profile-creator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ readonly IMG_EXISTS_CMD="${CONTAINER_RUNTIME} image exists"
readonly IMG_PULL_CMD="${CONTAINER_RUNTIME} image pull"
readonly MUST_GATHER_VOL="/must-gather"

PAO_IMG="quay.io/openshift-kni/performance-addon-operator:4.11-snapshot"
NTO_IMG="quay.io/openshift/origin-cluster-node-tuning-operator:4.11"
MG_TARBALL=""
DATA_DIR=""

Expand All @@ -17,10 +17,10 @@ usage() {
print ""
print "Options:"
print " -h help for ${CURRENT_SCRIPT}"
print " -p Performance Addon Operator image"
print " -p Node Tuning Operator image"
print " -t path to a must-gather tarball"

${IMG_EXISTS_CMD} "${PAO_IMG}" && ${CMD} "${PAO_IMG}" -h
${IMG_EXISTS_CMD} "${NTO_IMG}" && ${CMD} "${NTO_IMG}" -h
}

function cleanup {
Expand All @@ -39,8 +39,8 @@ print() {
}

check_requirements() {
${IMG_EXISTS_CMD} "${PAO_IMG}" || ${IMG_PULL_CMD} "${PAO_IMG}" || \
exit_error "Performance Addon Operator image not found"
${IMG_EXISTS_CMD} "${NTO_IMG}" || ${IMG_PULL_CMD} "${NTO_IMG}" || \
exit_error "Node Tuning Operator image not found"

[ -n "${MG_TARBALL}" ] || exit_error "Must-gather tarball file path is mandatory"
[ -f "${MG_TARBALL}" ] || exit_error "Must-gather tarball file not found"
Expand All @@ -60,7 +60,7 @@ main() {
exit 0
;;
p)
PAO_IMG="${OPTARG}"
NTO_IMG="${OPTARG}"
;;
t)
MG_TARBALL="${OPTARG}"
Expand All @@ -74,7 +74,7 @@ main() {

check_requirements || exit 1

${CMD} -v "${DATA_DIR}:${MUST_GATHER_VOL}:z" "${PAO_IMG}" "$@" --must-gather-dir-path "${MUST_GATHER_VOL}"
${CMD} -v "${DATA_DIR}:${MUST_GATHER_VOL}:z" "${NTO_IMG}" "$@" --must-gather-dir-path "${MUST_GATHER_VOL}"
echo "" 1>&2
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import (
)

const (
mustGatherPath = "../../test/e2e/performanceprofile/testdata/must-gather"
expectedProfilesPath = "../../test/e2e/performanceprofile/testdata/ppc-expected-profiles"
expectedInfoPath = "../../test/e2e/performanceprofile/testdata/ppc-expected-info"
ppcPath = "../../build/_output/bin/performance-profile-creator"
mustGatherPath = "../../../../../test/e2e/performanceprofile/testdata/must-gather"
expectedProfilesPath = "../../../../../test/e2e/performanceprofile/testdata/ppc-expected-profiles"
expectedInfoPath = "../../../../../test/e2e/performanceprofile/testdata/ppc-expected-info"
ppcPath = "../../../../../_output/performance-profile-creator"
)

var mustGatherFullPath = path.Join(mustGatherPath, "must-gather.bare-metal")
Expand Down