Skip to content

Commit

Permalink
Merge pull request #3139 from HirazawaUi/rep-instance-config-tests
Browse files Browse the repository at this point in the history
replenish e2e test for kubelet instance config
  • Loading branch information
k8s-ci-robot authored Dec 30, 2024
2 parents 800617d + d227d40 commit cfc3ba8
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,36 @@ tasks:
exit 1;
}
exit 0
timeout: 5m
- name: check-and-add-flag
description: |
Check and add the container-runtime-endpoint flag to each node's kubeadm-flags.env file
cmd: /bin/bash
args:
- -c
- |
set -x
for node in control-plane-{1..3} worker-{1..2}; do
CMD="docker exec {{ .vars.clusterName }}-$node"
${CMD} bash -c '
FILE="/var/lib/kubelet/kubeadm-flags.env"
NEW_ARG="--container-runtime-endpoint=unix:///run/containerd/containerd.sock"
if grep -q "container-runtime-endpoint" "$FILE"; then
echo "flag container-runtime-endpoint already exists"
exit 1
fi
sed -i "/^KUBELET_KUBEADM_ARGS=/ s|\"$| $NEW_ARG\"|" "$FILE"
' || {
echo "Command failed for $node. Exiting.";
exit 1;
}
done
exit 0
timeout: 5m
- name: upgrade-again
Expand Down Expand Up @@ -257,6 +287,60 @@ tasks:
}
done
exit 0
timeout: 5m
- name: check-annotation-after-second-upgrade
description: |
Check that the cri-socket annotation does not exist on each node.
cmd: /bin/bash
args:
- -c
- |
set -x
docker exec {{ .vars.clusterName }}-control-plane-1 bash -c '
nodes=$(KUBECONFIG=/etc/kubernetes/admin.conf kubectl get nodes -o jsonpath='{.items[*].metadata.name}')
for node in $nodes; do
annotation=$(KUBECONFIG=/etc/kubernetes/admin.conf kubectl get node "$node" -o jsonpath="{.metadata.annotations['kubeadm\.alpha\.kubernetes\.io/cri-socket']}")
if [ -z "$annotation" ]; then
echo "Annotation not found on node $node"
else
echo "Annotation found on node $node: $annotation"
exit 1
fi
done
' || {
echo "Command failed for $node. Exiting.";
exit 1;
}
exit 0
timeout: 5m
- name: check-flag-after-second-upgrade
description: |
Check that the container-runtime-endpoint flag does not exist on each node.
cmd: /bin/bash
args:
- -c
- |
set -x
for node in control-plane-{1..3} worker-{1..2}; do
CMD="docker exec {{ .vars.clusterName }}-$node"
${CMD} bash -c '
if [[ -f "/var/lib/kubelet/kubeadm-flags.env" ]] && grep -q "container-runtime-endpoint" /var/lib/kubelet/kubeadm-flags.env; then
echo "File exists and contains 'container-runtime-endpoint' field."
exit 1
fi
' || {
echo "Command failed for $node. Exiting.";
exit 1;
}
done
exit 0
timeout: 5m
- name: cluster-info
Expand Down
84 changes: 84 additions & 0 deletions kinder/ci/workflows/instance-config-tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,36 @@ tasks:
exit 1;
}
exit 0
timeout: 5m
- name: check-and-add-flag
description: |
Check and add the container-runtime-endpoint flag to each node's kubeadm-flags.env file
cmd: /bin/bash
args:
- -c
- |
set -x
for node in control-plane-{1..3} worker-{1..2}; do
CMD="docker exec {{ .vars.clusterName }}-$node"
${CMD} bash -c '
FILE="/var/lib/kubelet/kubeadm-flags.env"
NEW_ARG="--container-runtime-endpoint=unix:///run/containerd/containerd.sock"
if grep -q "container-runtime-endpoint" "$FILE"; then
echo "flag container-runtime-endpoint already exists"
exit 1
fi
sed -i "/^KUBELET_KUBEADM_ARGS=/ s|\"$| $NEW_ARG\"|" "$FILE"
' || {
echo "Command failed for $node. Exiting.";
exit 1;
}
done
exit 0
timeout: 5m
- name: upgrade-again
Expand Down Expand Up @@ -258,6 +288,60 @@ tasks:
}
done
exit 0
timeout: 5m
- name: check-annotation-after-second-upgrade
description: |
Check that the cri-socket annotation does not exist on each node.
cmd: /bin/bash
args:
- -c
- |
set -x
docker exec {{ .vars.clusterName }}-control-plane-1 bash -c '
nodes=$(KUBECONFIG=/etc/kubernetes/admin.conf kubectl get nodes -o jsonpath='{.items[*].metadata.name}')
for node in $nodes; do
annotation=$(KUBECONFIG=/etc/kubernetes/admin.conf kubectl get node "$node" -o jsonpath="{.metadata.annotations['kubeadm\.alpha\.kubernetes\.io/cri-socket']}")
if [ -z "$annotation" ]; then
echo "Annotation not found on node $node"
else
echo "Annotation found on node $node: $annotation"
exit 1
fi
done
' || {
echo "Command failed for $node. Exiting.";
exit 1;
}
exit 0
timeout: 5m
- name: check-flag-after-second-upgrade
description: |
Check that the container-runtime-endpoint flag does not exist on each node.
cmd: /bin/bash
args:
- -c
- |
set -x
for node in control-plane-{1..3} worker-{1..2}; do
CMD="docker exec {{ .vars.clusterName }}-$node"
${CMD} bash -c '
if [[ -f "/var/lib/kubelet/kubeadm-flags.env" ]] && grep -q "container-runtime-endpoint" /var/lib/kubelet/kubeadm-flags.env; then
echo "File exists and contains 'container-runtime-endpoint' field."
exit 1
fi
' || {
echo "Command failed for $node. Exiting.";
exit 1;
}
done
exit 0
timeout: 5m
- name: cluster-info
Expand Down

0 comments on commit cfc3ba8

Please sign in to comment.