Wasps often parasitise or eat caterpillars. Flowering members of the Apiaceae family (fennel, parsley, dill, coriander) attract small wasps to help control these voracious caterpillars, as does yarrow. Members of the Asteraceae family (chamomile, chrysanthemum) also do this job, and pyrethrum can be used as a repellent plant, or you can make a pyrethrum tea to use as an insecticide.
Mustard suits being planted with broccoli. Mustard plants trap and reduce nematodes and, if left to flower, encourage parasitoid wasps.
A clever example of tricking a pest is one that's used on the carrot rust fly. If you plant several rows of actively growing onions alongside your carrots, the smell of the onion masks the carrots, leaving the root vege unscathed. These pests fly at 45cm above the ground, so planting a taller barrier around your carrots will also work.
Rotating crops of the same family each year is a good idea to reduce pest issues, particularly soil-borne pests and disease. If you have problems with twisted, misshapen roots in your carrots and parsnips, nematodes (tiny eel worms) may be the culprits. A trial in the Netherlands involved planting a whole field with the marigold "Single Gold". When flowering, the marigolds were ploughed into the soil, resulting in a marked reduction in the pest.
If you wish to be a smart gardener, look at a bug invasion this year as a learning experience for next year. This is an important lesson in dealing with pests and disease in a sustainable way.
Note: Always spray in the evening to avoid affecting beneficial insects. Spraying is best done when there's no wind, and wear a mask and gloves even if you're using an organic spray.
The dirty (half) dozen and how to control them organically*:
Aphids: Easy to wash off plants by spraying with soapy dishwater. Encourage red ladybirds by planting alyssum, cosmos, marigold and the Apiaceae plants in your vege patch. Ladybird larvae will chomp up aphids and psyllids, as do Hoverfly larvae (plant phacelia and tansy to attract Hoverflies).
Green Vege (Stink) Bugs: These guys don't have many natural predators (understandably), although chooks can be trained to eat them. Try squashing stink bugs and you'll see the others drop out of the plant. At this point they're easy to catch. Plant pink-flowering cleome as a trap crop. Alternatively, spray directly with neem oil to reduce their ability to feed.
Passion Vine Hopper: Prune twiggy dead material from garden in winter (eggs appear as tiny bumps on twigs), then burn or hot compost. Spray insects directly with neem or pyrethrum if you already have an invasion.
Psyllids: An uninvited guest from the US discovered in NZ in 2006. Attacks the solanum family (potatoes, tomatoes). Looks like a tiny cicada when magnified. They suck sap and pass on bacteria which can infect the plant, causing yellow, stunted leaves and poor, bad-tasting crops. Disguise crops by interplanting; remove affected leaves and dispose of (in tied bags); spray insects on the underside of leaves with potassium soap (try soap-based Nature's Way Mite and Insect Spray). For more info click here.
White Cabbage Butterfly (caterpillar): Use fine netting to prevent butterflies laying eggs on brassicas (squash eggs on undersides of leaves first). Encourage predator wasps by planting daisies/chrysanthemums, flowering parsley/carrot plants. As a last resort, spray caterpillars with Dipel, which is a natural bacterium. If you use Derris Dust, avoid ingestion or inhalation.
Whitefly: Plant companions such as chamomile, geranium, marjoram and coriander as deterrents. Increase airflow around your plants. Spray undersides of leaves with potassium soap or neem; hang yellow sticky traps/indicators of infestation near affected plants (best early in season); introduce tiny parasitic wasp 'Encarcia formosa'. (Bioforce.net.nz has more.)
* Not all naturally-based sprays are acceptable on certified organic properties.