mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 13:44:05 -08:00
kubernetes ingress: adjust comment style
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
parent
50d506ef48
commit
b1bdde46c3
|
@ -220,9 +220,8 @@ func (i *Ingress) buildIngress(ingress ingressAdaptor) *targetgroup.Group {
|
||||||
}
|
}
|
||||||
|
|
||||||
// matchesHostnamePattern returns true if the host matches a wildcard DNS
|
// matchesHostnamePattern returns true if the host matches a wildcard DNS
|
||||||
// pattern or pattern and host are equal
|
// pattern or pattern and host are equal.
|
||||||
func matchesHostnamePattern(pattern, host string) bool {
|
func matchesHostnamePattern(pattern, host string) bool {
|
||||||
// check for exact match
|
|
||||||
if pattern == host {
|
if pattern == host {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -230,13 +229,13 @@ func matchesHostnamePattern(pattern, host string) bool {
|
||||||
patternParts := strings.Split(pattern, ".")
|
patternParts := strings.Split(pattern, ".")
|
||||||
hostParts := strings.Split(host, ".")
|
hostParts := strings.Split(host, ".")
|
||||||
|
|
||||||
// if they are not equal, we cna check if we need to match
|
// If the first element of the pattern is not a wildcard, give up.
|
||||||
// on a wildcard or else give up
|
|
||||||
if len(patternParts) == 0 || patternParts[0] != "*" {
|
if len(patternParts) == 0 || patternParts[0] != "*" {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// to get a valid wildcard match the parts will need to be the same length
|
// A wildcard match require the pattern to have the same length as the host
|
||||||
|
// path.
|
||||||
if len(patternParts) != len(hostParts) {
|
if len(patternParts) != len(hostParts) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,11 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/prometheus/common/model"
|
"github.com/prometheus/common/model"
|
||||||
"github.com/prometheus/prometheus/discovery/targetgroup"
|
|
||||||
|
|
||||||
v1 "k8s.io/api/networking/v1"
|
v1 "k8s.io/api/networking/v1"
|
||||||
"k8s.io/api/networking/v1beta1"
|
"k8s.io/api/networking/v1beta1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
|
"github.com/prometheus/prometheus/discovery/targetgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TLSMode int
|
type TLSMode int
|
||||||
|
|
Loading…
Reference in a new issue