"And Joshua made them on that day hewers of wood and drawers of water for the congregation and for the altar of the LORD" (Joshua 9:27). Moses decreed concerning them for that generation, as it is written, "From the hewer of your wood to the drawer of your water" (Deuteronomy 29:10). You, Joshua, decreed concerning them for the time when the Temple stands, as it is written, "And Joshua made them on that day hewers of wood." David came and decreed concerning them for the time when the Temple does not stand, as it is written, "And the king called the Gibeonites; now the Gibeonites were not of the children of Israel" (2 Samuel 21:1-2). (This is written in remez 861.)
Three Leaders Who Decreed the Gibeonites' Servitude
Yalkut Shimoni on Nach 19:4
ויתנם יהושע ביום ההוא חוטבי עצים ושואבי מים לעדה ולמזבח ה' (יהושע ט, כז) משה גזר עליהם לההוא דרא דכתיב מחוטב עציך עד שואב מימיך. אתה יהושע גזר עליהם בזמן שבהמ"ק קיים דכתיב ויתנם יהושע ביום ההוא חוטבי עצים אתא דוד גזר עליהם בזמן שאין ב"ה קיים דכתיב ויקרא המלך לגבעונים והגבעונים לא מבני ישראל המה (כתוב ברמז תתרס"א):