Skip to content

Conversation

leo8a
Copy link
Contributor

@leo8a leo8a commented Aug 21, 2025

Summary

This PR addresses validation issues in the cluster log forwarder configuration for kube-compare operations by implementing proper Kafka URL validation and fixing field ordering in pipeline definitions.

Problem

When doing cluster-compare directly against the kustomize-patched CRs, the following drift can be seen:

Cluster CR: observability.openshift.io/v1_ClusterLogForwarder_openshift-logging_instance
Reference File: optional/logging/clusterLogForwarder.yaml
Description:
  https://docs.redhat.com/en/documentation/openshift_container_platform/4.18/html/scalability_and_performance/telco-hub-ref-design-specs#telco-hub-logging_telco-hub
Diff Output: diff -u -N /tmp/MERGED-241708664/observability-openshift-io-v1_clusterlogforwarder_openshift-logging_instance /tmp/LIVE-1557509582/observability-openshift-io-v1_clusterlogforwarder_openshift-logging_instance
--- /tmp/MERGED-241708664/observability-openshift-io-v1_clusterlogforwarder_openshift-logging_instance  2025-08-21 13:05:43.317023933 +0200
+++ /tmp/LIVE-1557509582/observability-openshift-io-v1_clusterlogforwarder_openshift-logging_instance   2025-08-21 13:05:43.317023933 +0200
@@ -13,11 +13,13 @@
     type: openshiftLabels
   outputs:
   - kafka:
-      url: null
+      url: tcp://jumphost.inbound.bos2.lab:9092/logs
     name: hub-kafka-output
     type: kafka
   pipelines:
-  - inputRefs:
+  - filterRefs:
+    - telco-hub-labels
+    inputRefs:
     - audit
     - infrastructure
     name: telco-hub-logs

Changes Made

1. Enhanced Kafka URL Validation (metadata.yaml)

  • Added regex-based validation configuration for Kafka URL field in clusterLogForwarder.yaml
  • Configured inlineDiffFunc: regex for spec.outputs.0.kafka.url path to enable pattern-based comparison instead of exact string matching

2. Updated Kafka URL Pattern (clusterLogForwarder.yaml)

  • Replaced template placeholder {{ .kafka.url }} with regex pattern "^(tcp|http|https)://.*$"
  • This allows validation against any valid Kafka broker URL using TCP, HTTP, or HTTPS protocols

3. Fixed Pipeline Field Ordering

  • Restructured pipeline definition to follow correct field order:
    1. filterRefs (first - for log filtering)
    2. inputRefs (second - for log input types)
    3. name (third - pipeline identifier)
    4. outputRefs (fourth - output destinations)
  • Added conditional logic for filterRefs with fallback to default telco-hub-labels

Signed-off-by: Leonardo Ochoa-Aday lochoa@redhat.com

fix: improve Kafka URL validation and pipeline field ordering

- Add regex validation for Kafka URLs in kube-compare metadata
- Replace template placeholder with URL pattern validation
- Fix pipeline field ordering (filterRefs, inputRefs, name, outputRefs)
- Add conditional filterRefs logic with default fallback

Signed-off-by: Leonardo Ochoa-Aday lochoa@redhat.com
@openshift-ci openshift-ci bot requested review from fedepaol and yuvalk August 21, 2025 11:06
Copy link

openshift-ci bot commented Aug 21, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: leo8a
Once this PR has been reviewed and has the lgtm label, please assign lack for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

openshift-ci bot commented Aug 21, 2025

@leo8a: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/lintcheck a658abe link true /test lintcheck

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant