Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions api/bases/ovn.openstack.org_ovncontrollers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,20 @@ spec:
description: Image used for the ovn-controller container (will be
set to environmental default if empty)
type: string
ovnLogLevel:
default: info
description: OVNLogLevel - Set log level off, emer, err, warn, info,
or dbg. Default is info.
type: string
ovsContainerImage:
description: Image used for the ovsdb-server and ovs-vswitchd containers
(will be set to environmental default if empty)
type: string
ovsLogLevel:
default: info
description: OVSLogLevel - Set log level off, emer, err, warn, info,
or dbg. Default is info.
type: string
resources:
description: |-
Resources - Compute Resources required by this service (Limits/Requests).
Expand Down
10 changes: 10 additions & 0 deletions api/v1beta1/ovncontroller_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ type OVNControllerSpecCore struct {
// If specified the IP address of this network is used as the OVNEncapIP.
NetworkAttachment string `json:"networkAttachment"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=info
// OVNLogLevel - Set log level off, emer, err, warn, info, or dbg. Default is info.
OVNLogLevel string `json:"ovnLogLevel,omitempty"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=info
// OVSLogLevel - Set log level off, emer, err, warn, info, or dbg. Default is info.
OVSLogLevel string `json:"ovsLogLevel,omitempty"`

// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
// TLS - Parameters related to TLS
Expand Down
10 changes: 10 additions & 0 deletions config/crd/bases/ovn.openstack.org_ovncontrollers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,20 @@ spec:
description: Image used for the ovn-controller container (will be
set to environmental default if empty)
type: string
ovnLogLevel:
default: info
description: OVNLogLevel - Set log level off, emer, err, warn, info,
or dbg. Default is info.
type: string
ovsContainerImage:
description: Image used for the ovsdb-server and ovs-vswitchd containers
(will be set to environmental default if empty)
type: string
ovsLogLevel:
default: info
description: OVSLogLevel - Set log level off, emer, err, warn, info,
or dbg. Default is info.
type: string
resources:
description: |-
Resources - Compute Resources required by this service (Limits/Requests).
Expand Down
2 changes: 2 additions & 0 deletions controllers/ovncontroller_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,8 @@ func (r *OVNControllerReconciler) generateServiceConfigMaps(
// Add additional ConfigMap for extra configuration scripts
extraScriptsTemplateParameters := make(map[string]any)
extraScriptsTemplateParameters["OVNEncapTos"] = instance.Spec.ExternalIDS.OvnEncapTos
extraScriptsTemplateParameters["OVSLogLevel"] = instance.Spec.OVSLogLevel
extraScriptsTemplateParameters["OVNLogLevel"] = instance.Spec.OVNLogLevel

extraCms := []util.Template{
{
Expand Down
2 changes: 2 additions & 0 deletions pkg/ovncontroller/configjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ func ConfigJob(
envVars["OVNAvailabilityZones"] = env.SetValue(strings.Join(instance.Spec.ExternalIDS.OvnAvailabilityZones, ":"))
envVars["PhysicalNetworks"] = env.SetValue(getPhysicalNetworks(instance))
envVars["OVNHostName"] = env.DownwardAPI("spec.nodeName")
envVars["OVNLogLevel"] = env.SetValue(instance.Spec.OVNLogLevel)
envVars["OVSLogLevel"] = env.SetValue(instance.Spec.OVSLogLevel)

for _, ovnPod := range ovnPods.Items {
commands := []string{
Expand Down
17 changes: 16 additions & 1 deletion templates/ovncontroller/config/configure-ovn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,30 @@
# under the License.

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

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

OVNEncapTos={{.OVNEncapTos}}
OVSLogLevel={{.OVSLogLevel}}
OVNLogLevel={{.OVNLogLevel}}

function configure_ovn_external_ids {
ovs-vsctl set open . external-ids:ovn-encap-tos=${OVNEncapTos}
}

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