Skip to content

Commit

Permalink
CNF-11145: Enhance render sync to include bootstrap rendering tests (o…
Browse files Browse the repository at this point in the history
…penshift#932)

* Enhance render sync to include bootstrap rendering tests

* make render-sync

(cherry picked from commit e225a86)
  • Loading branch information
MarSik authored and ffromani committed Mar 12, 2024
1 parent 2088a82 commit f39d9aa
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 23 deletions.
47 changes: 33 additions & 14 deletions hack/render-sync.sh
@@ -1,16 +1,35 @@
#!/usr/bin/env bash

WORKDIR=$(dirname "$(realpath "$0")")/..
ARTIFACT_DIR=$(mktemp -d)

cd "${WORKDIR}" || { echo "failed to change dir to ${WORKDIR}"; exit; }
_output/cluster-node-tuning-operator render \
--asset-input-dir "${WORKDIR}"/test/e2e/performanceprofile/cluster-setup/manual-cluster/performance,"${WORKDIR}"/test/e2e/performanceprofile/cluster-setup/base/performance \
--asset-output-dir "${ARTIFACT_DIR}"

cp "${ARTIFACT_DIR}"/* "${WORKDIR}"/test/e2e/performanceprofile/testdata/render-expected-output/default
for f in "${WORKDIR}"/test/e2e/performanceprofile/testdata/render-expected-output/default/*
do
sed -i "s/uid:.*/uid: \"\"/" "${f}"
done
rm -r "${ARTIFACT_DIR}"

function join_by { local IFS="$1"; shift; echo "$*"; }

function rendersync() {
INPUT_DIRS=()
while (( $# > 1 )); do
INPUT_DIRS+=("${WORKDIR}/test/e2e/performanceprofile/cluster-setup/$1")
shift
done
INPUT_DIRS=$(join_by , ${INPUT_DIRS[@]})

OUTPUT_DIR=$1

echo "== Rendering ${INPUT_DIRS} into ${OUTPUT_DIR}"

ARTIFACT_DIR=$(mktemp -d)

cd "${WORKDIR}" || { echo "failed to change dir to ${WORKDIR}"; exit; }
_output/cluster-node-tuning-operator render \
--asset-input-dir "${INPUT_DIRS}" \
--asset-output-dir "${ARTIFACT_DIR}"

cp "${ARTIFACT_DIR}"/* "${WORKDIR}"/test/e2e/performanceprofile/testdata/render-expected-output/${OUTPUT_DIR}
for f in "${WORKDIR}"/test/e2e/performanceprofile/testdata/render-expected-output/${OUTPUT_DIR}/*
do
sed -i "s/uid:.*/uid: \"\"/" "${f}"
done
rm -r "${ARTIFACT_DIR}"
}

rendersync manual-cluster/performance base/performance default
rendersync bootstrap-cluster/performance pinned-cluster/default bootstrap/no-mcp
rendersync bootstrap-cluster/performance pinned-cluster/default bootstrap-cluster/extra-mcp bootstrap/extra-mcp
Expand Up @@ -2,9 +2,9 @@ apiVersion: machineconfiguration.openshift.io/v1
kind: KubeletConfig
metadata:
creationTimestamp: null
name: performance-manual
labels:
performance.openshift.io/weak-owner-reference-name: "manual"
performance.openshift.io/weak-owner-reference-name: manual
name: performance-manual
spec:
kubeletConfig:
apiVersion: kubelet.config.k8s.io/v1beta1
Expand Down
Expand Up @@ -4,7 +4,7 @@ metadata:
creationTimestamp: null
labels:
machineconfiguration.openshift.io/role: worker-cnf
performance.openshift.io/weak-owner-reference-name: "manual"
performance.openshift.io/weak-owner-reference-name: manual
name: 50-performance-manual
spec:
baseOSExtensionsContainerImage: ""
Expand Down
Expand Up @@ -2,9 +2,9 @@ apiVersion: config.openshift.io/v1
kind: Node
metadata:
creationTimestamp: null
name: cluster
labels:
performance.openshift.io/weak-owner-reference-name: "manual"
performance.openshift.io/weak-owner-reference-name: manual
name: cluster
spec:
cgroupMode: v1
status: {}
Expand Up @@ -3,9 +3,9 @@ handler: high-performance
kind: RuntimeClass
metadata:
creationTimestamp: null
name: performance-manual
labels:
performance.openshift.io/weak-owner-reference-name: "manual"
performance.openshift.io/weak-owner-reference-name: manual
name: performance-manual
scheduling:
nodeSelector:
node-role.kubernetes.io/worker-cnf: ""
Expand Up @@ -2,10 +2,10 @@ apiVersion: tuned.openshift.io/v1
kind: Tuned
metadata:
creationTimestamp: null
labels:
performance.openshift.io/weak-owner-reference-name: manual
name: openshift-node-performance-manual
namespace: openshift-cluster-node-tuning-operator
labels:
performance.openshift.io/weak-owner-reference-name: "manual"
spec:
profile:
- data: "[main]\nsummary=Openshift node optimized for deterministic performance
Expand Down

0 comments on commit f39d9aa

Please sign in to comment.