Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OCPBUGS-18640: [release-4.14][manual] backport performance profile ow…
…ner reference ehnancements (#989) * NO-JIRA: perfprof: render: make ownerReference optional (#907) * perfprof: render: make ownerReference optional When we set OwnerReference for dependant object, we must use the object UID the apiserver set. Apiserver owns this field (obviously) so setting it when missing, like the code did in the past, is wrong and will cause conflicts on updates. I the pre-render flow we can't wait for the apiserver to set a UID, so the only possible option is to not set any OwnerReference at all. Signed-off-by: Francesco Romani <fromani@redhat.com> * perfprof: render: add weak owner reference support There are cases on which we can't use the real owner reference in the render flow, because: - we don't own the performanceprofile uid - we can't wait to learn back the apiserver-decided uid because we need to render all the manifest at once. so, to group objects together and enable to safely and easily rebuild the ownerReference graph later, we add an annotation which serves as weaker owner reference, using the profile name and adding it to all the related objects. Note this form of weak reference is meant to serve to a placeholder for the real ownerReference which should be added by the relevant controller later on, when the cluster is started and is running. Signed-off-by: Francesco Romani <fromani@redhat.com> --------- Signed-off-by: Francesco Romani <fromani@redhat.com> (cherry picked from commit 0e31943) (cherry picked from commit 5308f47) * release-4.14: render: align expected machineconfig the backported expected machineconfig output was including the changes in 4.15, we need to update with the 4.14-specific content, excluding unrelated changes. Signed-off-by: Francesco Romani <fromani@redhat.com> * render: perfprofile: don't annotate perfprof (#951) don't add weak ref to the perfprof and don't write back an updated version in output. Signed-off-by: Francesco Romani <fromani@redhat.com> (cherry picked from commit fd8ea4e) (cherry picked from commit 34926bd) * e2e: testdata: remove the annotated profile after #951 merged, we don't need these anymore Signed-off-by: Francesco Romani <fromani@redhat.com> (cherry picked from commit 0d157b5) * CNF-11145: Enhance render sync to include bootstrap rendering tests (#932) * Enhance render sync to include bootstrap rendering tests * make render-sync (cherry picked from commit e225a86) * Add support to inject owner-ref argument to render command (#960) We need this change because we want to use also non default values for the owner-ref like the value none. (cherry picked from commit 631e03c) * release-4.14: hack: branch-specific updates remove lines not relevant for this branch Signed-off-by: Francesco Romani <fromani@redhat.com> --------- Signed-off-by: Francesco Romani <fromani@redhat.com> Co-authored-by: Martin Sivák <msivak@redhat.com> Co-authored-by: Ronny Baturov <rbaturov@redhat.com>
- Loading branch information
1 parent
ffdfe67
commit 5985b17
Showing
14 changed files
with
511 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,41 @@ | ||
#!/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=() | ||
EXTRA_ARGS=() | ||
if [[ "$1" =~ ^-.* ]]; then | ||
while [[ "x$1" != "x--" ]]; do | ||
EXTRA_ARGS+=("$1") | ||
shift | ||
done | ||
shift | ||
fi | ||
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 ${EXTRA_ARGS[@]} \ | ||
--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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.