Skip to content

Commit 0e47df6

Browse files
Himani Anil Deshpandehanwen-cluster
authored andcommitted
Adding kernel pinning by default in parallelcluster.yaml
1 parent 7e69666 commit 0e47df6

File tree

1 file changed

+25
-38
lines changed

1 file changed

+25
-38
lines changed

cli/src/pcluster/resources/imagebuilder/parallelcluster.yaml

Lines changed: 25 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -184,23 +184,6 @@ phases:
184184
fi
185185
fi
186186
187-
- name: CreatingJsonFile
188-
action: CreateFile
189-
inputs:
190-
- path: /etc/parallelcluster/image_dna.json
191-
content: |
192-
${CfnParamChefDnaJson}
193-
overwrite: true
194-
195-
- name: DisableKernelUpdate
196-
action: ExecuteBash
197-
inputs:
198-
commands:
199-
- |
200-
set -v
201-
DISABLE_KERNEL_UPDATE=$(cat /etc/parallelcluster/image_dna.json | jq -r '.cluster.disable_kernel_update.enabled')
202-
echo "${!DISABLE_KERNEL_UPDATE}"
203-
204187
- name: PinKernelVersion
205188
action: ExecuteBash
206189
inputs:
@@ -209,27 +192,24 @@ phases:
209192
set -v
210193
OS='{{ build.OperatingSystemName.outputs.stdout }}'
211194
PLATFORM='{{ build.PlatformName.outputs.stdout }}'
212-
DISABLE_KERNEL_UPDATE='{{ build.DisableKernelUpdate.outputs.stdout }}'
213-
214-
if [[ ${!DISABLE_KERNEL_UPDATE} == true ]]; then
215-
if [[ ${!PLATFORM} == RHEL ]]; then
216-
yum install -y yum-plugin-versionlock
217-
# listing all the packages because wildcard does not work as expected
218-
yum versionlock kernel kernel-core kernel-modules
219-
220-
if [[ ${!OS} == "alinux2" ]] || [[ ${!OS} == "alinux2023" ]] ; then
221-
yum versionlock kernel-abi-whitelists
222-
else
223-
yum versionlock kernel-abi-stablelists
224-
fi
225195
226-
if [[ ${!OS} == "rocky8" ]] || [[ ${!OS} == "rocky9" ]] ; then
227-
yum versionlock rocky-release rocky-repos
228-
elif [[ ${!OS} == "rhel8" ]] || [[ ${!OS} == "rhel9" ]] ; then
229-
yum versionlock redhat-release
230-
fi
231-
echo "Kernel version locked"
196+
if [[ ${!PLATFORM} == RHEL ]]; then
197+
yum install -y yum-plugin-versionlock
198+
# listing all the packages because wildcard does not work as expected
199+
yum versionlock kernel kernel-core kernel-modules
200+
201+
if [[ ${!OS} == "alinux2" ]] || [[ ${!OS} == "alinux2023" ]] ; then
202+
yum versionlock kernel-abi-whitelists
203+
else
204+
yum versionlock kernel-abi-stablelists
205+
fi
206+
207+
if [[ ${!OS} == "rocky8" ]] || [[ ${!OS} == "rocky9" ]] ; then
208+
yum versionlock rocky-release rocky-repos
209+
elif [[ ${!OS} == "rhel8" ]] || [[ ${!OS} == "rhel9" ]] ; then
210+
yum versionlock redhat-release
232211
fi
212+
echo "Kernel version locked"
233213
fi
234214
235215
# Install prerequisite OS packages
@@ -326,6 +306,14 @@ phases:
326306
cookbook_path ['/etc/chef/cookbooks']
327307
overwrite: true
328308

309+
- name: CreatingJsonFile
310+
action: CreateFile
311+
inputs:
312+
- path: /etc/parallelcluster/image_dna.json
313+
content: |
314+
${CfnParamChefDnaJson}
315+
overwrite: true
316+
329317
- name: InstallPClusterPackages
330318
action: ExecuteBash
331319
inputs:
@@ -352,10 +340,9 @@ phases:
352340
set -v
353341
OS='{{ build.OperatingSystemName.outputs.stdout }}'
354342
PLATFORM='{{ build.PlatformName.outputs.stdout }}'
355-
DISABLE_KERNEL_UPDATE='{{ build.DisableKernelUpdate.outputs.stdout }}'
356343
357344
# Remove kernel version lock
358-
if [[ ${!DISABLE_KERNEL_UPDATE} == true ]] && [[ ${!PLATFORM} == RHEL ]]; then
345+
if [[ ${!PLATFORM} == RHEL ]]; then
359346
yum versionlock delete kernel kernel-core kernel-modules
360347
361348
if [[ ${!OS} == "alinux2" ]] || [[ ${!OS} == "alinux2023" ]] ; then

0 commit comments

Comments
 (0)