chore: add GroupChangeLog feature gate to fix es indexing cardinality
Signed-off-by: Daniel Brown <daniel.brown2@sainsburys.co.uk>
This commit is contained in:
parent
281d998261
commit
230b55fde5
2
go.mod
2
go.mod
|
@ -25,7 +25,7 @@ require (
|
|||
github.com/fluxcd/pkg/http/fetch v0.15.0
|
||||
github.com/fluxcd/pkg/kustomize v1.16.0
|
||||
github.com/fluxcd/pkg/runtime v0.53.1
|
||||
github.com/fluxcd/pkg/ssa v0.44.0
|
||||
github.com/fluxcd/pkg/ssa v0.45.1
|
||||
github.com/fluxcd/pkg/tar v0.11.0
|
||||
github.com/fluxcd/pkg/testserver v0.10.0
|
||||
github.com/fluxcd/source-controller/api v1.4.1
|
||||
|
|
4
go.sum
4
go.sum
|
@ -191,8 +191,8 @@ github.com/fluxcd/pkg/runtime v0.53.1 h1:S+QRSoiU+LH1sTvJLNvT1x3E5hBq/sjOsRHazA7
|
|||
github.com/fluxcd/pkg/runtime v0.53.1/go.mod h1:8vkIhS1AhkmjC98LRm5xM+CRG5KySFTXpJWk+ZdtT4I=
|
||||
github.com/fluxcd/pkg/sourceignore v0.11.0 h1:xzpYmc5/t/Ck+/DkJSX3r+VbahDRIAn5kbv04fynWUo=
|
||||
github.com/fluxcd/pkg/sourceignore v0.11.0/go.mod h1:ri2FvlzX8ep2iszOK5gF/riYq2TNgpVvsfJ2QY0dLWI=
|
||||
github.com/fluxcd/pkg/ssa v0.44.0 h1:FnINKo29HheKMkCTqfsY5y994ObLk09N1Ldb6MtBJ3c=
|
||||
github.com/fluxcd/pkg/ssa v0.44.0/go.mod h1:8Anf7XVZ0zxOve7HXbDaW1s0gfmP95ksJBlKfDYinhQ=
|
||||
github.com/fluxcd/pkg/ssa v0.45.1 h1:ISl84TJwRP/GuZXrKiR9Tf8JOnG5XFgtjcYoR4XQYf4=
|
||||
github.com/fluxcd/pkg/ssa v0.45.1/go.mod h1:8Anf7XVZ0zxOve7HXbDaW1s0gfmP95ksJBlKfDYinhQ=
|
||||
github.com/fluxcd/pkg/tar v0.11.0 h1:pjf/rzr6HNAPiuxT59mtba9tfBtdNiSQ/UqduG8vZ2I=
|
||||
github.com/fluxcd/pkg/tar v0.11.0/go.mod h1:+kiP25NqibWMpFWgizyPEMqnMJIux7bCgEy+4pfxyI4=
|
||||
github.com/fluxcd/pkg/testserver v0.10.0 h1:g5l6mX9GndovWXCTW9xCPbL6YQYgphwe4Ee6cuBmLcA=
|
||||
|
|
|
@ -104,6 +104,7 @@ type KustomizationReconciler struct {
|
|||
ConcurrentSSA int
|
||||
DisallowedFieldManagers []string
|
||||
StrictSubstitutions bool
|
||||
GroupChangeLog bool
|
||||
}
|
||||
|
||||
// KustomizationReconcilerOptions contains options for the KustomizationReconciler.
|
||||
|
@ -799,7 +800,11 @@ func (r *KustomizationReconciler) apply(ctx context.Context,
|
|||
if changeSet != nil && len(changeSet.Entries) > 0 {
|
||||
resultSet.Append(changeSet.Entries)
|
||||
|
||||
log.Info("server-side apply for cluster definitions completed", "output", changeSet.ToMap())
|
||||
if r.GroupChangeLog {
|
||||
log.Info("server-side apply for cluster definitions completed", "output", changeSet.ToGroupedMap())
|
||||
} else {
|
||||
log.Info("server-side apply for cluster definitions completed", "output", changeSet.ToMap())
|
||||
}
|
||||
for _, change := range changeSet.Entries {
|
||||
if HasChanged(change.Action) {
|
||||
changeSetLog.WriteString(change.String() + "\n")
|
||||
|
@ -825,7 +830,11 @@ func (r *KustomizationReconciler) apply(ctx context.Context,
|
|||
if changeSet != nil && len(changeSet.Entries) > 0 {
|
||||
resultSet.Append(changeSet.Entries)
|
||||
|
||||
log.Info("server-side apply for cluster class types completed", "output", changeSet.ToMap())
|
||||
if r.GroupChangeLog {
|
||||
log.Info("server-side apply for cluster definitions completed", "output", changeSet.ToGroupedMap())
|
||||
} else {
|
||||
log.Info("server-side apply for cluster class types completed", "output", changeSet.ToMap())
|
||||
}
|
||||
for _, change := range changeSet.Entries {
|
||||
if HasChanged(change.Action) {
|
||||
changeSetLog.WriteString(change.String() + "\n")
|
||||
|
@ -852,7 +861,11 @@ func (r *KustomizationReconciler) apply(ctx context.Context,
|
|||
if changeSet != nil && len(changeSet.Entries) > 0 {
|
||||
resultSet.Append(changeSet.Entries)
|
||||
|
||||
log.Info("server-side apply completed", "output", changeSet.ToMap(), "revision", revision)
|
||||
if r.GroupChangeLog {
|
||||
log.Info("server-side apply for cluster definitions completed", "output", changeSet.ToGroupedMap())
|
||||
} else {
|
||||
log.Info("server-side apply completed", "output", changeSet.ToMap(), "revision", revision)
|
||||
}
|
||||
for _, change := range changeSet.Entries {
|
||||
if HasChanged(change.Action) {
|
||||
changeSetLog.WriteString(change.String() + "\n")
|
||||
|
|
|
@ -44,6 +44,10 @@ const (
|
|||
// should fail if a variable without a default value is declared in files
|
||||
// but is missing from the input vars.
|
||||
StrictPostBuildSubstitutions = "StrictPostBuildSubstitutions"
|
||||
|
||||
// GroupChangelog controls groups kubernetes objects names on log output
|
||||
// reduces cardinality of logs when logging to elasticsearch
|
||||
GroupChangeLog = "GroupChangeLog"
|
||||
)
|
||||
|
||||
var features = map[string]bool{
|
||||
|
@ -59,6 +63,9 @@ var features = map[string]bool{
|
|||
// StrictPostBuildSubstitutions
|
||||
// opt-in from v1.3
|
||||
StrictPostBuildSubstitutions: false,
|
||||
// GroupChangeLog
|
||||
// opt-in from v1.5
|
||||
GroupChangeLog: false,
|
||||
}
|
||||
|
||||
// FeatureGates contains a list of all supported feature gates and
|
||||
|
|
7
main.go
7
main.go
|
@ -234,6 +234,12 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
groupChangeLog, err := features.Enabled(features.GroupChangeLog)
|
||||
if err != nil {
|
||||
setupLog.Error(err, "unable to check feature gate "+features.GroupChangeLog)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err = (&controller.KustomizationReconciler{
|
||||
ControllerName: controllerName,
|
||||
DefaultServiceAccount: defaultServiceAccount,
|
||||
|
@ -251,6 +257,7 @@ func main() {
|
|||
StatusPoller: polling.NewStatusPoller(mgr.GetClient(), mgr.GetRESTMapper(), pollingOpts),
|
||||
DisallowedFieldManagers: disallowedFieldManagers,
|
||||
StrictSubstitutions: strictSubstitutions,
|
||||
GroupChangeLog: groupChangeLog,
|
||||
}).SetupWithManager(ctx, mgr, controller.KustomizationReconcilerOptions{
|
||||
DependencyRequeueInterval: requeueDependency,
|
||||
HTTPRetry: httpRetry,
|
||||
|
|
Loading…
Reference in New Issue