If your chord progression contains some out of key chords you can navigate through it by writing a melody that shifts between several keys  but a more listener-friendly (not to say singer-friendly) option is to construct a tune that simply avoids any notes that clash