remove ack-kubernetes.json

This commit is contained in:
Yilong Ren
2021-04-07 11:20:17 +08:00
parent b51941a7b7
commit 93ff40ffbd
3 changed files with 0 additions and 161 deletions

View File

@@ -35,18 +35,6 @@ export ALICLOUD_SECRET_KEY=XXX
packer build examples/ack-centos.json
```
## Building in the kubernetes
```shell script
make
bash build/build.sh examples/ack-kubernetes.json
```
Notes: you need input the follow params:
- [Alicloud ACCESS_KEY](https://help.aliyun.com/document_detail/53045.html?spm=a2c4g.11186623.2.18.60be682bppY9d0#concept-53045-zh)
- [Alicloud SECRET_KEY](https://help.aliyun.com/document_detail/53045.html?spm=a2c4g.11186623.2.18.60be682blplKSc#concept-53045-zh)
- [REGION](https://help.aliyun.com/document_detail/140601.html?spm=a2c4g.11186623.4.3.41b74c07HvI7Kj)
- Docker Version
- Kubernetes Version
## RAM Policy
If you are using a sub accountthe ram policy should at least include actions as below:

View File

@@ -1,45 +0,0 @@
{
"variables": {
"region": "{{env `REGION`}}",
"image_name": "test_image{{timestamp}}",
"source_image": "centos_7_9_x64_20G_alibase_20210128.vhd",
"instance_type": "ecs.g6.large",
"access_key": "{{env `ALICLOUD_ACCESS_KEY`}}",
"secret_key": "{{env `ALICLOUD_SECRET_KEY`}}",
"docker_version": "{{env `DOCKER_VERSION`}}",
"kube_version": "{{env `KUBE_VERSION`}}"
},
"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": "file",
"source": "scripts/init.sh",
"destination": "/root/"
},
{
"type": "shell",
"inline": [
"export REGION={{user `region`}}",
"export PKG_FILE_SERVER=http://aliacs-k8s-$REGION.oss-$REGION-internal.aliyuncs.com",
"export CLOUD_TYPE=public",
"export OS=CentOS",
"export DOCKER_VERSION={{user `docker_version`}}",
"export KUBE_VERSION={{user `kube_version`}}",
"bash /root/init.sh"
]
}
]
}

View File

@@ -1,104 +0,0 @@
#!/bin/bash
public::common::log() {
echo $(date +"[%Y%m%d %H:%M:%S]: ") $1
}
public::common::prepare_package() {
PKG_TYPE=$1
PKG_VERSION=$2
if [ ! -f ${PKG_TYPE}-${PKG_VERSION}.tar.gz ]; then
curl --retry 4 $PKG_FILE_SERVER/$CLOUD_TYPE/pkg/$PKG_TYPE/${PKG_TYPE}-${PKG_VERSION}.tar.gz \
>${PKG_TYPE}-${PKG_VERSION}.tar.gz || (public::common::log "download failed with 4 retry,exit 1" && exit 1)
fi
tar -xvf ${PKG_TYPE}-${PKG_VERSION}.tar.gz || (public::common::log "untar ${PKG_VERSION}.tar.gz failed!, exit" && exit 1)
}
public::docker::install() {
set +e
docker version >/dev/null 2>&1
i=$?
set -e
v=$(docker version | grep Version | awk '{gsub(/-/, ".");print $2}' | uniq)
if [ $i -eq 0 ]; then
if [[ "$DOCKER_VERSION" == "$v" ]]; then
public::common::log "docker has been installed , return. $DOCKER_VERSION"
return
fi
fi
public::common::prepare_package "docker" $DOCKER_VERSION
if [ "$OS" == "CentOS" ] || [ "$OS" == "RedHat" ] || [ "$OS" == "AliOS" ] || [ "$OS" == "AliyunOS" ]; then
if type docker; then
if [ "$(rpm -qa docker-engine-selinux | wc -l)" == "1" ]; then
yum erase -y docker-engine-selinux
fi
if [ "$(rpm -qa docker-engine | wc -l)" == "1" ]; then
yum erase -y docker-engine
fi
if [ "$(rpm -qa docker-ce | wc -l)" == "1" ]; then
yum erase -y docker-ce
fi
if [ "$(rpm -qa container-selinux | wc -l)" == "1" ]; then
yum erase -y container-selinux
fi
if [ "$(rpm -qa docker-ee | wc -l)" == "1" ]; then
yum erase -y docker-ee
fi
fi
local pkg=pkg/docker/$DOCKER_VERSION/rpm/
if [ "$OS" == "AliOS" ]; then
set +e
set +o pipefail
for package in $(ls $pkg | xargs -I '{}' echo -n "$pkg{} "); do
rpm -qp ${package} --requires |\
grep -v container-selinux | grep -v 'rpmlib'| awk '{print $1}'|xargs -n1 yum install -y
rpm -ivh --nodeps ${package}
done
else
yum localinstall -y $(ls $pkg | xargs -I '{}' echo -n "$pkg{} ")
fi
elif [ "$OS" == "Ubuntu" ]; then
if [ "$need_reinstall" == "true" ]; then
if [ "$(echo $v | grep ee | wc -l)" == "1" ]; then
apt purge -y docker-ee docker-ee-selinux
elif [ "$(echo $v | grep ce | wc -l)" == "1" ]; then
apt purge -y docker-ce docker-ce-selinux container-selinux
else
apt purge -y docker-engine
fi
fi
dir=pkg/docker/$DOCKER_VERSION/debain
dpkg -i $(ls $dir | xargs -I '{}' echo -n "$dir/{} ")
elif [ "$OS" == "SUSE" ]; then
if type docker; then
if [ "$(rpm -qa docker-engine-selinux | wc -l)" == "1" ]; then
zypper rm -y docker-engine-selinux
fi
if [ "$(rpm -qa docker-engine | wc -l)" == "1" ]; then
zypper rm -y docker-engine
fi
if [ "$(rpm -qa docker-ce | wc -l)" == "1" ]; then
zypper rm -y docker-ce
fi
if [ "$(rpm -qa container-selinux | wc -l)" == "1" ]; then
zypper rm -y container-selinux
fi
if [ "$(rpm -qa docker-ee | wc -l)" == "1" ]; then
zypper rm -y docker-ee
fi
fi
local pkg=pkg/docker/$KUBE_VERSION/rpm/
zypper --no-gpg-checks install -y $(ls $pkg | xargs -I '{}' echo -n "$pkg{} ")
else
public::common::log "install docker with [unsupported OS version] error!"
exit 1
fi
}
main() {
public::common::prepare_package "docker" "$DOCKER_VERSION"
public::common::prepare_package "kubernetes" $KUBE_VERSION
public::docker::install
}
main "$@"