Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASM-4855 Make image signature validation rules customizable #5372

Merged
merged 2 commits into from
Sep 16, 2024
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
2 changes: 1 addition & 1 deletion upgrade/scripts/upgrade/prerequisites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ if [[ ${state_recorded} == "0" && $(hostname) == "${PRIMARY_NODE}" ]]; then
# NOTE: There are currently no sealed secrets being added so we are skipping the sealed secrets steps

cp "${CUSTOMIZATIONS_YAML}" "${CUSTOMIZATIONS_YAML}.bak"
. "${locOfScript}/util/update-customizations.sh" -i "${CUSTOMIZATIONS_YAML}"
. "${locOfScript}/util/update-customizations.sh" -i "${CUSTOMIZATIONS_YAML}" "${CSM_ARTI_DIR}/shasta-cfg/customizations.yaml"

# rename customizations file so k8s secret name stays the same
cp "${CUSTOMIZATIONS_YAML}" customizations.yaml
Expand Down
10 changes: 8 additions & 2 deletions upgrade/scripts/upgrade/util/update-customizations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ trap 'err_report' ERR
set -o pipefail

usage() {
echo >&2 "usage: ${0##*/} [-i] [CUSTOMIZATIONS-YAML]"
echo >&2 "Update customizations during upgrade, using current customizations (from live system) and"
echo >&2 " new customizations (from upgrade tarball). With -i, update CUSTOMIZATIONS-YAML in place."
echo >&2 "usage: ${0##*/} [-i] CUSTOMIZATIONS-YAML CUSTOMIZATIONS-YAML-FROM-UPGRADE-TARBALL"
exit 1
}

Expand All @@ -52,9 +54,10 @@ done

set -- "${args[@]}"

[[ $# -eq 1 ]] || usage
[[ $# -eq 2 ]] || usage

customizations="$1"
upgrade_customizations="$2"

if [[ ! -f $customizations ]]; then
echo >&2 "error: no such file: $customizations"
Expand Down Expand Up @@ -171,6 +174,9 @@ yq4 -i eval 'del(.spec.kubernetes.services.cray-hms-reds)' "$c"
# Add customizations for cray-hms-discovery for it to get the River credential sealed secret:
yq4 -i eval '.spec.kubernetes.services.cray-hms-discovery.sealedSecrets = ["{{ kubernetes.sealed_secrets.cray_reds_credentials | toYaml }}"]' "$c"

# kyverno-policy did not have configurable customization prior to 1.6. Import kyverno-policy.checkImageSettings from upgrade customizations file during upgrade.
yq4 -i eval ".spec.kubernetes.services[\"kyverno-policy\"].checkImagePolicy += (load(\"${upgrade_customizations}\") | .spec.kubernetes.services[\"kyverno-policy\"].checkImagePolicy)" "$c"

# lower cpu request for tds systems (4 workers)
num_workers=$(kubectl get nodes | grep ncn-w | wc -l)
if [ $num_workers -le 4 ]; then
Expand Down