From 0ed106e9729ecc957d1bc8d4418f1c4ea744ced9 Mon Sep 17 00:00:00 2001 From: haoshuwei Date: Thu, 16 Jul 2020 17:31:34 +0800 Subject: [PATCH] hotfix Signed-off-by: haoshuwei --- examples/ack-aliyunlinux2.json | 37 +++++++++++++++++++ hotfix/hotfix-ipvlan/README.md | 8 ++++ .../ack-aliyunlinux2-ipvlan.json | 34 +++++++++++++++++ hotfix/hotfix-ipvlan/scripts/installRPMs.sh | 8 ++++ hotfix/hotfix-ipvlan/scripts/updateConfig.sh | 11 ++++++ 5 files changed, 98 insertions(+) create mode 100644 examples/ack-aliyunlinux2.json create mode 100644 hotfix/hotfix-ipvlan/README.md create mode 100644 hotfix/hotfix-ipvlan/ack-aliyunlinux2-ipvlan.json create mode 100755 hotfix/hotfix-ipvlan/scripts/installRPMs.sh create mode 100755 hotfix/hotfix-ipvlan/scripts/updateConfig.sh diff --git a/examples/ack-aliyunlinux2.json b/examples/ack-aliyunlinux2.json new file mode 100644 index 0000000..f078e01 --- /dev/null +++ b/examples/ack-aliyunlinux2.json @@ -0,0 +1,37 @@ +{ + "variables": { + "region": "cn-hangzhou", + "image_name": "test_image{{timestamp}}", + "source_image": "aliyun_2_1903_x64_20G_uefi_alibase_20200616.vhd", + "instance_type": "ecs.g6.large", + "access_key": "{{env `ALICLOUD_ACCESS_KEY`}}", + "secret_key": "{{env `ALICLOUD_SECRET_KEY`}}" + }, + "builders": [ + { + "type": "alicloud-ecs", + "access_key": "{{user `access_key`}}", + "secret_key": "{{user `secret_key`}}", + "region": "{{user `region`}}", + "image_name": "{{user `image_name`}}", + "source_image": "{{user `source_image`}}", + "ssh_username": "root", + "instance_type": "{{user `instance_type`}}", + "skip_image_validation": "true", + "io_optimized": "true" + } + ], + "provisioners": [ + { + "type": "shell", + "scripts": [ + "scripts/updateKernel.sh", + "scripts/reboot.sh", + "scripts/cleanUpKerneles.sh", + "config/default.sh", + "scripts/verify.sh" + ], + "expect_disconnect": true + } + ] +} diff --git a/hotfix/hotfix-ipvlan/README.md b/hotfix/hotfix-ipvlan/README.md new file mode 100644 index 0000000..03cd5e2 --- /dev/null +++ b/hotfix/hotfix-ipvlan/README.md @@ -0,0 +1,8 @@ +This is the template for ack base image to fix issue [#19](https://github.com/AliyunContainerService/ack-image-builder/issues/19) + +Commands to build image: +``` +export ALICLOUD_ACCESS_KEY=XXX +export ALICLOUD_SECRET_KEY=XXX +packer build ack-aliyunlinux2-ipvlan.json +``` \ No newline at end of file diff --git a/hotfix/hotfix-ipvlan/ack-aliyunlinux2-ipvlan.json b/hotfix/hotfix-ipvlan/ack-aliyunlinux2-ipvlan.json new file mode 100644 index 0000000..42006bd --- /dev/null +++ b/hotfix/hotfix-ipvlan/ack-aliyunlinux2-ipvlan.json @@ -0,0 +1,34 @@ +{ + "variables": { + "region": "cn-hangzhou", + "image_name": "test_image{{timestamp}}", + "source_image": "aliyun_2_1903_x64_20G_alibase_20200529.vhd", + "instance_type": "ecs.g6.large", + "access_key": "{{env `ALICLOUD_ACCESS_KEY`}}", + "secret_key": "{{env `ALICLOUD_SECRET_KEY`}}" + }, + "builders": [ + { + "type": "alicloud-ecs", + "access_key": "{{user `access_key`}}", + "secret_key": "{{user `secret_key`}}", + "region": "{{user `region`}}", + "image_name": "{{user `image_name`}}", + "source_image": "{{user `source_image`}}", + "ssh_username": "root", + "instance_type": "{{user `instance_type`}}", + "skip_image_validation": "true", + "io_optimized": "true" + } + ], + "provisioners": [ + { + "type": "shell", + "scripts": [ + "scripts/installRPMs.sh", + "scripts/updateConfig.sh" + ], + "expect_disconnect": true + } + ] +} diff --git a/hotfix/hotfix-ipvlan/scripts/installRPMs.sh b/hotfix/hotfix-ipvlan/scripts/installRPMs.sh new file mode 100755 index 0000000..85f35b3 --- /dev/null +++ b/hotfix/hotfix-ipvlan/scripts/installRPMs.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +curl -LO http://xxx.xx.xx.xxx/kernel-4.19.91-0.1.git.6eb3a5047051.al7.x86_64.rpm +curl -LO http://xxx.xx.xx.xxx/kernel-headers-4.19.91-0.1.git.6eb3a5047051.al7.x86_64.rpm + +yum localinstall -y kernel-4.19.91-0.1.git.6eb3a5047051.al7.x86_64.rpm kernel-headers-4.19.91-0.1.git.6eb3a5047051.al7.x86_64.rpm + +rm -rf kernel-4.19.91-0.1.git.6eb3a5047051.al7.x86_64.rpm kernel-headers-4.19.91-0.1.git.6eb3a5047051.al7.x86_64.rpm \ No newline at end of file diff --git a/hotfix/hotfix-ipvlan/scripts/updateConfig.sh b/hotfix/hotfix-ipvlan/scripts/updateConfig.sh new file mode 100755 index 0000000..b07498e --- /dev/null +++ b/hotfix/hotfix-ipvlan/scripts/updateConfig.sh @@ -0,0 +1,11 @@ +#!/bin/sh +/usr/sbin/sysctl -w net.ipv4.vs.conn_reuse_mode=1 +# 如果压测出现客户端分配不到端口可以改成2 +EOF + +chmod +x /root/set-ipvs-sysctls.sh + +echo '*/1 * * * * root bash /root/set-ipvs-sysctls.sh' >> /etc/cron.d/setsysctl + +systemctl reload crond +systemctl restart crond \ No newline at end of file