From 0b98b0a02b59c247eebd4fd47b1fc2facb18257e Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Thu, 7 Oct 2021 16:38:21 +0200 Subject: [PATCH] logs: make LoggingConfiguration an unversioned API Making the LoggingConfiguration part of the versioned component-base/config API had the theoretic advantage that components could have offered different configuration APIs with experimental features limited to alpha versions (for example, sanitization offered only in a v1alpha1.KubeletConfiguration). Some components could have decided to only use stable logging options. In practice, this wasn't done. Furthermore, we don't want different components to make different choices regarding which logging features they offer to users. It should always be the same everywhere, for the sake of consistency. This can be achieved with a saner Go API by dropping the distinction between internal and external LoggingConfiguration types. Different stability levels of indidividual fields have to be covered by documentation (done) and potentially feature gates (not currently done). Advantages: - everything related to logging is under component-base/logs; previously this was scattered across different packages and different files under "logs" (why some code was in logs/config.go vs. logs/options.go vs. logs/logs.go always confused me again and again when coming back to the code): - long-term config and command line API are clearly separated into the "api" package underneath that - logs/logs.go itself only deals with legacy global flags and logging configuration - removal of separate Go APIs like logs.BindLoggingFlags and logs.Options - LogRegistry becomes an implementation detail, with less code and less exported functionality (only registration needs to be exported, querying is internal) Kubernetes-commit: 1aceac797d404b4ac3b3d02fe43d495d1f645aba --- go.mod | 26 +++++++++++++------------- go.sum | 10 ---------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/go.mod b/go.mod index 5014ca3..93720b2 100644 --- a/go.mod +++ b/go.mod @@ -5,9 +5,9 @@ module k8s.io/kube-controller-manager go 1.18 require ( - k8s.io/apimachinery v0.0.0-20220614194717-c5be38573c73 - k8s.io/cloud-provider v0.0.0-20220614202259-6ea0e29b5fb2 - k8s.io/controller-manager v0.0.0-20220614202144-533be65d8cdf + k8s.io/apimachinery v0.0.0 + k8s.io/cloud-provider v0.0.0 + k8s.io/controller-manager v0.0.0 ) require ( @@ -17,12 +17,11 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/spf13/pflag v1.0.5 // indirect golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect golang.org/x/text v0.3.7 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - k8s.io/component-base v0.0.0-20220614195841-c528ad5e18a8 // indirect + k8s.io/component-base v0.0.0 // indirect k8s.io/klog/v2 v2.60.1 // indirect k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect @@ -30,12 +29,13 @@ require ( ) replace ( - k8s.io/api => k8s.io/api v0.0.0-20220614194928-60387f6ceb7c - k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20220614194717-c5be38573c73 - k8s.io/apiserver => k8s.io/apiserver v0.0.0-20220614200351-5e46aae63f47 - k8s.io/client-go => k8s.io/client-go v0.0.0-20220614195233-830d4c462418 - k8s.io/cloud-provider => k8s.io/cloud-provider v0.0.0-20220614202259-6ea0e29b5fb2 - k8s.io/component-base => k8s.io/component-base v0.0.0-20220614195841-c528ad5e18a8 - k8s.io/component-helpers => k8s.io/component-helpers v0.0.0-20220614195946-92e231fe1c01 - k8s.io/controller-manager => k8s.io/controller-manager v0.0.0-20220614202144-533be65d8cdf + k8s.io/api => ../api + k8s.io/apimachinery => ../apimachinery + k8s.io/apiserver => ../apiserver + k8s.io/client-go => ../client-go + k8s.io/cloud-provider => ../cloud-provider + k8s.io/component-base => ../component-base + k8s.io/component-helpers => ../component-helpers + k8s.io/controller-manager => ../controller-manager + k8s.io/kube-controller-manager => ../kube-controller-manager ) diff --git a/go.sum b/go.sum index 8cc664e..e46f68c 100644 --- a/go.sum +++ b/go.sum @@ -28,7 +28,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= @@ -72,15 +71,6 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -k8s.io/api v0.0.0-20220614194928-60387f6ceb7c h1:DC+Zvr6/68fhuaIy5pTL0W4bAhbrnZi4jxozgPQ6vp0= -k8s.io/apimachinery v0.0.0-20220614194717-c5be38573c73 h1:EBei3PXKAoJZbqTqFYcQVh/wJcgXA/X1w7m8tBDyi3s= -k8s.io/apimachinery v0.0.0-20220614194717-c5be38573c73/go.mod h1:iknpugsBdD8jeaGNZyi85Q334Mj3GFqi1SEHEEB/KQM= -k8s.io/cloud-provider v0.0.0-20220614202259-6ea0e29b5fb2 h1:ZPjz60Gjr3Ula21nawKKGPnYjtrLEzk+bGr4mf2gE/Y= -k8s.io/cloud-provider v0.0.0-20220614202259-6ea0e29b5fb2/go.mod h1:EtyqLbJtzQ5RHynmbaVvCYOHkZTrVDBQ/NNayXdGtR0= -k8s.io/component-base v0.0.0-20220614195841-c528ad5e18a8 h1:KCOpIfh+hbq6af7oul7CV2lWSt5R9KKpKjQJa5gnfrY= -k8s.io/component-base v0.0.0-20220614195841-c528ad5e18a8/go.mod h1:NDuyyQm6lSKk1nZCOID9n2/AVucQF9XBz64GAVZdCCQ= -k8s.io/controller-manager v0.0.0-20220614202144-533be65d8cdf h1:+TmGTBSsAWru2O3/if1z9W36Uv5OeDk8OwtzGrJUmKs= -k8s.io/controller-manager v0.0.0-20220614202144-533be65d8cdf/go.mod h1:MwHNpaUH+M6n38VTDW07MssVDY8ET/zDBmc3Qgra0nI= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= k8s.io/klog/v2 v2.60.1 h1:VW25q3bZx9uE3vvdL6M8ezOX79vA2Aq1nEWLqNQclHc= k8s.io/klog/v2 v2.60.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=