Environment
- Make target:
build-openstack-ubuntu-2004
- **Run using container image? (Y/N): N
- **Environment vars: kubernetes_enable_automatic_resource_sizing: true
"flavor": "**",
"image_name": "ubuntu-20.04-***",
"availability_zone": "***",
"instance_name": "buildpacker",
"ssh_username": "**",
"source_image":"**",
"security_groups": "**",
"networks": "***",
"image_disk_format": "qcow2",
"use_blockstorage_volume": "true",
"ansible_extra_vars": "pinned_debs=\"cloud-init=20.1-10-g71af48df-0ubuntu5\"",
"containerd_additional_settings": "**",
"kubernetes_deb_version": "1.28.15-1.1",
"kubernetes_series": "v1.28",
"kubernetes_semver": "v1.28.15",
"kubernetes_rpm_version": "1.28.15",
"kubernetes_deb_gpg_key": "https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key",
"node_custom_roles_pre": "**",
"node_custom_roles_post": "**",
"kubernetes_enable_automatic_resource_sizing": "true"
What steps did you take and what happened?
I run a image building from this repo with
make build-openstack-ubuntu-2004 with kubernetes_enable_automatic_resource_sizing=true
What did you expect to happen?
when the resource sizing script runs a second time, it appends the new system resource reservation arguments to KUBELET_EXTRA_ARGS instead of overwriting the previous values. This leads to duplicated --system-reserved parameters being passed to kubelet.
1- First execution:
the script write the following content to /run/kubelet/extra-args.env :
KUBELET_EXTRA_ARGS=--pod-infra-container-image=registry.k8s.io/pause:3.9 --system-reserved=cpu=<..>m,memory=<...>Mi
2- Second execution:
Since the service 11-resource-sizing.conf loads file /run/kubelet/extra-args.env as environnementFile, the KUBELET_EXTRA_ARGS is already defined by the first execution
now /run/kubelet/extra-args.env content
KUBELET_EXTRA_ARGS=--pod-infra-container-image=registry.k8s.io/pause:3.9 --system-reserved=cpu=<..>m,memory=<...>Mi **--system-reserved=cpu=<..>m,memory=<...>Mi**
The part of the script that caused the issue
echo "KUBELET_EXTRA_ARGS=**${KUBELET_EXTRA_ARGS}** --system-reserved=cpu=$(cpu_milicores_to_reserve)m,memory=$(memory_reservation_mebibytes)Mi" >/run/kubelet/extra-args.env
Relevant log output
<!--
If you have any relevant build logs that could help debug this issue please include them here
but MAKE SURE ANY SENSITIVE INFO IS REMOVED!
-->
Anything else you would like to add?
/kind bug
Environment
build-openstack-ubuntu-2004What steps did you take and what happened?
I run a image building from this repo with
make build-openstack-ubuntu-2004with kubernetes_enable_automatic_resource_sizing=trueWhat did you expect to happen?
when the resource sizing script runs a second time, it appends the new system resource reservation arguments to KUBELET_EXTRA_ARGS instead of overwriting the previous values. This leads to duplicated --system-reserved parameters being passed to kubelet.
1- First execution:
the script write the following content to /run/kubelet/extra-args.env :
KUBELET_EXTRA_ARGS=--pod-infra-container-image=registry.k8s.io/pause:3.9 --system-reserved=cpu=<..>m,memory=<...>Mi2- Second execution:
Since the service 11-resource-sizing.conf loads file /run/kubelet/extra-args.env as environnementFile, the KUBELET_EXTRA_ARGS is already defined by the first execution
now /run/kubelet/extra-args.env content
KUBELET_EXTRA_ARGS=--pod-infra-container-image=registry.k8s.io/pause:3.9 --system-reserved=cpu=<..>m,memory=<...>Mi **--system-reserved=cpu=<..>m,memory=<...>Mi**The part of the script that caused the issue
echo "KUBELET_EXTRA_ARGS=**${KUBELET_EXTRA_ARGS}** --system-reserved=cpu=$(cpu_milicores_to_reserve)m,memory=$(memory_reservation_mebibytes)Mi" >/run/kubelet/extra-args.envRelevant log output
Anything else you would like to add?
/kind bug