Currently, we use the static_config file to configure the networking mode. But this has a problem of losing the configuration during an upgrade. The current idea is to store this config information in a file under /opt/couchbase/var/lib/couchbase/config directory and provide a REST API to toggle between the modes.
This API needs to be called on every node in the cluster to switch the mode. The API will fail if the cluster is initialized and has nodes that are configured using raw IP addresses. The reason for this is that if a node is configured with a raw IP address, then the cluster config will have keys that contain the raw IP address and this makes the transition impossible.