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

cleanup al2023 templates #1682

Merged
merged 3 commits into from
Feb 22, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ PACKER_TEMPLATE_DIR ?= templates/$(os_distro)
PACKER_TEMPLATE_FILE ?= $(PACKER_TEMPLATE_DIR)/template.json
PACKER_DEFAULT_VARIABLE_FILE ?= $(PACKER_TEMPLATE_DIR)/variables-default.json
PACKER_OPTIONAL_K8S_VARIABLE_FILE ?= $(PACKER_TEMPLATE_DIR)/variables-$(K8S_VERSION_MINOR).json
ifeq (,$(wildcard $(PACKER_OPTIONAL_VARIABLE_FILE)))
ifeq (,$(wildcard $(PACKER_OPTIONAL_K8S_VARIABLE_FILE)))
# unset the variable, no k8s-specific variable file exists
PACKER_OPTIONAL_K8S_VARIABLE_FILE=
endif
Expand Down
2 changes: 0 additions & 2 deletions doc/usage/al2023.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
| `aws_session_token` | |
| `binary_bucket_name` | |
| `binary_bucket_region` | |
| `cache_container_images` | |
| `containerd_version` | |
| `creator` | |
| `enable_fips` | Install openssl and enable fips related kernel parameters |
Expand All @@ -28,7 +27,6 @@
| `kubernetes_build_date` | |
| `kubernetes_version` | |
| `launch_block_device_mappings_volume_size` | |
| `pause_container_version` | |
| `remote_folder` | Directory path for shell provisioner scripts on the builder instance |
| `runc_version` | |
| `security_group_id` | |
Expand Down
3 changes: 0 additions & 3 deletions templates/al2023/provisioners/install-worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ validate_env_set() {

validate_env_set BINARY_BUCKET_NAME
validate_env_set BINARY_BUCKET_REGION
validate_env_set CACHE_CONTAINER_IMAGES
validate_env_set CONTAINERD_VERSION
validate_env_set DOCKER_VERSION
validate_env_set KUBERNETES_BUILD_DATE
validate_env_set KUBERNETES_VERSION
validate_env_set PAUSE_CONTAINER_VERSION
validate_env_set RUNC_VERSION
validate_env_set WORKING_DIR

Expand Down
10 changes: 1 addition & 9 deletions templates/al2023/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"aws_session_token": null,
"binary_bucket_name": null,
"binary_bucket_region": null,
"cache_container_images": null,
"containerd_version": null,
"creator": null,
"enable_fips": null,
Expand All @@ -24,7 +23,6 @@
"kubernetes_build_date": null,
"kubernetes_version": null,
"launch_block_device_mappings_volume_size": null,
"pause_container_version": null,
"remote_folder": null,
"runc_version": null,
"security_group_id": null,
Expand Down Expand Up @@ -179,12 +177,9 @@
"AWS_SESSION_TOKEN={{user `aws_session_token`}}",
"BINARY_BUCKET_NAME={{user `binary_bucket_name`}}",
"BINARY_BUCKET_REGION={{user `binary_bucket_region`}}",
"CACHE_CONTAINER_IMAGES={{user `cache_container_images`}}",
"CONTAINERD_VERSION={{user `containerd_version`}}",
"DOCKER_VERSION=none",
"KUBERNETES_BUILD_DATE={{user `kubernetes_build_date`}}",
"KUBERNETES_VERSION={{user `kubernetes_version`}}",
"PAUSE_CONTAINER_VERSION={{user `pause_container_version`}}",
"RUNC_VERSION={{user `runc_version`}}",
"SSM_AGENT_VERSION={{user `ssm_agent_version`}}",
"WORKING_DIR={{user `working_dir`}}"
Expand Down Expand Up @@ -212,10 +207,7 @@
"type": "shell",
"remote_folder": "{{ user `remote_folder`}}",
"script": "{{template_dir}}/../shared/provisioners/generate-version-info.sh",
"execute_command": "chmod +x {{ .Path }}; {{ .Path }} {{user `working_dir`}}/version-info.json",
"environment_vars": [
"CACHE_CONTAINER_IMAGES={{user `cache_container_images`}}"
]
"execute_command": "chmod +x {{ .Path }}; {{ .Path }} {{user `working_dir`}}/version-info.json"
},
{
"type": "file",
Expand Down
2 changes: 0 additions & 2 deletions templates/al2023/variables-default.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
"aws_session_token": "{{env `AWS_SESSION_TOKEN`}}",
"binary_bucket_name": "amazon-eks",
"binary_bucket_region": "us-west-2",
"cache_container_images": "false",
"containerd_version": "*",
"creator": "{{env `USER`}}",
"enable_fips": "false",
"encrypted": "false",
"kms_key_id": "",
"launch_block_device_mappings_volume_size": "20",
"pause_container_version": "3.5",
"remote_folder": "/tmp",
"runc_version": "*",
"security_group_id": "",
Expand Down
2 changes: 1 addition & 1 deletion templates/shared/provisioners/generate-version-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ echo $(jq ".binaries.awscli = \"$CLI_VERSION\"" $OUTPUT_FILE) > $OUTPUT_FILE
# cached images
if systemctl is-active --quiet containerd; then
echo $(jq ".images = [ $(sudo ctr -n k8s.io image ls -q | cut -d'/' -f2- | sort | uniq | grep -v 'sha256' | xargs -r printf "\"%s\"," | sed 's/,$//') ]" $OUTPUT_FILE) > $OUTPUT_FILE
elif [ "${CACHE_CONTAINER_IMAGES}" = "true" ]; then
elif [ "${CACHE_CONTAINER_IMAGES:-}" = "true" ]; then
echo "containerd must be active to generate version info for cached images"
exit 1
fi