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: upgrade script to k8s v1.31 #710

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion test/scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ sudo rm -rf /etc/cni/net.d/

```bash
echo "
K8_VERSION=v1.28.0
K8_VERSION=v1.31.0
POD_CIDR=11.0.0.0/16
SERVICE_CIDR=11.96.0.0/16
MAIN_IP=20.0.0.1/24
Expand Down
53 changes: 31 additions & 22 deletions test/scripts/kubeadm/ClusterJoinConfiguration.template.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: kubeadm.k8s.io/v1beta3
apiVersion: kubeadm.k8s.io/v1beta4
caCertPath: /etc/kubernetes/pki/ca.crt
discovery:
bootstrapToken:
Expand All @@ -13,38 +13,49 @@ nodeRegistration:
criSocket: unix:///var/run/containerd/containerd.sock
name: "${NODE_NAME}"
kubeletExtraArgs:
node-ip: "${FIRST_NODE_IP}"
- name: node-ip
value: "${FIRST_NODE_IP}"
---
# https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/
apiVersion: kubeadm.k8s.io/v1beta3
apiVersion: kubeadm.k8s.io/v1beta4
kind: ClusterConfiguration
apiServer:
timeoutForControlPlane: 4m0s
extraArgs:
authorization-mode: Node,RBAC
advertise-address: "${FIRST_NODE_IP}"
service-cluster-ip-range: "${SERVICE_CIDR}"
# feature-gates: ""
- name: authorization-mode
value: Node,RBAC
- name: advertise-address
value: "${FIRST_NODE_IP}"
- name: service-cluster-ip-range
value: "${SERVICE_CIDR}"
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
# https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/
controllerManager:
extraArgs:
# feature-gates: ""
allocate-node-cidrs: "true"
cluster-cidr: "${POD_CIDR}"
service-cluster-ip-range: "${SERVICE_CIDR}"
node-cidr-mask-size-ipv4: "${NODE_CIDR_MASK_SIZE4}"
node-cidr-mask-size-ipv6: "${NODE_CIDR_MASK_SIZE6}"
node-cidr-mask-size: "${NODE_CIDR_MASK_SIZE}"
- name: allocate-node-cidrs
value: "true"
- name: cluster-cidr
value: "${POD_CIDR}"
- name: service-cluster-ip-range
value: "${SERVICE_CIDR}"
- name: node-cidr-mask-size-ipv4
value: "${NODE_CIDR_MASK_SIZE4}"
- name: node-cidr-mask-size-ipv6
value: "${NODE_CIDR_MASK_SIZE6}"
- name: node-cidr-mask-size
value: "${NODE_CIDR_MASK_SIZE}"
etcd:
local:
dataDir: /var/lib/etcd
extraArgs:
# default is 16MB, use 10GB for tests
quota-backend-bytes: "10740000000"
auto-compaction-mode: "revision"
auto-compaction-retention: "10"
- name: quota-backend-bytes
value: "10740000000"
- name: auto-compaction-mode
value: "revision"
- name: auto-compaction-retention
value: "10"
imageRepository: k8s.gcr.io
kubernetesVersion: ${K8_VERSION}
networking:
Expand All @@ -56,14 +67,12 @@ apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
conntrack:
maxPerCore: 0
# featureGates:
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
maxPods: 100000
cgroupDriver: "cgroupfs"
maxPods: 5000
cgroupDriver: "systemd"
cpuManagerPolicy: "static"
reservedSystemCPUs: "0-5"
# featureGates:

containerRuntimeEndpoint: unix:///var/run/containerd/containerd.sock

50 changes: 29 additions & 21 deletions test/scripts/kubeadm/ClusterNewConfiguration.template.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: kubeadm.k8s.io/v1beta3
apiVersion: kubeadm.k8s.io/v1beta4
bootstrapTokens:
- groups:
- system:bootstrappers:kubeadm:default-node-token
Expand All @@ -17,37 +17,47 @@ nodeRegistration:
taints: null
name: "${NODE_NAME}"
kubeletExtraArgs:
node-ip: "${FIRST_NODE_IP}"
- name: node-ip
value: "${FIRST_NODE_IP}"
---
# https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/
apiVersion: kubeadm.k8s.io/v1beta3
apiVersion: kubeadm.k8s.io/v1beta4
kind: ClusterConfiguration
apiServer:
timeoutForControlPlane: 4m0s
extraArgs:
advertise-address: "${FIRST_NODE_IP}"
service-cluster-ip-range: "${SERVICE_CIDR}"
# feature-gates: ""
- name: advertise-address
value: "${FIRST_NODE_IP}"
- name: service-cluster-ip-range
value: "${SERVICE_CIDR}"
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
# https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/
controllerManager:
extraArgs:
# feature-gates: ""
allocate-node-cidrs: "true"
cluster-cidr: "${POD_CIDR}"
service-cluster-ip-range: "${SERVICE_CIDR}"
${DISABLE_NODE_CIDR_MASK_SIZE4}node-cidr-mask-size-ipv4: "${NODE_CIDR_MASK_SIZE4}"
${DISABLE_NODE_CIDR_MASK_SIZE6}node-cidr-mask-size-ipv6: "${NODE_CIDR_MASK_SIZE6}"
${DISABLE_NODE_CIDR_MASK}node-cidr-mask-size: "${NODE_CIDR_MASK_SIZE}"
- name: allocate-node-cidrs
value: "true"
- name: cluster-cidr
value: "${POD_CIDR}"
- name: service-cluster-ip-range
value: "${SERVICE_CIDR}"
${DISABLE_NODE_CIDR_MASK_SIZE4}- name: "node-cidr-mask-size-ipv4"
${DISABLE_NODE_CIDR_MASK_SIZE4} value: "${NODE_CIDR_MASK_SIZE4}"
${DISABLE_NODE_CIDR_MASK_SIZE6}- name: "node-cidr-mask-size-ipv6"
${DISABLE_NODE_CIDR_MASK_SIZE6} value: "${NODE_CIDR_MASK_SIZE6}"
${DISABLE_NODE_CIDR_MASK}- name: "node-cidr-mask-size"
${DISABLE_NODE_CIDR_MASK} value: "${NODE_CIDR_MASK_SIZE}"
etcd:
local:
dataDir: /var/lib/etcd
extraArgs:
# default is 16MB, use 10GB for tests
quota-backend-bytes: "10740000000"
auto-compaction-mode: "revision"
auto-compaction-retention: "10"
- name: quota-backend-bytes
value: "10740000000"
- name: auto-compaction-mode
value: "revision"
- name: auto-compaction-retention
value: "10"
imageRepository: registry.k8s.io
kubernetesVersion: ${K8_VERSION}
networking:
Expand All @@ -60,14 +70,12 @@ apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
conntrack:
maxPerCore: 0
# featureGates:
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
maxPods: 100000
cgroupDriver: "cgroupfs"
maxPods: 5000
cgroupDriver: "systemd"
cpuManagerPolicy: "static"
reservedSystemCPUs: "0-5"
# featureGates:

containerRuntimeEndpoint: unix:///var/run/containerd/containerd.sock

2 changes: 1 addition & 1 deletion test/scripts/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function raw_create_cluster_conf ()
export NODE_NAME=$NODE_NAME
export DNS_TYPE=$DNS_TYPE
export IS_DUAL=$IS_DUAL
export K8_VERSION=${K8_VERSION:=v1.26.0}
export K8_VERSION=${K8_VERSION:=v1.31.0}
cat $1 | envsubst | sudo tee /tmp/ClusterConf.yaml > /dev/null
}

Expand Down
4 changes: 2 additions & 2 deletions test/scripts/shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ function load_parameters () {
echo "with:"
echo "IF=eth0"
echo "NODESSH=hostname"
echo "K8_VERSION=v1.26.0"
echo "K8_VERSION=v1.31.0"
exit 1
fi
IF=${IF:=eth0}
K8_VERSION=${K8_VERSION:=v1.26.0}
K8_VERSION=${K8_VERSION:=v1.31.0}
if [[ $V = 6 ]]; then
POD_CIDR=fd20::0/112
SERVICE_CIDR=fd10::0/120
Expand Down
2 changes: 1 addition & 1 deletion yaml/overlays/dev/kustomize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function get_available_node_names ()

function get_node_addresses ()
{
kubectl get nodes $1 -o go-template --template='{{range .spec.podCIDRs}}{{printf "%s\n" .}}{{end}}'
kubectl get nodes $1 -o go-template --template='{{printf "%s\n" .spec.podCIDR}}'
}

function kustomize_parse_variables ()
Expand Down
Loading