Skip to content

Commit

Permalink
Merge pull request #2026 from syedriko/syedriko-master-lint
Browse files Browse the repository at this point in the history
Make lint happy
  • Loading branch information
openshift-merge-robot committed May 30, 2023
2 parents 4c38db0 + 93f387c commit 0082c89
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 23 deletions.
11 changes: 8 additions & 3 deletions bundle/manifests/logging.openshift.io_clusterlogforwarders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,14 @@ spec:
kafka`'
properties:
brokers:
description: Brokers specifies the list of brokers to register
in addition to the main output URL on initial connect
to enhance reliability.
description: Brokers specifies the list of broker endpoints
of a Kafka cluster. The list represents only the initial
set used by the collector's Kafka client for the first
connection only. The collector's Kafka client fetches
constantly an updated list from Kafka. These updates are
not reconciled back to the collector configuration. If
none provided the target URL from the OutputSpec is used
as fallback.
items:
type: string
type: array
Expand Down
11 changes: 8 additions & 3 deletions config/crd/bases/logging.openshift.io_clusterlogforwarders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,14 @@ spec:
kafka`'
properties:
brokers:
description: Brokers specifies the list of brokers to register
in addition to the main output URL on initial connect
to enhance reliability.
description: Brokers specifies the list of broker endpoints
of a Kafka cluster. The list represents only the initial
set used by the collector's Kafka client for the first
connection only. The collector's Kafka client fetches
constantly an updated list from Kafka. These updates are
not reconciled back to the collector configuration. If
none provided the target URL from the OutputSpec is used
as fallback.
items:
type: string
type: array
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func New(confHash, clusterID string, collectorSpec logging.CollectionSpec, secre

func (f *Factory) NewDaemonSet(namespace, name string, trustedCABundle *v1.ConfigMap, tlsProfileSpec configv1.TLSProfileSpec) *apps.DaemonSet {
podSpec := f.NewPodSpec(trustedCABundle, f.ForwarderSpec, f.ClusterID, f.TrustedCAHash, tlsProfileSpec)
ds := coreFactory.NewDaemonSet(name, namespace, constants.CollectorName, constants.CollectorName, string(f.CollectorSpec.Type), *podSpec, f.CommonLabelInitializer)
ds := coreFactory.NewDaemonSet(name, namespace, constants.CollectorName, constants.CollectorName, string(f.CollectorSpec.Type), *podSpec, f.CommonLabelInitializer)
return ds
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package clusterlogforwarder

import (
"fmt"
log "github.com/ViaQ/logerr/v2/log/static"
"github.com/openshift/cluster-logging-operator/apis/logging/v1"
"github.com/openshift/cluster-logging-operator/internal/url"
"strings"
"fmt"
log "github.com/ViaQ/logerr/v2/log/static"
"github.com/openshift/cluster-logging-operator/apis/logging/v1"
"github.com/openshift/cluster-logging-operator/internal/url"
"strings"
)

// validateUrlAccordingToTls validate that if Output has TLS configuration Output URL scheme must be secure e.g. https, tls etc
func validateUrlAccordingToTls(clf v1.ClusterLogForwarder) error {
for i, output := range clf.Spec.Outputs {
_, output := i, output // Don't bind range variable.
u, _ := url.Parse(output.URL)
scheme := strings.ToLower(u.Scheme)
if !url.IsTLSScheme(scheme) && (output.TLS != nil && (output.TLS.InsecureSkipVerify || output.TLS.TLSSecurityProfile != nil)) {
log.V(3).Info("validateUrlAccordingToTls failed", "reason", "URL not secure but output has TLS configuration parameters",
"output URL", output.URL, "output Name", output.Name)
return fmt.Errorf("URL not secure: %v, but output %s has TLS configuration parameters", u, output.Name)
}
}
return nil
for i, output := range clf.Spec.Outputs {
_, output := i, output // Don't bind range variable.
u, _ := url.Parse(output.URL)
scheme := strings.ToLower(u.Scheme)
if !url.IsTLSScheme(scheme) && (output.TLS != nil && (output.TLS.InsecureSkipVerify || output.TLS.TLSSecurityProfile != nil)) {
log.V(3).Info("validateUrlAccordingToTls failed", "reason", "URL not secure but output has TLS configuration parameters",
"output URL", output.URL, "output Name", output.Name)
return fmt.Errorf("URL not secure: %v, but output %s has TLS configuration parameters", u, output.Name)
}
}
return nil
}

0 comments on commit 0082c89

Please sign in to comment.