Preheat oven to 375°F and grease a medium baking dish with olive oil.
In a large skillet, heat olive oil over medium heat. Add diced onion and cook until softened, about 5 minutes.
Stir in garlic and cook for another minute until fragrant.
Add white beans, kale, cherry tomatoes, oregano, thyme, red pepper flakes, salt, and pepper. Stir and cook until kale wilts slightly.
Transfer the mixture to the prepared baking dish and sprinkle with Parmesan and mozzarella.
Bake uncovered for 20–25 minutes, or until the top is golden and bubbly.
Let it rest a few minutes before serving—it’s even better slightly cooled.