Skip to content

Commit

Permalink
Merge pull request #1863 from kube-logging/fix/long-generated-names
Browse files Browse the repository at this point in the history
fix: long generated names
  • Loading branch information
csatib02 authored Nov 28, 2024
2 parents 5aea023 + 86b7406 commit eae0264
Show file tree
Hide file tree
Showing 11 changed files with 222 additions and 24 deletions.
4 changes: 2 additions & 2 deletions e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
emperror.dev/errors v0.8.1
github.com/MakeNowJust/heredoc v1.0.0
github.com/cisco-open/operator-tools v0.37.0
github.com/kube-logging/logging-operator v0.0.0-20241111164118-39b50feafffc
github.com/kube-logging/logging-operator v0.0.0-20241128102130-ba7491af4392
github.com/kube-logging/logging-operator/pkg/sdk v0.11.0
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.1
github.com/spf13/cast v1.7.0
Expand Down Expand Up @@ -140,7 +140,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.29.0 // indirect
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.9.0 // indirect
Expand Down
16 changes: 8 additions & 8 deletions e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kube-logging/logging-operator v0.0.0-20241111164118-39b50feafffc h1:K4c1JvokFXQOlYZOKq/PvJv3ktySZJjmqcCND5/d7lg=
github.com/kube-logging/logging-operator v0.0.0-20241111164118-39b50feafffc/go.mod h1:R43T4KfuV6KARLXIl6hY1i1iiWiFXg66P8sAFA3flmQ=
github.com/kube-logging/logging-operator v0.0.0-20241128102130-ba7491af4392 h1:RGEDnOxUD0mRyCsD/BHGHaTKpl5F0Kyhrj7AUy/Aozk=
github.com/kube-logging/logging-operator v0.0.0-20241128102130-ba7491af4392/go.mod h1:64PtXjPWhtJgKsKTeBX/ydykO8WCUKPe8M6iA3aqF4s=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw=
Expand Down Expand Up @@ -432,15 +432,15 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY=
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8=
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f h1:XdNn9LlyWAhLVp6P/i8QYBW+hlyhrhei9uErw2B5GJo=
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:D5SMRVC3C2/4+F/DB1wZsLRnSNimn2Sp/NPsCrsv8ak=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -495,8 +495,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
72 changes: 72 additions & 0 deletions pkg/resources/kubetool/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,21 @@
package kubetool

import (
"crypto/sha256"
"encoding/hex"
"fmt"
"regexp"
"strings"
"unicode"

batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/validation"
)

const (
maxNameLength = 50
hashSuffixLen = 8
)

func FindContainerByName(cnrs []corev1.Container, name string) *corev1.Container {
Expand Down Expand Up @@ -52,3 +65,62 @@ func FindVolumeMountByName(mnts []corev1.VolumeMount, name string) *corev1.Volum
func JobSuccessfullyCompleted(job *batchv1.Job) bool {
return job.Status.CompletionTime != nil && job.Status.Succeeded > 0
}

// ValidateQualifiedName ensures the given name meets DNS-1123 label requirements
// and handles long names by truncating and adding a unique hash suffix.
func FixQualifiedNameIfInvalid(name string) string {
// Check if the name is RFC 1123 compliant and within length limits
errs := validation.IsDNS1123Label(name)
// Remove max length error if present
for i := range len(errs) {
if errs[i] == validation.MaxLenError(validation.DNS1123LabelMaxLength) {
errs = append(errs[:i], errs[i+1:]...)
}
}

// Sanitize the name if there are remaining validation errors
if len(errs) > 0 {
name = sanitizeName(name)
}

// If the name is too long, truncate it and add a unique suffix
if len(name) > maxNameLength {
name = truncateName(name)
}

return name
}

// sanitizeName replaces invalid characters with hyphens and converts to lowercase
func sanitizeName(name string) string {
// Trim leading and trailing whitespaces and convert to lowercase
trimmedName := strings.ToLower(strings.TrimSpace(name))

// Replace non-alphanumeric characters (except existing hyphens) with hyphens
var sanitized strings.Builder
for _, r := range trimmedName {
if unicode.IsLetter(r) || unicode.IsNumber(r) || r == '-' {
sanitized.WriteRune(r)
} else {
sanitized.WriteRune('-')
}
}

// Remove consecutive hyphens and trim leading and trailing ones aswell
sanitizedName := strings.Trim(regexp.MustCompile(`-+`).ReplaceAllString(sanitized.String(), "-"), "-")

return sanitizedName
}

func truncateName(name string) string {
// Leave room for hyphen and hash suffix
truncatedBase := name[:maxNameLength-hashSuffixLen-1]
truncatedName := fmt.Sprintf("%s-%s", truncatedBase, generateUniqueSuffix(name))
return truncatedName
}

// generateUniqueSuffix creates a consistent hash suffix for name uniqueness
func generateUniqueSuffix(name string) string {
hash := sha256.Sum256([]byte(name))
return hex.EncodeToString(hash[:])[:hashSuffixLen]
}
105 changes: 105 additions & 0 deletions pkg/resources/kubetool/utils_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// Copyright © 2019 Banzai Cloud
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package kubetool

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestFixQualifiedNameIfInvalid(t *testing.T) {
tests := []struct {
name string
input string
expected string
}{
{
name: "Valid name within limits",
input: "valid-name",
expected: "valid-name",
},
{
name: "Valid name at max length",
input: "a-very-long-but-valid-name",
expected: "a-very-long-but-valid-name",
},
{
name: "Name with invalid characters",
input: "^invalid$name%",
expected: "invalid-name",
},
{
name: "Name with uppercase letters",
input: "UpperCaseName",
expected: "uppercasename",
},
{
name: "Name with leading and trailing spaces",
input: " spaced-name ",
expected: "spaced-name",
},
{
name: "Name too long should be truncated",
input: "a-really-long-name-that-exceeds-the-max-length-of-the-dns-label-standard-by-far",
expected: "a-really-long-name-that-exceeds-the-max-l-", // Additionally some hash suffix will be added
},
{
name: "Name with consecutive invalid characters",
input: "invalid$$$name",
expected: "invalid-name",
},
}

for _, tt := range tests {
ttp := tt
t.Run(ttp.name, func(t *testing.T) {
result := FixQualifiedNameIfInvalid(ttp.input)
if len(ttp.input) > maxNameLength {
assert.Equal(t, ttp.expected, result[:maxNameLength-hashSuffixLen])
}
})
}
}

func TestSanitizeName(t *testing.T) {
tests := []struct {
name string
input string
expected string
}{
{
name: "Name with special characters",
input: "invalid$name",
expected: "invalid-name",
},
{
name: "Name with spaces and uppercases",
input: " Upper Case Name ",
expected: "upper-case-name",
},
{
name: "Name with consecutive invalid characters",
input: "name$$with***symbols",
expected: "name-with-symbols",
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert.Equal(t, tt.expected, sanitizeName(tt.input))
})
}
}
7 changes: 5 additions & 2 deletions pkg/resources/nodeagent/nodeagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"

"github.com/kube-logging/logging-operator/pkg/resources"
"github.com/kube-logging/logging-operator/pkg/resources/kubetool"
"github.com/kube-logging/logging-operator/pkg/resources/loggingdataprovider"
"github.com/kube-logging/logging-operator/pkg/sdk/logging/api/v1beta1"
)
Expand Down Expand Up @@ -397,10 +398,12 @@ func RegisterWatches(builder *builder.Builder) *builder.Builder {

// nodeAgent QualifiedName
func (n *nodeAgentInstance) QualifiedName(name string) string {
return fmt.Sprintf("%s-%s-%s", n.logging.Name, n.name, name)
baseName := fmt.Sprintf("%s-%s-%s", n.logging.Name, n.name, name)
return kubetool.FixQualifiedNameIfInvalid(baseName)
}

// nodeAgent FluentdQualifiedName
func (n *nodeAgentInstance) FluentdQualifiedName(name string) string {
return fmt.Sprintf("%s-%s", n.logging.Name, name)
baseName := fmt.Sprintf("%s-%s", n.logging.Name, name)
return kubetool.FixQualifiedNameIfInvalid(baseName)
}
6 changes: 4 additions & 2 deletions pkg/sdk/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
github.com/cisco-open/operator-tools v0.37.0
github.com/go-logr/zapr v1.3.0
github.com/kube-logging/logging-operator v0.0.0-20241128102130-ba7491af4392
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.35.1
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.1
Expand Down Expand Up @@ -48,22 +49,23 @@ require (
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_golang v1.20.5 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.26.0 // indirect
Expand Down
18 changes: 12 additions & 6 deletions pkg/sdk/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
Expand All @@ -93,6 +95,10 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kube-logging/logging-operator v0.0.0-20241128102130-ba7491af4392 h1:RGEDnOxUD0mRyCsD/BHGHaTKpl5F0Kyhrj7AUy/Aozk=
github.com/kube-logging/logging-operator v0.0.0-20241128102130-ba7491af4392/go.mod h1:64PtXjPWhtJgKsKTeBX/ydykO8WCUKPe8M6iA3aqF4s=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand Down Expand Up @@ -122,8 +128,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.1 h1:Fm9Z+FabnB+6EoGq15j+pyLmaK6hYrYOpBlTzOLTQ+E=
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.1/go.mod h1:SvsRXw4m1F2vk7HquU5h475bFpke27mIUswfyw9u3ug=
github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE=
github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho=
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
Expand Down Expand Up @@ -164,8 +170,8 @@ go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f h1:XdNn9LlyWAhLVp6P/i8QYBW+hlyhrhei9uErw2B5GJo=
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:D5SMRVC3C2/4+F/DB1wZsLRnSNimn2Sp/NPsCrsv8ak=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -206,8 +212,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
4 changes: 3 additions & 1 deletion pkg/sdk/logging/api/v1beta1/logging_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"

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

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

// ClusterDomainAsSuffix formats the cluster domain as a suffix, e.g.:
Expand Down
4 changes: 3 additions & 1 deletion pkg/sdk/logging/model/syslogng/config/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ require (
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/kube-logging/logging-operator v0.0.0-20241128102130-ba7491af4392 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.78.1 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_golang v1.20.5 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
Expand Down
Loading

0 comments on commit eae0264

Please sign in to comment.