Skip to content

Commit

Permalink
scripts: Add Additional Kustomization For Baremetal Deployment
Browse files Browse the repository at this point in the history
Adding an option to inject additional EDPM variables for baremetal
deployments using Kustomize.
The following variables were added:
  - EDPM_BAREMETAL_KERNEL_ARGS, uses `edpm-kernel` role to modify kernel
    arugments
  - EDPM_BAREMETAL_KERNEL_HUGEPAGES, uses `edpm-kernel` role to
    configure hugepages
  - EDPM_BAREMETAL_TUNED_PROFILE, uses `edpm_tuned`
    role to configure a tuned profile
  - EDPM_BAREMETAL_TUNED_ISOLATED_CORES, uses `edpm_tuned` role to
    configured tuned isolated cores
  - EDPM_BAREMETAL_NETWORK_CONFIG_OVERRIDE, uses `edpm_network_config`
    role to allow providing custom network configuration
  • Loading branch information
vkhitrin committed Aug 27, 2023
1 parent c45b937 commit 8a31bc3
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions scripts/gen-edpm-baremetal-kustomize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,26 @@ if [ -z "$EDPM_BMH_NAMESPACE" ]; then
echo "Please set EDPM_BMH_NAMESPACE"; exit 1
fi

# This statement is first since we don't want to start creating CR if provided file is not correct
if [ ! -z "$EDPM_BAREMETAL_NETWORK_CONFIG_OVERRIDE" ]; then
if [ ! -f "$EDPM_BAREMETAL_NETWORK_CONFIG_OVERRIDE" ]; then
echo "Please esnure file ${EDPM_BAREMETAL_NETWORK_CONFIG_OVERRIDE} exists"
exit 1
fi
NETWORK_CONFIG_JSON=$(cat "${EDPM_BAREMETAL_NETWORK_CONFIG_OVERRIDE}" | jq -c -r . 2>/dev/null)
if [ ! "$NETWORK_CONFIG_JSON" ]; then
echo "Please esnure file ${EDPM_BAREMETAL_NETWORK_CONFIG_OVERRIDE} contains a valid JSON"
exit 1
fi
fi

NAME=${KIND,,}

if [ ! -d ${DEPLOY_DIR} ]; then
mkdir -p ${DEPLOY_DIR}
fi


pushd ${DEPLOY_DIR}

cat <<EOF >kustomization.yaml
Expand Down Expand Up @@ -176,6 +190,51 @@ cat <<EOF >>kustomization.yaml
EOF
fi

# Used for edpm-kernel role to provide additional kernel arguments
if [ ! -z "$EDPM_BAREMETAL_KERNEL_ARGS" ]; then
cat <<EOF >>kustomization.yaml
- op: add
path: /spec/roles/edpm-compute/nodeTemplate/ansibleVars/edpm_kernel_args
value: ${EDPM_BAREMETAL_KERNEL_ARGS}
EOF
fi

# Used for edpm-kernel role to configure huge pages
if [ ! -z "$EDPM_BAREMETAL_KERNEL_HUGEPAGES" ]; then
cat <<EOF >>kustomization.yaml
- op: add
path: /spec/roles/edpm-compute/nodeTemplate/ansibleVars/edpm_kernel_hugepages
value: ${EDPM_BAREMETAL_KERNEL_HUGEPAGES}
EOF
fi

# Used for edpm_tuned role to configure tuned profile
if [ ! -z "$EDPM_BAREMETAL_TUNED_PROFILE" ]; then
cat <<EOF >>kustomization.yaml
- op: add
path: /spec/roles/edpm-compute/nodeTemplate/ansibleVars/edpm_tuned_profile
value: ${EDPM_BAREMETAL_TUNED_PROFILE}
EOF
fi

# Used for edpm_tuned role to configure tuned profile
if [ ! -z "$EDPM_BAREMETAL_TUNED_ISOLATED_CORES" ]; then
cat <<EOF >>kustomization.yaml
- op: add
path: /spec/roles/edpm-compute/nodeTemplate/ansibleVars/edpm_tuned_isolated_cores
value: ${EDPM_BAREMETAL_TUNED_ISOLATED_CORES}
EOF
fi

# Used for edpm_network_config role to provide custom YAML file for network configuration
if [ ! "$NETWORK_CONFIG_JSON" ]; then
cat <<EOF >>kustomization.yaml
- op: add
path: /spec/roles/edpm-compute/nodeTemplate/ansibleVars/edpm_network_config_override
value: '${NETWORK_CONFIG_JSON}'
EOF
fi

kustomization_add_resources

popd

0 comments on commit 8a31bc3

Please sign in to comment.