Skip to content

Commit eae0264

Browse files
authored
Merge pull request #1863 from kube-logging/fix/long-generated-names
fix: long generated names
2 parents 5aea023 + 86b7406 commit eae0264

File tree

11 files changed

+222
-24
lines changed

11 files changed

+222
-24
lines changed

e2e/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
emperror.dev/errors v0.8.1
99
github.com/MakeNowJust/heredoc v1.0.0
1010
github.com/cisco-open/operator-tools v0.37.0
11-
github.com/kube-logging/logging-operator v0.0.0-20241111164118-39b50feafffc
11+
github.com/kube-logging/logging-operator v0.0.0-20241128102130-ba7491af4392
1212
github.com/kube-logging/logging-operator/pkg/sdk v0.11.0
1313
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.1
1414
github.com/spf13/cast v1.7.0
@@ -140,7 +140,7 @@ require (
140140
go.uber.org/multierr v1.11.0 // indirect
141141
go.uber.org/zap v1.27.0 // indirect
142142
golang.org/x/crypto v0.29.0 // indirect
143-
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
143+
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
144144
golang.org/x/net v0.31.0 // indirect
145145
golang.org/x/oauth2 v0.21.0 // indirect
146146
golang.org/x/sync v0.9.0 // indirect

e2e/go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
248248
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
249249
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
250250
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
251-
github.com/kube-logging/logging-operator v0.0.0-20241111164118-39b50feafffc h1:K4c1JvokFXQOlYZOKq/PvJv3ktySZJjmqcCND5/d7lg=
252-
github.com/kube-logging/logging-operator v0.0.0-20241111164118-39b50feafffc/go.mod h1:R43T4KfuV6KARLXIl6hY1i1iiWiFXg66P8sAFA3flmQ=
251+
github.com/kube-logging/logging-operator v0.0.0-20241128102130-ba7491af4392 h1:RGEDnOxUD0mRyCsD/BHGHaTKpl5F0Kyhrj7AUy/Aozk=
252+
github.com/kube-logging/logging-operator v0.0.0-20241128102130-ba7491af4392/go.mod h1:64PtXjPWhtJgKsKTeBX/ydykO8WCUKPe8M6iA3aqF4s=
253253
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
254254
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
255255
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw=
@@ -432,15 +432,15 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
432432
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
433433
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
434434
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
435-
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY=
436-
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8=
435+
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f h1:XdNn9LlyWAhLVp6P/i8QYBW+hlyhrhei9uErw2B5GJo=
436+
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:D5SMRVC3C2/4+F/DB1wZsLRnSNimn2Sp/NPsCrsv8ak=
437437
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
438438
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
439439
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
440440
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
441441
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
442-
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
443-
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
442+
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
443+
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
444444
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
445445
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
446446
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -495,8 +495,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn
495495
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
496496
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
497497
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
498-
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
499-
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
498+
golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
499+
golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
500500
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
501501
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
502502
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

pkg/resources/kubetool/utils.go

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,21 @@
1515
package kubetool
1616

1717
import (
18+
"crypto/sha256"
19+
"encoding/hex"
20+
"fmt"
21+
"regexp"
22+
"strings"
23+
"unicode"
24+
1825
batchv1 "k8s.io/api/batch/v1"
1926
corev1 "k8s.io/api/core/v1"
27+
"k8s.io/apimachinery/pkg/util/validation"
28+
)
29+
30+
const (
31+
maxNameLength = 50
32+
hashSuffixLen = 8
2033
)
2134

2235
func FindContainerByName(cnrs []corev1.Container, name string) *corev1.Container {
@@ -52,3 +65,62 @@ func FindVolumeMountByName(mnts []corev1.VolumeMount, name string) *corev1.Volum
5265
func JobSuccessfullyCompleted(job *batchv1.Job) bool {
5366
return job.Status.CompletionTime != nil && job.Status.Succeeded > 0
5467
}
68+
69+
// ValidateQualifiedName ensures the given name meets DNS-1123 label requirements
70+
// and handles long names by truncating and adding a unique hash suffix.
71+
func FixQualifiedNameIfInvalid(name string) string {
72+
// Check if the name is RFC 1123 compliant and within length limits
73+
errs := validation.IsDNS1123Label(name)
74+
// Remove max length error if present
75+
for i := range len(errs) {
76+
if errs[i] == validation.MaxLenError(validation.DNS1123LabelMaxLength) {
77+
errs = append(errs[:i], errs[i+1:]...)
78+
}
79+
}
80+
81+
// Sanitize the name if there are remaining validation errors
82+
if len(errs) > 0 {
83+
name = sanitizeName(name)
84+
}
85+
86+
// If the name is too long, truncate it and add a unique suffix
87+
if len(name) > maxNameLength {
88+
name = truncateName(name)
89+
}
90+
91+
return name
92+
}
93+
94+
// sanitizeName replaces invalid characters with hyphens and converts to lowercase
95+
func sanitizeName(name string) string {
96+
// Trim leading and trailing whitespaces and convert to lowercase
97+
trimmedName := strings.ToLower(strings.TrimSpace(name))
98+
99+
// Replace non-alphanumeric characters (except existing hyphens) with hyphens
100+
var sanitized strings.Builder
101+
for _, r := range trimmedName {
102+
if unicode.IsLetter(r) || unicode.IsNumber(r) || r == '-' {
103+
sanitized.WriteRune(r)
104+
} else {
105+
sanitized.WriteRune('-')
106+
}
107+
}
108+
109+
// Remove consecutive hyphens and trim leading and trailing ones aswell
110+
sanitizedName := strings.Trim(regexp.MustCompile(`-+`).ReplaceAllString(sanitized.String(), "-"), "-")
111+
112+
return sanitizedName
113+
}
114+
115+
func truncateName(name string) string {
116+
// Leave room for hyphen and hash suffix
117+
truncatedBase := name[:maxNameLength-hashSuffixLen-1]
118+
truncatedName := fmt.Sprintf("%s-%s", truncatedBase, generateUniqueSuffix(name))
119+
return truncatedName
120+
}
121+
122+
// generateUniqueSuffix creates a consistent hash suffix for name uniqueness
123+
func generateUniqueSuffix(name string) string {
124+
hash := sha256.Sum256([]byte(name))
125+
return hex.EncodeToString(hash[:])[:hashSuffixLen]
126+
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
// Copyright © 2019 Banzai Cloud
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package kubetool
16+
17+
import (
18+
"testing"
19+
20+
"github.com/stretchr/testify/assert"
21+
)
22+
23+
func TestFixQualifiedNameIfInvalid(t *testing.T) {
24+
tests := []struct {
25+
name string
26+
input string
27+
expected string
28+
}{
29+
{
30+
name: "Valid name within limits",
31+
input: "valid-name",
32+
expected: "valid-name",
33+
},
34+
{
35+
name: "Valid name at max length",
36+
input: "a-very-long-but-valid-name",
37+
expected: "a-very-long-but-valid-name",
38+
},
39+
{
40+
name: "Name with invalid characters",
41+
input: "^invalid$name%",
42+
expected: "invalid-name",
43+
},
44+
{
45+
name: "Name with uppercase letters",
46+
input: "UpperCaseName",
47+
expected: "uppercasename",
48+
},
49+
{
50+
name: "Name with leading and trailing spaces",
51+
input: " spaced-name ",
52+
expected: "spaced-name",
53+
},
54+
{
55+
name: "Name too long should be truncated",
56+
input: "a-really-long-name-that-exceeds-the-max-length-of-the-dns-label-standard-by-far",
57+
expected: "a-really-long-name-that-exceeds-the-max-l-", // Additionally some hash suffix will be added
58+
},
59+
{
60+
name: "Name with consecutive invalid characters",
61+
input: "invalid$$$name",
62+
expected: "invalid-name",
63+
},
64+
}
65+
66+
for _, tt := range tests {
67+
ttp := tt
68+
t.Run(ttp.name, func(t *testing.T) {
69+
result := FixQualifiedNameIfInvalid(ttp.input)
70+
if len(ttp.input) > maxNameLength {
71+
assert.Equal(t, ttp.expected, result[:maxNameLength-hashSuffixLen])
72+
}
73+
})
74+
}
75+
}
76+
77+
func TestSanitizeName(t *testing.T) {
78+
tests := []struct {
79+
name string
80+
input string
81+
expected string
82+
}{
83+
{
84+
name: "Name with special characters",
85+
input: "invalid$name",
86+
expected: "invalid-name",
87+
},
88+
{
89+
name: "Name with spaces and uppercases",
90+
input: " Upper Case Name ",
91+
expected: "upper-case-name",
92+
},
93+
{
94+
name: "Name with consecutive invalid characters",
95+
input: "name$$with***symbols",
96+
expected: "name-with-symbols",
97+
},
98+
}
99+
100+
for _, tt := range tests {
101+
t.Run(tt.name, func(t *testing.T) {
102+
assert.Equal(t, tt.expected, sanitizeName(tt.input))
103+
})
104+
}
105+
}

pkg/resources/nodeagent/nodeagent.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
"sigs.k8s.io/controller-runtime/pkg/reconcile"
3535

3636
"github.com/kube-logging/logging-operator/pkg/resources"
37+
"github.com/kube-logging/logging-operator/pkg/resources/kubetool"
3738
"github.com/kube-logging/logging-operator/pkg/resources/loggingdataprovider"
3839
"github.com/kube-logging/logging-operator/pkg/sdk/logging/api/v1beta1"
3940
)
@@ -397,10 +398,12 @@ func RegisterWatches(builder *builder.Builder) *builder.Builder {
397398

398399
// nodeAgent QualifiedName
399400
func (n *nodeAgentInstance) QualifiedName(name string) string {
400-
return fmt.Sprintf("%s-%s-%s", n.logging.Name, n.name, name)
401+
baseName := fmt.Sprintf("%s-%s-%s", n.logging.Name, n.name, name)
402+
return kubetool.FixQualifiedNameIfInvalid(baseName)
401403
}
402404

403405
// nodeAgent FluentdQualifiedName
404406
func (n *nodeAgentInstance) FluentdQualifiedName(name string) string {
405-
return fmt.Sprintf("%s-%s", n.logging.Name, name)
407+
baseName := fmt.Sprintf("%s-%s", n.logging.Name, name)
408+
return kubetool.FixQualifiedNameIfInvalid(baseName)
406409
}

pkg/sdk/go.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require (
1111
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
1212
github.com/cisco-open/operator-tools v0.37.0
1313
github.com/go-logr/zapr v1.3.0
14+
github.com/kube-logging/logging-operator v0.0.0-20241128102130-ba7491af4392
1415
github.com/onsi/ginkgo v1.16.5
1516
github.com/onsi/gomega v1.35.1
1617
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.1
@@ -48,22 +49,23 @@ require (
4849
github.com/imdario/mergo v0.3.16 // indirect
4950
github.com/josharian/intern v1.0.0 // indirect
5051
github.com/json-iterator/go v1.1.12 // indirect
52+
github.com/klauspost/compress v1.17.9 // indirect
5153
github.com/mailru/easyjson v0.7.7 // indirect
5254
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5355
github.com/modern-go/reflect2 v1.0.2 // indirect
5456
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
5557
github.com/nxadm/tail v1.4.8 // indirect
5658
github.com/pkg/errors v0.9.1 // indirect
5759
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
58-
github.com/prometheus/client_golang v1.19.1 // indirect
60+
github.com/prometheus/client_golang v1.20.5 // indirect
5961
github.com/prometheus/client_model v0.6.1 // indirect
6062
github.com/prometheus/common v0.55.0 // indirect
6163
github.com/prometheus/procfs v0.15.1 // indirect
6264
github.com/sergi/go-diff v1.2.0 // indirect
6365
github.com/spf13/pflag v1.0.5 // indirect
6466
github.com/x448/float16 v0.8.4 // indirect
6567
go.uber.org/multierr v1.11.0 // indirect
66-
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
68+
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
6769
golang.org/x/oauth2 v0.21.0 // indirect
6870
golang.org/x/sys v0.27.0 // indirect
6971
golang.org/x/term v0.26.0 // indirect

pkg/sdk/go.sum

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
8585
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
8686
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
8787
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
88+
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
89+
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
8890
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
8991
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
9092
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
@@ -93,6 +95,10 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
9395
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
9496
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
9597
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
98+
github.com/kube-logging/logging-operator v0.0.0-20241128102130-ba7491af4392 h1:RGEDnOxUD0mRyCsD/BHGHaTKpl5F0Kyhrj7AUy/Aozk=
99+
github.com/kube-logging/logging-operator v0.0.0-20241128102130-ba7491af4392/go.mod h1:64PtXjPWhtJgKsKTeBX/ydykO8WCUKPe8M6iA3aqF4s=
100+
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
101+
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
96102
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
97103
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
98104
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -122,8 +128,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
122128
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
123129
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.1 h1:Fm9Z+FabnB+6EoGq15j+pyLmaK6hYrYOpBlTzOLTQ+E=
124130
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.1/go.mod h1:SvsRXw4m1F2vk7HquU5h475bFpke27mIUswfyw9u3ug=
125-
github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE=
126-
github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho=
131+
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
132+
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
127133
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
128134
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
129135
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
@@ -164,8 +170,8 @@ go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
164170
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
165171
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
166172
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
167-
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
168-
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
173+
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f h1:XdNn9LlyWAhLVp6P/i8QYBW+hlyhrhei9uErw2B5GJo=
174+
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:D5SMRVC3C2/4+F/DB1wZsLRnSNimn2Sp/NPsCrsv8ak=
169175
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
170176
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
171177
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -206,8 +212,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
206212
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
207213
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
208214
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
209-
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
210-
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
215+
golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
216+
golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
211217
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
212218
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
213219
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
File renamed without changes.

pkg/sdk/logging/api/v1beta1/logging_types.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"fmt"
2020

2121
util "github.com/cisco-open/operator-tools/pkg/utils"
22+
"github.com/kube-logging/logging-operator/pkg/resources/kubetool"
2223
corev1 "k8s.io/api/core/v1"
2324
v1 "k8s.io/api/core/v1"
2425
"k8s.io/apimachinery/pkg/api/resource"
@@ -473,7 +474,8 @@ func (l *Logging) SetDefaultsOnCopy() (*Logging, error) {
473474

474475
// QualifiedName is the "logging-resource" name combined
475476
func (l *Logging) QualifiedName(name string) string {
476-
return fmt.Sprintf("%s-%s", l.Name, name)
477+
baseName := fmt.Sprintf("%s-%s", l.Name, name)
478+
return kubetool.FixQualifiedNameIfInvalid(baseName)
477479
}
478480

479481
// ClusterDomainAsSuffix formats the cluster domain as a suffix, e.g.:

pkg/sdk/logging/model/syslogng/config/go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@ require (
3939
github.com/imdario/mergo v0.3.16 // indirect
4040
github.com/josharian/intern v1.0.0 // indirect
4141
github.com/json-iterator/go v1.1.12 // indirect
42+
github.com/klauspost/compress v1.17.9 // indirect
43+
github.com/kube-logging/logging-operator v0.0.0-20241128102130-ba7491af4392 // indirect
4244
github.com/mailru/easyjson v0.7.7 // indirect
4345
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4446
github.com/modern-go/reflect2 v1.0.2 // indirect
4547
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
4648
github.com/pkg/errors v0.9.1 // indirect
4749
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
4850
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.1 // indirect
49-
github.com/prometheus/client_golang v1.19.1 // indirect
51+
github.com/prometheus/client_golang v1.20.5 // indirect
5052
github.com/prometheus/client_model v0.6.1 // indirect
5153
github.com/prometheus/common v0.55.0 // indirect
5254
github.com/prometheus/procfs v0.15.1 // indirect

0 commit comments

Comments
 (0)