Answering the first question. The Chern-Simons functional expressed in terms of the vector potential $A$:
$S(A) = \frac{k}{8 \pi^2} \int_M tr(A \wedge dA + \frac{2}{3} A \wedge A \wedge A )$
is well defined only for a trivial principal bundle, because in this case the gauge connection is
a Lie algebra one form over $M$. When $M$ is an oriented three manifold and the gauge group $G$ is compact connected and
simply connected, then every $G-$ bundle over $M$ is trivializable (see, for example the following article by D. Freed)
The case when the principal bundle is not trivial (for example when the above restrictions on the
gauge group are not satisfied) was treated by Dijgraaf and Witten
, using the standard construction by Witten: One can choose a 4-manifold $B$ such that $M$ is its boundary.
The CS action is defined:
$S(A) = \frac{k}{8 \pi^2} \int_B tr(F \wedge F)$
This action is the proper definition of the CS action for the following two reasons
It reduces to the usual CS action when the bundle is trivial (Using Stoke's theorem).
If k is an integer, the general form is independent modulo 1 of the extension $B$ of $M$.