Skip to content

Commit

Permalink
Merge pull request #497 from mgirgisf/OSPRH-10102-mgirgis-logging-ipaddr
Browse files Browse the repository at this point in the history
[OSPRH-10102] Remove Ipaddr field from logging
  • Loading branch information
openshift-merge-bot[bot] authored Oct 11, 2024
2 parents cc54e50 + 86279ee commit 47ad507
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 42 deletions.
4 changes: 0 additions & 4 deletions api/bases/telemetry.openstack.org_loggings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ spec:
description: CLONamespace points to the namespace where the cluster-logging-operator
is deployed
type: string
ipaddr:
description: IPAddr is the address where the service will listen on
type: string
port:
default: 10514
description: Port is the port where the service will listen on
Expand All @@ -80,7 +77,6 @@ spec:
is listening
type: integer
required:
- ipaddr
- rsyslogQueueType
type: object
status:
Expand Down
5 changes: 0 additions & 5 deletions api/bases/telemetry.openstack.org_telemetries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,6 @@ spec:
description: Enabled - Whether OpenStack logging service should
be deployed and managed
type: boolean
ipaddr:
description: IPAddr is the address where the service will listen
on
type: string
port:
default: 10514
description: Port is the port where the service will listen on
Expand All @@ -570,7 +566,6 @@ spec:
is listening
type: integer
required:
- ipaddr
- rsyslogQueueType
type: object
metricStorage:
Expand Down
4 changes: 0 additions & 4 deletions api/v1beta1/logging_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ import (

// LoggingSpec defines the desired state of Logging
type LoggingSpec struct {
// IPAddr is the address where the service will listen on
// +kubebuilder:validation:Required
IPAddr string `json:"ipaddr"`

// Port is the port where the service will listen on
// +kubebuilder:validation:Optional
// +kubebuilder:default=10514
Expand Down
4 changes: 0 additions & 4 deletions config/crd/bases/telemetry.openstack.org_loggings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ spec:
description: CLONamespace points to the namespace where the cluster-logging-operator
is deployed
type: string
ipaddr:
description: IPAddr is the address where the service will listen on
type: string
port:
default: 10514
description: Port is the port where the service will listen on
Expand All @@ -80,7 +77,6 @@ spec:
is listening
type: integer
required:
- ipaddr
- rsyslogQueueType
type: object
status:
Expand Down
5 changes: 0 additions & 5 deletions config/crd/bases/telemetry.openstack.org_telemetries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,6 @@ spec:
description: Enabled - Whether OpenStack logging service should
be deployed and managed
type: boolean
ipaddr:
description: IPAddr is the address where the service will listen
on
type: string
port:
default: 10514
description: Port is the port where the service will listen on
Expand All @@ -570,7 +566,6 @@ spec:
is listening
type: integer
required:
- ipaddr
- rsyslogQueueType
type: object
metricStorage:
Expand Down
36 changes: 18 additions & 18 deletions controllers/logging_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,25 +202,9 @@ func (r *LoggingReconciler) reconcileNormal(ctx context.Context, instance *telem
}

instance.Status.Conditions.MarkTrue(condition.InputReadyCondition, condition.InputReadyMessage)

// Secret
secretVars := make(map[string]env.Setter)

//
// create Secret required for logging-compute input
// - %-config secret holding minimal logging config required to get the service up, user can add additional files to be added to the service
//
err = r.generateComputeServiceConfig(ctx, helper, instance, &secretVars)
if err != nil {
instance.Status.Conditions.Set(condition.FalseCondition(
condition.ServiceConfigReadyCondition,
condition.ErrorReason,
condition.SeverityWarning,
condition.ServiceConfigReadyErrorMessage,
err.Error()))
return ctrl.Result{}, err
}

//
// create hash over all the different input resources to identify if any those changed
// and a restart/recreate is required.
Expand Down Expand Up @@ -248,7 +232,7 @@ func (r *LoggingReconciler) reconcileNormal(ctx context.Context, instance *telem
common.AppSelector: logging.ServiceName,
}

_, _, err = logging.Service(instance, helper, serviceLabels)
svc, _, err := logging.Service(instance, helper, serviceLabels)
if err != nil {
if k8s_errors.IsNotFound(err) {
instance.Status.Conditions.MarkFalse(telemetryv1.LoggingCLONamespaceReadyCondition,
Expand All @@ -262,6 +246,21 @@ func (r *LoggingReconciler) reconcileNormal(ctx context.Context, instance *telem
}
instance.Status.Conditions.MarkTrue(telemetryv1.LoggingCLONamespaceReadyCondition, condition.ReadyMessage)

//
// create Secret required for logging-compute input
// - %-config secret holding minimal logging config required to get the service up, user can add additional files to be added to the service
//
err = r.generateComputeServiceConfig(ctx, helper, instance, &secretVars, svc)
if err != nil {
instance.Status.Conditions.Set(condition.FalseCondition(
condition.ServiceConfigReadyCondition,
condition.ErrorReason,
condition.SeverityWarning,
condition.ServiceConfigReadyErrorMessage,
err.Error()))
return ctrl.Result{}, err
}

// Operators cannot own objects in different namespaces
/*err := controllerutil.SetControllerReference(instance, service, r.Scheme)
if err != nil {
Expand All @@ -281,6 +280,7 @@ func (r *LoggingReconciler) generateComputeServiceConfig(
h *helper.Helper,
instance *telemetryv1.Logging,
envVars *map[string]env.Setter,
service *corev1.Service,
) error {

secretLabels := labels.GetLabels(instance, labels.GetGroupLabel(ceilometer.ComputeServiceName), map[string]string{})
Expand All @@ -290,7 +290,7 @@ func (r *LoggingReconciler) generateComputeServiceConfig(
}

templateParameters := map[string]interface{}{
"RsyslogAddress": instance.Spec.IPAddr,
"RsyslogAddress": service.Annotations["metallb.universe.tf/loadBalancerIPs"],
"RsyslogPort": instance.Spec.Port,
"RsyslogRetries": instance.Spec.RsyslogRetries,
"RsyslogQueueType": instance.Spec.RsyslogQueueType,
Expand Down
1 change: 0 additions & 1 deletion tests/kuttl/suites/default/tests/01-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ spec:
secret: osp-secret
logging:
enabled: false
ipaddr: 172.17.0.80
port: 10514
cloNamespace: openshift-logging
1 change: 0 additions & 1 deletion tests/kuttl/suites/logging/tests/00-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ kind: Logging
metadata:
name: telemetry-kuttl-logging
spec:
ipaddr: 172.17.0.80
port: 10514
cloNamespace: telemetry-kuttl-tests

0 comments on commit 47ad507

Please sign in to comment.