apiVersion: v1
data:
  configure-ovn.sh: |
    #!/bin/bash
    #
    # Copyright 2024 Red Hat Inc.
    #
    # Licensed under the Apache License, Version 2.0 (the "License"); you may
    # not use this file except in compliance with the License. You may obtain
    # a copy of the License at
    #
    #      http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS, 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.

    # This script configures OVN external-ids settings in OVS
    # It is used when ovn-encap-tos or ovn-remote-probe-interval are explicitly set to
    # a non-default value or when OVN or OVS log level values change.

    source $(dirname $0)/../container-scripts/functions

    OVNEncapTos=0
    OVNRemoteProbeInterval=60000
    OVSLogLevel=info
    OVNLogLevel=info

    function configure_ovn_external_ids {
        ovs-vsctl set open . external-ids:ovn-encap-tos=${OVNEncapTos}
        ovs-vsctl set open . external-ids:ovn-remote-probe-interval="${OVNRemoteProbeInterval}"
    }

    function configure_log_level {
        for svc in ovsdb-server ovs-vswitchd; do
            ctl_path=$(find /var/run/openvswitch/ -maxdepth 1 -name "${svc}.*.ctl")
            ovs-appctl -t ${ctl_path} vlog/set ${OVSLogLevel}
        done

        ctl_path=$(find /var/run/ovn/ -maxdepth 1 -name "ovn-controller.*.ctl")
        ovn-appctl -t "$ctl_path" vlog/set ${OVNLogLevel}
    }


    wait_for_ovsdb_server
    configure_ovn_external_ids
    configure_log_level
kind: ConfigMap
metadata:
  creationTimestamp: '2026-04-02T13:58:24Z'
  labels:
    ovn-controller.openstack.org/name: ovncontroller
    ovn-controller.openstack.org/namespace: openstack
    ovn-controller.openstack.org/uid: 2cbed795-1ec1-4ab8-b998-eaac8291b2d7
  name: ovncontroller-extra-scripts
  namespace: openstack
  ownerReferences:
  - apiVersion: ovn.openstack.org/v1beta1
    blockOwnerDeletion: true
    controller: true
    kind: OVNController
    name: ovncontroller
    uid: 2cbed795-1ec1-4ab8-b998-eaac8291b2d7
  resourceVersion: '40566'
  uid: 7e7a5abc-1448-4b26-b640-9062a26f8f38
