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

test: update cluster config for 1.30 #1093

Merged
merged 2 commits into from
Aug 30, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 0 additions & 88 deletions test/cluster/cluster-template.json

This file was deleted.

112 changes: 112 additions & 0 deletions test/cluster/cluster-template.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
local clusterName = std.extVar("cluster_name");
local vswitchIDs = std.extVar("vswitch_ids");
local nNodes = std.extVar("n_nodes");
local nodePool = {
nodepool_info: {
name: "default-nodepool"
},
scaling_group: {
vswitch_ids: vswitchIDs,
system_disk_category: "cloud_essd",
system_disk_size: 60,
system_disk_performance_level: "PL0",
system_disk_encrypted: false,
instance_types: [
"ecs.u1-c1m2.xlarge"
],
instance_charge_type: "PostPaid",
key_pair: clusterName,
soc_enabled: false,
cis_enabled: false,
login_as_non_root: false,
platform: "AliyunLinux",
image_id: std.extVar("os_image_alinux3"),
image_type: "AliyunLinux3"
},
kubernetes_config: {
cpu_policy: "none",
cms_enabled: false,
unschedulable: false,
runtime: "containerd",
runtime_version: "1.6.28"
},
management: {
enable: false
},
count: 1
};

{
name: clusterName,
cluster_type: "ManagedKubernetes",
kubernetes_version: "1.30.1-aliyun.1",
region_id: std.extVar("region"),
snat_entry: true,
cloud_monitor_flags: false,
endpoint_public_access: true,
deletion_protection: false,
proxy_mode: "ipvs",
cis_enable_risk_check: false,
tags: [
{
key: "created-for",
value: "csi-daily"
}
],
timezone: "Asia/Shanghai",
addons: [
{
name: "terway-eniip",
config: std.manifestJson({
IPVlan: "false",
NetworkPolicy: "false",
ENITrunking: "false"
})
},
{
name: "csi-plugin",
disabled: true
},
{
name: "csi-provisioner",
disabled: true
},
{
name: "storage-operator",
disabled: true
},
{
name: "nginx-ingress-controller",
disabled: true
}
],
cluster_spec: "ack.pro.small",
load_balancer_spec: "slb.s1.small",
pod_vswitch_ids: vswitchIDs,
charge_type: "PostPaid",
vpcid: std.extVar("vpc_id"),
service_cidr: "192.168.0.0/16",
vswitch_ids: vswitchIDs,
ip_stack: "ipv4",
maintenance_window: {
enable: false
},
nodepools: [
nodePool {
count: nNodes - 1
},
nodePool {
nodepool_info+: {
name: "ssd_only"
},
scaling_group+: {
vswitch_ids: vswitchIDs[1:] + vswitchIDs[:1], // try different available zones
system_disk_category: "cloud_efficiency",
system_disk_performance_level: "",
instance_types: [
"ecs.mn4.2xlarge",
]
}
}
]
}
17 changes: 9 additions & 8 deletions test/cluster/cluster_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

N_NODES=${N_NODES:-2}
N_NODES=${N_NODES:-3}
ACK_REGION=${ACK_REGION:-cn-beijing}
ACK_ZONE=${ACK_ZONE:-cn-beijing-h cn-beijing-i cn-beijing-j}

Expand Down Expand Up @@ -64,13 +64,14 @@ function cluster-setup {
subnet=$((subnet+1))
done

local cluster_params=$(jq -n \
--arg region $ACK_REGION \
--arg vpc_id $VPC_ID \
--arg cluster_name "$CASE_NAME" \
--argjson n_nodes $N_NODES \
--argjson vswitch_ids "$(jq -n '$ARGS.positional' --args "${vswitch_ids[@]}")" \
"$(cat $HERE/cluster-template.json)")
local cluster_params=$(jsonnet $HERE/cluster-template.jsonnet \
--ext-str region=$ACK_REGION \
--ext-str vpc_id=$VPC_ID \
--ext-str cluster_name="$CASE_NAME" \
--ext-str os_image_alinux3="${OS_IMAGE_ALINUX3:-aliyun_3_9_x64_20G_alibase_20231219.vhd}" \
--ext-str os_image_containeros3="${OS_IMAGE_CONTAINEROS3:-lifsea_3_x64_10G_containerd_1_6_28_alibase_20240202.vhd}" \
--ext-code n_nodes=$N_NODES \
--ext-code vswitch_ids="$(jq -n '$ARGS.positional' --args "${vswitch_ids[@]}")")
CLUSTER_ID=$(aliyun --region $ACK_REGION cs POST /clusters --header "Content-Type=application/json" --body "$cluster_params" | jq -r .cluster_id)

if [ -z "$CLUSTER_ID" ]; then
Expand Down
3 changes: 2 additions & 1 deletion test/cluster/gather_logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ if [ -f ~/.ssh/id_rsa ]; then
PRIVATE_IP=$(echo $NODES | jq -r ".items[] | select(.metadata.name==\"$node\") | .status.addresses[] | select(.type==\"InternalIP\") | .address")
echo "Gathering logs of node $node ($PRIVATE_IP)"
ssh -o StrictHostKeyChecking=no root@$PRIVATE_IP 'journalctl -o export --since "8 hours ago" | gzip' > $OUTPUT_DIR/$node.journal.gz
ssh -o StrictHostKeyChecking=no root@$PRIVATE_IP 'cd /var/log/containers && shopt -s nullglob && tar --dereference -czf - {csi,storage,terway}-*' > $OUTPUT_DIR/$node-containers.tar.gz
ssh -o StrictHostKeyChecking=no root@$PRIVATE_IP 'cd /var/log/containers && shopt -s nullglob && tar --dereference -czf - {csi,storage,terway}-*' > $OUTPUT_DIR/$node-containers.tar.gz \
|| [ $? -eq 1 ] # ignore exit code 1 (some files were changed while being archived)
scp -o StrictHostKeyChecking=no -r root@$PRIVATE_IP:/opt/csi/gocover $OUTPUT_DIR/gocover/$node || true
done
covdata
Expand Down