Skip to content
Draft
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
66 changes: 66 additions & 0 deletions bindata/bootkube/bootstrap-manifests/etcd-member-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,69 @@ spec:
value: "/etc/ssl/etcd/ca.crt"
- name: "ETCDCTL_ENDPOINTS"
value: "https://localhost:2379"
- name: bootstrap-remover
image: {{ .Image }}
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- |
#!/bin/sh
set -euo pipefail

echo "Starting bootstrap remover..."

while true; do
# Get member list and check for bootstrap members
MEMBER_LIST=$(etcdctl member list 2>/dev/null || true)

if [ -z "$MEMBER_LIST" ]; then
echo "Unable to get member list, retrying..."
sleep 5
continue
fi

echo "Current member list:"
echo "$MEMBER_LIST"

# Check if any member contains "bootstrap" in the name
BOOTSTRAP_MEMBERS=$(echo "$MEMBER_LIST" | grep -i bootstrap || true)
if [ -z "$BOOTSTRAP_MEMBERS" ]; then
echo "No bootstrap member found in cluster"
break
else
echo "Bootstrap member still present:"
echo "$BOOTSTRAP_MEMBERS"
echo "Waiting 10 seconds before next check..."
sleep 10
fi
done

echo "Bootstrap member was removed, removing static pod now..."
# remove that members static pod
rm -f /etc/kubernetes/manifests/etcd-member-pod.yaml
echo "etcd static pod successfully removed"
resources:
requests:
memory: 60Mi
cpu: 10m
terminationMessagePolicy: FallbackToLogsOnError
securityContext:
privileged: true
volumeMounts:
Copy link
Contributor

@lance5890 lance5890 Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing volumeMounts points ?

-  name: certs

   mountPath: /etc/ssl/etcd/

- name: static-pod
mountPath: /etc/kubernetes/manifests
- name: certs
mountPath: /etc/ssl/etcd/
env:
- name: "ETCDCTL_KEY"
value: "/etc/ssl/etcd/etcd-all-certs/etcd-serving-{{ .Hostname }}.key"
- name: "ETCDCTL_CERT"
value: "/etc/ssl/etcd/etcd-all-certs/etcd-serving-{{ .Hostname }}.crt"
- name: "ETCDCTL_CACERT"
value: "/etc/ssl/etcd/ca.crt"
- name: "ETCDCTL_ENDPOINTS"
value: "https://localhost:2379"
Comment on lines +101 to +102
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has a bit of a logical fallacy, because when the member is removed, you won't be able to member list anymore and you won't notice the bootstrap member was removed from the list.

- name: etcd
image: {{ .Image }}
command:
Expand Down Expand Up @@ -89,6 +152,9 @@ spec:
- operator: "Exists"
restartPolicy: Always
volumes:
- name: static-pod
hostPath:
path: /etc/kubernetes/manifests
- name: certs
hostPath:
path: /etc/kubernetes/static-pod-resources/etcd-member
Expand Down