示例#1
0
 def __init__(self):
     self.event_queue = queue.PriorityQueue()
     if config.get_option('ovn_mode') == "overlay":
         self.mode = ovn_k8s.modes.overlay.OvnNB()
     else:
         vlog.emer("OVN mode not defined.")
         sys.exit(1)
示例#2
0
 def __init__(self):
     self.event_queue = queue.Queue()
     if config.get_option('ovn_mode') == "overlay":
         self.mode = ovn_k8s.modes.overlay.OvnNB()
     else:
         vlog.emer("OVN mode not defined.")
         sys.exit(1)
示例#3
0
def _sync_k8s_services():
    if config.get_option('ovn_mode') == "overlay":
        mode = ovn_k8s.modes.overlay.OvnNB()
    else:
        return

    try:
        services = kubernetes.get_all_services(variables.K8S_API_SERVER)
        if services:
            mode.sync_services(services)
    except Exception as e:
        vlog.exception("failed in _sync_k8s_services (%s)" % (str(e)))
示例#4
0
def _sync_k8s_services():
    if config.get_option('ovn_mode') == "overlay":
        mode = ovn_k8s.modes.overlay.OvnNB()
    else:
        return

    try:
        services = kubernetes.get_all_services(variables.K8S_API_SERVER)
        if services:
            mode.sync_services(services)
    except Exception as e:
        vlog.exception("failed in _sync_k8s_services (%s)" % (str(e)))
示例#5
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import requests

import ovs.vlog

from os import path
from ovn_k8s.common import config
from ovn_k8s.common import exceptions
from ovn_k8s.common.util import ovs_vsctl
from ovn_k8s.common import variables

CA_CERTIFICATE = config.get_option('k8s_ca_certificate')
vlog = ovs.vlog.Vlog("kubernetes")


def _get_api_params():
    ca_certificate = None
    api_token = None
    if not variables.K8S_API_SERVER:
        k8s_api_server = ovs_vsctl("--if-exists", "get", "Open_vSwitch", ".",
                                   "external_ids:k8s-api-server").strip('"')
    else:
        k8s_api_server = variables.K8S_API_SERVER

    if k8s_api_server.startswith("https://"):
        if not path.isfile(CA_CERTIFICATE):
            vlog.info("Going to look for k8s-ca-certificate in OVSDB")
示例#6
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import requests

import ovs.vlog

from os import path
from ovn_k8s.common import config
from ovn_k8s.common import exceptions
from ovn_k8s.common.util import ovs_vsctl
from ovn_k8s.common import variables

CA_CERTIFICATE = config.get_option('k8s_ca_certificate')
vlog = ovs.vlog.Vlog("kubernetes")


def _get_api_params():
    ca_certificate = None
    api_token = None
    if not variables.K8S_API_SERVER:
        k8s_api_server = ovs_vsctl("--if-exists", "get", "Open_vSwitch", ".",
                                   "external_ids:k8s-api-server").strip('"')
    else:
        k8s_api_server = variables.K8S_API_SERVER

    if k8s_api_server.startswith("https://"):
        if not path.isfile(CA_CERTIFICATE):
            vlog.info("Going to look for k8s-ca-certificate in OVSDB")