diff --git a/api/bases/ovn.openstack.org_ovncontrollers.yaml b/api/bases/ovn.openstack.org_ovncontrollers.yaml index 9bcfb750..20446ac7 100644 --- a/api/bases/ovn.openstack.org_ovncontrollers.yaml +++ b/api/bases/ovn.openstack.org_ovncontrollers.yaml @@ -75,7 +75,7 @@ spec: networkAttachment: description: NetworkAttachment is a NetworkAttachment resource name to expose the service to the given network. If specified the IP - address of this network is used as the OvnEncapIP. + address of this network is used as the OVNEncapIP. type: string nicMappings: additionalProperties: diff --git a/api/v1beta1/common.go b/api/v1beta1/common.go index 54f70e7e..ce8b654f 100644 --- a/api/v1beta1/common.go +++ b/api/v1beta1/common.go @@ -22,23 +22,23 @@ import "github.com/openstack-k8s-operators/lib-common/modules/common/util" func SetupDefaults() { // Acquire environmental defaults and initialize OVNDBCluster defaults with them ovnDbClusterDefaults := OVNDBClusterDefaults{ - NBContainerImageURL: util.GetEnvVar("RELATED_IMAGE_OVN_NB_DBCLUSTER_IMAGE_URL_DEFAULT", OvnNBContainerImage), - SBContainerImageURL: util.GetEnvVar("RELATED_IMAGE_OVN_SB_DBCLUSTER_IMAGE_URL_DEFAULT", OvnSBContainerImage), + NBContainerImageURL: util.GetEnvVar("RELATED_IMAGE_OVN_NB_DBCLUSTER_IMAGE_URL_DEFAULT", OVNNBContainerImage), + SBContainerImageURL: util.GetEnvVar("RELATED_IMAGE_OVN_SB_DBCLUSTER_IMAGE_URL_DEFAULT", OVNSBContainerImage), } SetupOVNDBClusterDefaults(ovnDbClusterDefaults) // Acquire environmental defaults and initialize OVNNorthd defaults with them ovnNorthdDefaults := OVNNorthdDefaults{ - ContainerImageURL: util.GetEnvVar("RELATED_IMAGE_OVN_NORTHD_IMAGE_URL_DEFAULT", OvnNorthdContainerImage), + ContainerImageURL: util.GetEnvVar("RELATED_IMAGE_OVN_NORTHD_IMAGE_URL_DEFAULT", OVNNorthdContainerImage), } SetupOVNNorthdDefaults(ovnNorthdDefaults) // Acquire environmental defaults and initialize OVNController defaults with them - ovnControllerDefaults := OvnControllerDefaults{ - OvsContainerImageURL: util.GetEnvVar("RELATED_IMAGE_OVN_CONTROLLER_OVS_IMAGE_URL_DEFAULT", OvnControllerOvsContainerImage), - OvnControllerContainerImageURL: util.GetEnvVar("RELATED_IMAGE_OVN_CONTROLLER_IMAGE_URL_DEFAULT", OvnControllerContainerImage), + ovnControllerDefaults := OVNControllerDefaults{ + OVSContainerImageURL: util.GetEnvVar("RELATED_IMAGE_OVN_CONTROLLER_OVS_IMAGE_URL_DEFAULT", OVNControllerOVSContainerImage), + OVNControllerContainerImageURL: util.GetEnvVar("RELATED_IMAGE_OVN_CONTROLLER_IMAGE_URL_DEFAULT", OVNControllerContainerImage), } SetupOVNControllerDefaults(ovnControllerDefaults) diff --git a/api/v1beta1/ovncontroller_types.go b/api/v1beta1/ovncontroller_types.go index f6d66774..5e615a0b 100644 --- a/api/v1beta1/ovncontroller_types.go +++ b/api/v1beta1/ovncontroller_types.go @@ -25,21 +25,23 @@ import ( ) const ( - // OvnConfigHash - OvnConfigHash key - OvnConfigHash = "OvnConfigHash" + // OVNConfigHash - OVNConfigHash key + OVNConfigHash = "OvnConfigHash" // Container image fall-back defaults - // OvnControllerOvsContainerImage is the fall-back container image for OVNController ovs-* - OvnControllerOvsContainerImage = "quay.io/podified-antelope-centos9/openstack-ovn-base:current-podified" - // OvnControllerContainerImage is the fall-back container image for OVNController ovn-controller - OvnControllerContainerImage = "quay.io/podified-antelope-centos9/openstack-ovn-controller:current-podified" + // OVNControllerOVSContainerImage is the fall-back container image for OVNController ovs-* + OVNControllerOVSContainerImage = "quay.io/podified-antelope-centos9/openstack-ovn-base:current-podified" + // OVNControllerContainerImage is the fall-back container image for OVNController ovn-controller + OVNControllerContainerImage = "quay.io/podified-antelope-centos9/openstack-ovn-controller:current-podified" - // ServiceNameOvnController - ovn-controller service name + // ServiceNameOVNController - ovn-controller service name + ServiceNameOVNController = "ovn-controller" + // TODO: remove when all external consumers switch to ServiceNameOVNController ServiceNameOvnController = "ovn-controller" - // ServiceNameOvs - ovn-controller-ovs service name - ServiceNameOvs = "ovn-controller-ovs" + // ServiceNameOVS - ovn-controller-ovs service name + ServiceNameOVS = "ovn-controller-ovs" ) // OVNControllerSpec defines the desired state of OVNController @@ -76,7 +78,7 @@ type OVNControllerSpecCore struct { // +kubebuilder:validation:Optional // NetworkAttachment is a NetworkAttachment resource name to expose the service to the given network. - // If specified the IP address of this network is used as the OvnEncapIP. + // If specified the IP address of this network is used as the OVNEncapIP. NetworkAttachment string `json:"networkAttachment"` // +kubebuilder:validation:Optional diff --git a/api/v1beta1/ovncontroller_webhook.go b/api/v1beta1/ovncontroller_webhook.go index 72c5aeb4..b32dd2f3 100644 --- a/api/v1beta1/ovncontroller_webhook.go +++ b/api/v1beta1/ovncontroller_webhook.go @@ -24,19 +24,19 @@ import ( "sigs.k8s.io/controller-runtime/pkg/webhook/admission" ) -// OvnControllerDefaults - -type OvnControllerDefaults struct { - OvsContainerImageURL string - OvnControllerContainerImageURL string +// OVNControllerDefaults - +type OVNControllerDefaults struct { + OVSContainerImageURL string + OVNControllerContainerImageURL string } -var ovnDefaults OvnControllerDefaults +var ovnDefaults OVNControllerDefaults // log is for logging in this package. var ovncontrollerlog = logf.Log.WithName("ovncontroller-resource") // SetupOVNControllerDefaults - initialize OVNController spec defaults for use with either internal or external webhooks -func SetupOVNControllerDefaults(defaults OvnControllerDefaults) { +func SetupOVNControllerDefaults(defaults OVNControllerDefaults) { ovnDefaults = defaults ovncontrollerlog.Info("OVNController defaults initialized", "defaults", defaults) } @@ -61,10 +61,10 @@ func (r *OVNController) Default() { // Default - set defaults for this OVNController spec func (spec *OVNControllerSpec) Default() { if spec.OvsContainerImage == "" { - spec.OvsContainerImage = ovnDefaults.OvsContainerImageURL + spec.OvsContainerImage = ovnDefaults.OVSContainerImageURL } if spec.OvnContainerImage == "" { - spec.OvnContainerImage = ovnDefaults.OvnControllerContainerImageURL + spec.OvnContainerImage = ovnDefaults.OVNControllerContainerImageURL } spec.OVNControllerSpecCore.Default() } diff --git a/api/v1beta1/ovndbcluster_types.go b/api/v1beta1/ovndbcluster_types.go index 6202fb9b..91a31d61 100644 --- a/api/v1beta1/ovndbcluster_types.go +++ b/api/v1beta1/ovndbcluster_types.go @@ -45,10 +45,10 @@ const ( // Container image fall-back defaults - // OvnNBContainerImage is the fall-back container image for OVNDBCluster NB - OvnNBContainerImage = "quay.io/podified-antelope-centos9/openstack-ovn-nb-db-server:current-podified" - // OvnSBContainerImage is the fall-back container image for OVNDBCluster SB - OvnSBContainerImage = "quay.io/podified-antelope-centos9/openstack-ovn-sb-db-server:current-podified" + // OVNNBContainerImage is the fall-back container image for OVNDBCluster NB + OVNNBContainerImage = "quay.io/podified-antelope-centos9/openstack-ovn-nb-db-server:current-podified" + // OVNSBContainerImage is the fall-back container image for OVNDBCluster SB + OVNSBContainerImage = "quay.io/podified-antelope-centos9/openstack-ovn-sb-db-server:current-podified" ) // OVNDBClusterSpec defines the desired state of OVNDBCluster diff --git a/api/v1beta1/ovnnorthd_types.go b/api/v1beta1/ovnnorthd_types.go index fea660c8..5222692d 100644 --- a/api/v1beta1/ovnnorthd_types.go +++ b/api/v1beta1/ovnnorthd_types.go @@ -27,9 +27,11 @@ import ( const ( // Container image fall-back defaults - // OvnNorthdContainerImage is the fall-back container image for OVNNorthd - OvnNorthdContainerImage = "quay.io/podified-antelope-centos9/openstack-ovn-northd:current-podified" - // ServiceNameOvnNorthd - + // OVNNorthdContainerImage is the fall-back container image for OVNNorthd + OVNNorthdContainerImage = "quay.io/podified-antelope-centos9/openstack-ovn-northd:current-podified" + // ServiceNameOVNNorthd - + ServiceNameOVNNorthd = "ovn-northd" + // TODO: remove when all external consumers switch to ServiceNameOVNNorthd ServiceNameOvnNorthd = "ovn-northd" ) diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index ebb25d2c..dd193ae3 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -53,6 +53,21 @@ func (in *OVNController) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OVNControllerDefaults) DeepCopyInto(out *OVNControllerDefaults) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OVNControllerDefaults. +func (in *OVNControllerDefaults) DeepCopy() *OVNControllerDefaults { + if in == nil { + return nil + } + out := new(OVNControllerDefaults) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OVNControllerList) DeepCopyInto(out *OVNControllerList) { *out = *in @@ -510,18 +525,3 @@ func (in *OVSExternalIDs) DeepCopy() *OVSExternalIDs { in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *OvnControllerDefaults) DeepCopyInto(out *OvnControllerDefaults) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OvnControllerDefaults. -func (in *OvnControllerDefaults) DeepCopy() *OvnControllerDefaults { - if in == nil { - return nil - } - out := new(OvnControllerDefaults) - in.DeepCopyInto(out) - return out -} diff --git a/config/crd/bases/ovn.openstack.org_ovncontrollers.yaml b/config/crd/bases/ovn.openstack.org_ovncontrollers.yaml index 9bcfb750..20446ac7 100644 --- a/config/crd/bases/ovn.openstack.org_ovncontrollers.yaml +++ b/config/crd/bases/ovn.openstack.org_ovncontrollers.yaml @@ -75,7 +75,7 @@ spec: networkAttachment: description: NetworkAttachment is a NetworkAttachment resource name to expose the service to the given network. If specified the IP - address of this network is used as the OvnEncapIP. + address of this network is used as the OVNEncapIP. type: string nicMappings: additionalProperties: diff --git a/controllers/ovncontroller_controller.go b/controllers/ovncontroller_controller.go index c98a35d5..c077fbf1 100644 --- a/controllers/ovncontroller_controller.go +++ b/controllers/ovncontroller_controller.go @@ -434,11 +434,11 @@ func (r *OVNControllerReconciler) reconcileNormal(ctx context.Context, instance // ovnServiceLabels := map[string]string{ - common.AppSelector: ovnv1.ServiceNameOvnController, + common.AppSelector: ovnv1.ServiceNameOVNController, } ovsServiceLabels := map[string]string{ - common.AppSelector: ovnv1.ServiceNameOvs, + common.AppSelector: ovnv1.ServiceNameOVS, } // Create additional Physical Network Attachments @@ -629,7 +629,7 @@ func (r *OVNControllerReconciler) reconcileNormal(ctx context.Context, instance return ctrl.Result{}, err } for _, jobDef := range jobsDef { - configHashKey := ovnv1.OvnConfigHash + "-" + jobDef.Spec.Template.Spec.NodeName + configHashKey := ovnv1.OVNConfigHash + "-" + jobDef.Spec.Template.Spec.NodeName configHash := instance.Status.Hash[configHashKey] configJob := job.NewJob( jobDef, @@ -684,13 +684,13 @@ func (r *OVNControllerReconciler) generateServiceConfigMaps( envVars *map[string]env.Setter, ) error { // Create/update configmaps from templates - cmLabels := labels.GetLabels(instance, labels.GetGroupLabel(ovnv1.ServiceNameOvnController), map[string]string{}) + cmLabels := labels.GetLabels(instance, labels.GetGroupLabel(ovnv1.ServiceNameOVNController), map[string]string{}) templateParameters := make(map[string]interface{}) if instance.Spec.NetworkAttachment != "" { - templateParameters["OvnEncapNIC"] = nad.GetNetworkIFName(instance.Spec.NetworkAttachment) + templateParameters["OVNEncapNIC"] = nad.GetNetworkIFName(instance.Spec.NetworkAttachment) } else { - templateParameters["OvnEncapNIC"] = "eth0" + templateParameters["OVNEncapNIC"] = "eth0" } cms := []util.Template{ // ScriptsConfigMap @@ -715,7 +715,7 @@ func (r *OVNControllerReconciler) generateExternalConfigMaps( envVars *map[string]env.Setter, ) error { // Create/update configmaps from templates - cmLabels := labels.GetLabels(instance, labels.GetGroupLabel(ovnv1.ServiceNameOvnController), map[string]string{}) + cmLabels := labels.GetLabels(instance, labels.GetGroupLabel(ovnv1.ServiceNameOVNController), map[string]string{}) externalEndpoint, err := sbCluster.GetExternalEndpoint() if err != nil { @@ -723,8 +723,8 @@ func (r *OVNControllerReconciler) generateExternalConfigMaps( } externalTemplateParameters := make(map[string]interface{}) - externalTemplateParameters["OvnRemote"] = externalEndpoint - externalTemplateParameters["OvnEncapType"] = instance.Spec.ExternalIDS.OvnEncapType + externalTemplateParameters["OVNRemote"] = externalEndpoint + externalTemplateParameters["OVNEncapType"] = instance.Spec.ExternalIDS.OvnEncapType cms := []util.Template{ // EDP ConfigMap diff --git a/controllers/ovnnorthd_controller.go b/controllers/ovnnorthd_controller.go index 6b3f9302..780595b9 100644 --- a/controllers/ovnnorthd_controller.go +++ b/controllers/ovnnorthd_controller.go @@ -316,7 +316,7 @@ func (r *OVNNorthdReconciler) reconcileNormal(ctx context.Context, instance *ovn // serviceLabels := map[string]string{ - common.AppSelector: ovnv1.ServiceNameOvnNorthd, + common.AppSelector: ovnv1.ServiceNameOVNNorthd, } // Handle service update diff --git a/pkg/ovncontroller/configjob.go b/pkg/ovncontroller/configjob.go index 931cc0ea..62879123 100644 --- a/pkg/ovncontroller/configjob.go +++ b/pkg/ovncontroller/configjob.go @@ -57,13 +57,13 @@ func ConfigJob( } envVars := map[string]env.Setter{} - envVars["OvnBridge"] = env.SetValue(instance.Spec.ExternalIDS.OvnBridge) - envVars["OvnRemote"] = env.SetValue(internalEndpoint) - envVars["OvnEncapType"] = env.SetValue(instance.Spec.ExternalIDS.OvnEncapType) - envVars["OvnAvailabilityZones"] = env.SetValue(strings.Join(instance.Spec.ExternalIDS.OvnAvailabilityZones, ":")) + envVars["OVNBridge"] = env.SetValue(instance.Spec.ExternalIDS.OvnBridge) + envVars["OVNRemote"] = env.SetValue(internalEndpoint) + envVars["OVNEncapType"] = env.SetValue(instance.Spec.ExternalIDS.OvnEncapType) + envVars["OVNAvailabilityZones"] = env.SetValue(strings.Join(instance.Spec.ExternalIDS.OvnAvailabilityZones, ":")) envVars["EnableChassisAsGateway"] = env.SetValue(fmt.Sprintf("%t", *instance.Spec.ExternalIDS.EnableChassisAsGateway)) envVars["PhysicalNetworks"] = env.SetValue(getPhysicalNetworks(instance)) - envVars["OvnHostName"] = EnvDownwardAPI("spec.nodeName") + envVars["OVNHostName"] = EnvDownwardAPI("spec.nodeName") for _, ovnPod := range ovnPods.Items { jobs = append( @@ -93,11 +93,11 @@ func ConfigJob( Privileged: &privileged, }, Env: env.MergeEnvs([]corev1.EnvVar{}, envVars), - VolumeMounts: GetOvnControllerVolumeMounts(), + VolumeMounts: GetOVNControllerVolumeMounts(), Resources: instance.Spec.Resources, }, }, - Volumes: GetOvnControllerVolumes(instance.Name, instance.Namespace), + Volumes: GetOVNControllerVolumes(instance.Name, instance.Namespace), NodeName: ovnPod.Spec.NodeName, }, }, diff --git a/pkg/ovncontroller/daemonset.go b/pkg/ovncontroller/daemonset.go index e22fdde0..dfb9e0f1 100644 --- a/pkg/ovncontroller/daemonset.go +++ b/pkg/ovncontroller/daemonset.go @@ -32,8 +32,8 @@ func CreateOVNDaemonSet( configHash string, labels map[string]string, ) *appsv1.DaemonSet { - volumes := GetOvnControllerVolumes(instance.Name, instance.Namespace) - mounts := GetOvnControllerVolumeMounts() + volumes := GetOVNControllerVolumes(instance.Name, instance.Namespace) + mounts := GetOVNControllerVolumeMounts() args := []string{ "ovn-controller --pidfile unix:/run/openvswitch/db.sock", @@ -47,8 +47,8 @@ func CreateOVNDaemonSet( KeyMount: ptr.To(ovn_common.OVNDbKeyPath), CaMount: ptr.To(ovn_common.OVNDbCaCertPath), } - volumes = append(volumes, svc.CreateVolume(ovnv1.ServiceNameOvnController)) - mounts = append(mounts, svc.CreateVolumeMounts(ovnv1.ServiceNameOvnController)...) + volumes = append(volumes, svc.CreateVolume(ovnv1.ServiceNameOVNController)) + mounts = append(mounts, svc.CreateVolumeMounts(ovnv1.ServiceNameOVNController)...) // add CA bundle if defined if instance.Spec.TLS.CaBundleSecretName != "" { @@ -100,7 +100,7 @@ func CreateOVNDaemonSet( daemonset := &appsv1.DaemonSet{ ObjectMeta: metav1.ObjectMeta{ - Name: ovnv1.ServiceNameOvnController, + Name: ovnv1.ServiceNameOVNController, Namespace: instance.Namespace, }, Spec: appsv1.DaemonSetSpec{ @@ -191,7 +191,7 @@ func CreateOVSDaemonSet( Privileged: &privileged, }, Env: env.MergeEnvs([]corev1.EnvVar{}, envVars), - VolumeMounts: GetOvsDbVolumeMounts(), + VolumeMounts: GetOVSDbVolumeMounts(), // TODO: consider the fact that resources are now double booked Resources: instance.Spec.Resources, LivenessProbe: ovsDbLivenessProbe, @@ -228,7 +228,7 @@ func CreateOVSDaemonSet( daemonset := &appsv1.DaemonSet{ ObjectMeta: metav1.ObjectMeta{ - Name: ovnv1.ServiceNameOvs, + Name: ovnv1.ServiceNameOVS, Namespace: instance.Namespace, }, Spec: appsv1.DaemonSetSpec{ @@ -242,7 +242,7 @@ func CreateOVSDaemonSet( Spec: corev1.PodSpec{ ServiceAccountName: instance.RbacResourceName(), Containers: containers, - Volumes: GetOvsVolumes(instance.Name, instance.Namespace), + Volumes: GetOVSVolumes(instance.Name, instance.Namespace), }, }, }, diff --git a/pkg/ovncontroller/utils.go b/pkg/ovncontroller/utils.go index 1275fb39..241d2f00 100644 --- a/pkg/ovncontroller/utils.go +++ b/pkg/ovncontroller/utils.go @@ -47,7 +47,7 @@ func getOVNControllerPods( Namespace: instance.Namespace, } client.MatchingLabels{ - "service": ovnv1.ServiceNameOvnController, + "service": ovnv1.ServiceNameOVNController, }.ApplyToList(podListOpts) if err := k8sClient.List(ctx, podList, podListOpts); err != nil { diff --git a/pkg/ovncontroller/volumes.go b/pkg/ovncontroller/volumes.go index a05df725..ee0129f1 100644 --- a/pkg/ovncontroller/volumes.go +++ b/pkg/ovncontroller/volumes.go @@ -6,8 +6,7 @@ import ( corev1 "k8s.io/api/core/v1" ) -// GetVolumes - -func GetOvnControllerVolumes(name string, namespace string) []corev1.Volume { +func GetOVNControllerVolumes(name string, namespace string) []corev1.Volume { var scriptsVolumeDefaultMode int32 = 0755 directoryOrCreate := corev1.HostPathDirectoryOrCreate @@ -83,8 +82,7 @@ func GetOvnControllerVolumes(name string, namespace string) []corev1.Volume { } -// GetVolumes - -func GetOvsVolumes(name string, namespace string) []corev1.Volume { +func GetOVSVolumes(name string, namespace string) []corev1.Volume { var scriptsVolumeDefaultMode int32 = 0755 directoryOrCreate := corev1.HostPathDirectoryOrCreate @@ -142,8 +140,8 @@ func GetOvsVolumes(name string, namespace string) []corev1.Volume { } -// GetOvsDbVolumeMounts - ovsdb-server VolumeMounts -func GetOvsDbVolumeMounts() []corev1.VolumeMount { +// GetOVSDbVolumeMounts - ovsdb-server VolumeMounts +func GetOVSDbVolumeMounts() []corev1.VolumeMount { return []corev1.VolumeMount{ { Name: "etc-ovs", @@ -199,8 +197,8 @@ func GetVswitchdVolumeMounts() []corev1.VolumeMount { } } -// GetOvnControllerVolumeMounts - ovn-controller VolumeMounts -func GetOvnControllerVolumeMounts() []corev1.VolumeMount { +// GetOVNControllerVolumeMounts - ovn-controller VolumeMounts +func GetOVNControllerVolumeMounts() []corev1.VolumeMount { return []corev1.VolumeMount{ { Name: "var-run", diff --git a/pkg/ovndbcluster/statefulset.go b/pkg/ovndbcluster/statefulset.go index 356b3389..d0838e84 100644 --- a/pkg/ovndbcluster/statefulset.go +++ b/pkg/ovndbcluster/statefulset.go @@ -31,8 +31,8 @@ const ( // ServiceCommand - ServiceCommand = "/usr/local/bin/container-scripts/setup.sh" - // PvcSuffixEtcOvn - - PvcSuffixEtcOvn = "-etc-ovn" + // PVCSuffixEtcOVN - + PVCSuffixEtcOVN = "-etc-ovn" ) // StatefulSet func @@ -95,7 +95,7 @@ func StatefulSet( // create Volume and VolumeMounts volumes := GetDBClusterVolumes(instance.Name) - volumeMounts := GetDBClusterVolumeMounts(instance.Name + PvcSuffixEtcOvn) + volumeMounts := GetDBClusterVolumeMounts(instance.Name + PVCSuffixEtcOVN) // add CA bundle if defined if instance.Spec.TLS.CaBundleSecretName != "" { @@ -181,7 +181,7 @@ func StatefulSet( statefulset.Spec.VolumeClaimTemplates = []corev1.PersistentVolumeClaim{ { ObjectMeta: metav1.ObjectMeta{ - Name: instance.Name + PvcSuffixEtcOvn, + Name: instance.Name + PVCSuffixEtcOVN, Namespace: instance.Namespace, Labels: labels, OwnerReferences: []metav1.OwnerReference{*ownerRef}, diff --git a/pkg/ovnnorthd/deployment.go b/pkg/ovnnorthd/deployment.go index 71c0fb9f..d353c497 100644 --- a/pkg/ovnnorthd/deployment.go +++ b/pkg/ovnnorthd/deployment.go @@ -81,8 +81,8 @@ func Deployment( KeyMount: ptr.To(ovn_common.OVNDbKeyPath), CaMount: ptr.To(ovn_common.OVNDbCaCertPath), } - volumes = append(volumes, svc.CreateVolume(ovnv1.ServiceNameOvnNorthd)) - volumeMounts = append(volumeMounts, svc.CreateVolumeMounts(ovnv1.ServiceNameOvnNorthd)...) + volumes = append(volumes, svc.CreateVolume(ovnv1.ServiceNameOVNNorthd)) + volumeMounts = append(volumeMounts, svc.CreateVolumeMounts(ovnv1.ServiceNameOVNNorthd)...) args = append(args, fmt.Sprintf("--certificate=%s", ovn_common.OVNDbCertPath), @@ -106,7 +106,7 @@ func Deployment( deployment := &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{ - Name: ovnv1.ServiceNameOvnNorthd, + Name: ovnv1.ServiceNameOVNNorthd, Namespace: instance.Namespace, }, Spec: appsv1.DeploymentSpec{ @@ -122,7 +122,7 @@ func Deployment( ServiceAccountName: instance.RbacResourceName(), Containers: []corev1.Container{ { - Name: ovnv1.ServiceNameOvnNorthd, + Name: ovnv1.ServiceNameOVNNorthd, Command: []string{cmd}, Args: args, Image: instance.Spec.ContainerImage, @@ -146,7 +146,7 @@ func Deployment( deployment.Spec.Template.Spec.Affinity = affinity.DistributePods( common.AppSelector, []string{ - ovnv1.ServiceNameOvnNorthd, + ovnv1.ServiceNameOVNNorthd, }, corev1.LabelHostname, ) diff --git a/templates/ovncontroller/bin/functions b/templates/ovncontroller/bin/functions index 1915edc3..c1a8a79c 100755 --- a/templates/ovncontroller/bin/functions +++ b/templates/ovncontroller/bin/functions @@ -15,13 +15,13 @@ # under the License. # Configs are obtained from ENV variables. -OvnBridge=${OvnBridge:-"br-int"} -OvnRemote=${OvnRemote:-"tcp:localhost:6642"} -OvnEncapType=${OvnEncapType:-"geneve"} -OvnAvailabilityZones=${OvnAvailabilityZones:-""} +OVNBridge=${OVNBridge:-"br-int"} +OVNRemote=${OVNRemote:-"tcp:localhost:6642"} +OVNEncapType=${OVNEncapType:-"geneve"} +OVNAvailabilityZones=${OVNAvailabilityZones:-""} EnableChassisAsGateway=${EnableChassisAsGateway:-true} PhysicalNetworks=${PhysicalNetworks:-""} -OvnHostName=${OvnHostName:-""} +OVNHostName=${OVNHostName:-""} function wait_for_ovsdb_server { while true; do @@ -29,7 +29,7 @@ function wait_for_ovsdb_server { if [ $? -eq 0 ]; then break else - echo "Ovsdb-server seems not be ready yet. Waiting..." + echo "ovsdb-server seems not be ready yet. Waiting..." sleep 1 fi done @@ -37,18 +37,18 @@ function wait_for_ovsdb_server { # configure external-ids in OVS function configure_external_ids { - ovs-vsctl set open . external-ids:ovn-bridge=${OvnBridge} - ovs-vsctl set open . external-ids:ovn-remote=${OvnRemote} - ovs-vsctl set open . external-ids:ovn-encap-type=${OvnEncapType} - if [ -n "$OvnHostName" ]; then - ovs-vsctl set open . external-ids:hostname=${OvnHostName} + ovs-vsctl set open . external-ids:ovn-bridge=${OVNBridge} + ovs-vsctl set open . external-ids:ovn-remote=${OVNRemote} + ovs-vsctl set open . external-ids:ovn-encap-type=${OVNEncapType} + if [ -n "$OVNHostName" ]; then + ovs-vsctl set open . external-ids:hostname=${OVNHostName} fi local cms_options="" if [ "$EnableChassisAsGateway" == "true" ]; then cms_options="enable-chassis-as-gw" fi - if [ -n "$OvnAvailabilityZones" ]; then - cms_options+=",availability-zones="$OvnAvailabilityZones + if [ -n "$OVNAvailabilityZones" ]; then + cms_options+=",availability-zones="$OVNAvailabilityZones fi if [ -n "${cms_options}" ]; then ovs-vsctl set open . external-ids:ovn-cms-options=${cms_options#,} @@ -64,16 +64,16 @@ function set_difference { # Configure bridge mappings and physical bridges function configure_physical_networks { - local OvnBridgeMappings="" + local OVNBridgeMappings="" local br_new="" for physicalNetwork in ${PhysicalNetworks}; do br_name="br-${physicalNetwork}" bridgeMapping="${physicalNetwork}:${br_name}" - if [ -z "$OvnBridgeMappings" ]; then - OvnBridgeMappings=$bridgeMapping + if [ -z "$OVNBridgeMappings" ]; then + OVNBridgeMappings=$bridgeMapping br_new=$br_name else - OvnBridgeMappings="${OvnBridgeMappings},${bridgeMapping}" + OVNBridgeMappings="${OVNBridgeMappings},${bridgeMapping}" br_new="${br_new} ${br_name}" fi done @@ -101,7 +101,7 @@ function configure_physical_networks { ovs-vsctl --may-exist add-port ${br_name} ${br_name#*-} done - # Delete the old bridges not longer present in "OvnBridgeMappings" and the + # Delete the old bridges not longer present in "OVNBridgeMappings" and the # patch ports in "br-int". for br_name in ${br_to_delete}; do # List all ports "type=patch", retrieve the "options:peer" parameter @@ -115,7 +115,7 @@ function configure_physical_networks { port_type=$(ovs-vsctl --column=type --bare list interface ${iface}) if [ "$port_type" == "patch" ]; then peer=$(ovs-vsctl get interface ${iface} options:peer) - ovs-vsctl --if-exists del-port ${OvnBridge} ${peer} + ovs-vsctl --if-exists del-port ${OVNBridge} ${peer} fi done ovs-vsctl --if-exists del-br ${br_name} @@ -123,8 +123,8 @@ function configure_physical_networks { done # Set or remove the local OVS Open vSwitch "external-ids:ovn-bridge-mappings" - if [ -n "$OvnBridgeMappings" ]; then - ovs-vsctl set open . external-ids:ovn-bridge-mappings=${OvnBridgeMappings} + if [ -n "$OVNBridgeMappings" ]; then + ovs-vsctl set open . external-ids:ovn-bridge-mappings=${OVNBridgeMappings} else ovs-vsctl --if-exists remove open . external_ids ovn-bridge-mappings fi diff --git a/templates/ovncontroller/bin/net_setup.sh b/templates/ovncontroller/bin/net_setup.sh index 635b620a..305200e4 100755 --- a/templates/ovncontroller/bin/net_setup.sh +++ b/templates/ovncontroller/bin/net_setup.sh @@ -14,11 +14,11 @@ # License for the specific language governing permissions and limitations # under the License. -OvnEncapIP=$(ip -o addr show dev {{ .OvnEncapNIC }} scope global | awk '{print $4}' | cut -d/ -f1) +OVNEncapIP=$(ip -o addr show dev {{ .OVNEncapNIC }} scope global | awk '{print $4}' | cut -d/ -f1) source $(dirname $0)/functions wait_for_ovsdb_server set -ex -ovs-vsctl --no-wait set open . external-ids:ovn-encap-ip=${OvnEncapIP} +ovs-vsctl --no-wait set open . external-ids:ovn-encap-ip=${OVNEncapIP} diff --git a/templates/ovncontroller/config/ovsdb-config b/templates/ovncontroller/config/ovsdb-config index bd30cb27..6b3b43bc 100644 --- a/templates/ovncontroller/config/ovsdb-config +++ b/templates/ovncontroller/config/ovsdb-config @@ -1,2 +1,2 @@ -ovn-remote: {{ .OvnRemote }} -ovn-encap-type: {{ .OvnEncapType }} +ovn-remote: {{ .OVNRemote }} +ovn-encap-type: {{ .OVNEncapType }}