File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,9 +101,10 @@ metadata:
101101 simple-volume.shipstuff.io/failover-grace-period: "1m"
102102` ` `
103103
104- When no healthy pod using the claim is running on a Ready node for the grace
105- period, the controller selects a ready replica node, patches the Deployment's
106- ` kubernetes.io/hostname` node selector, and deletes stale pods using the claim.
104+ When no healthy pod using the claim is running on a Ready, schedulable node for
105+ the grace period, the controller selects a ready replica node, patches the
106+ Deployment's `kubernetes.io/hostname` node selector, and deletes stale pods
107+ using the claim.
107108
108109# # Development
109110
Original file line number Diff line number Diff line change @@ -183,6 +183,9 @@ func failoverGracePeriod(pvc *corev1.PersistentVolumeClaim) time.Duration {
183183func readyNodeSet (nodes []corev1.Node ) map [string ]bool {
184184 out := make (map [string ]bool )
185185 for _ , node := range nodes {
186+ if node .Spec .Unschedulable {
187+ continue
188+ }
186189 for _ , condition := range node .Status .Conditions {
187190 if condition .Type == corev1 .NodeReady && condition .Status == corev1 .ConditionTrue {
188191 out [node .Name ] = true
Original file line number Diff line number Diff line change @@ -71,6 +71,18 @@ func TestFailoverControllerPatchesDeploymentAndDeletesStalePod(t *testing.T) {
7171 }
7272}
7373
74+ func TestReadyNodeSetExcludesUnschedulableNodes (t * testing.T ) {
75+ node := readyNode ("kapolei-pacific-1" , true )
76+ node .Spec .Unschedulable = true
77+ nodes := readyNodeSet ([]corev1.Node {* node , * readyNode ("sf-west-1" , true )})
78+ if nodes ["kapolei-pacific-1" ] {
79+ t .Fatal ("unschedulable ready node should be excluded" )
80+ }
81+ if ! nodes ["sf-west-1" ] {
82+ t .Fatal ("schedulable ready node should be included" )
83+ }
84+ }
85+
7486func deployment (name , namespace , node string ) * appsv1.Deployment {
7587 return & appsv1.Deployment {
7688 ObjectMeta : metav1.ObjectMeta {Name : name , Namespace : namespace },
You can’t perform that action at this time.
0 commit comments