From 9bd07d42d758b77588251c6bca18f9d1afb2826a Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Wed, 19 Oct 2022 16:16:55 +0200 Subject: [PATCH] Pin knative/pkg to 1.8 This pin the dependency to the 1.8 release of knative instead of a commit in main. The commit (https://github.com/knative/pkg/commit/8178c38717851ad42b96e93f86169af59f5e92b4) that #5643 required is available in 1.8 (see https://github.com/knative/pkg/commits/release-1.8) Signed-off-by: Vincent Demeester --- go.mod | 2 +- go.sum | 4 +-- hack/update-deps.sh | 2 +- .../pkg/injection/sharedmain/main.go | 33 ------------------- .../pkg/metrics/config_observability.go | 33 ------------------- vendor/modules.txt | 2 +- 6 files changed, 5 insertions(+), 71 deletions(-) diff --git a/go.mod b/go.mod index 6b818f65233..f4ecea0fab0 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( k8s.io/code-generator v0.25.2 k8s.io/klog v1.0.0 k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 - knative.dev/pkg v0.0.0-20221014164553-b812affa3893 + knative.dev/pkg v0.0.0-20221011175852-714b7630a836 sigs.k8s.io/yaml v1.3.0 ) diff --git a/go.sum b/go.sum index 52002f7a1d6..75c1fcec2b3 100644 --- a/go.sum +++ b/go.sum @@ -2133,8 +2133,8 @@ k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= k8s.io/utils v0.0.0-20201110183641-67b214c5f920/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed h1:jAne/RjBTyawwAy0utX5eqigAwz/lQhTmy+Hr/Cpue4= k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= -knative.dev/pkg v0.0.0-20221014164553-b812affa3893 h1:RU6XnkYE017AWfKgN+eQLyDcT99eJKgz+ZWOvb+3fhc= -knative.dev/pkg v0.0.0-20221014164553-b812affa3893/go.mod h1:DMTRDJ5WRxf/DrlOPzohzfhSuJggscLZ8EavOq9O/x8= +knative.dev/pkg v0.0.0-20221011175852-714b7630a836 h1:0N7Zo/O+xeUUebJPm9keBaGclrUoEbljr3J1MsqtaIM= +knative.dev/pkg v0.0.0-20221011175852-714b7630a836/go.mod h1:DMTRDJ5WRxf/DrlOPzohzfhSuJggscLZ8EavOq9O/x8= mvdan.cc/gofumpt v0.1.1/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= diff --git a/hack/update-deps.sh b/hack/update-deps.sh index de6a2cee6c6..3b104f41c4b 100755 --- a/hack/update-deps.sh +++ b/hack/update-deps.sh @@ -22,7 +22,7 @@ source $(git rev-parse --show-toplevel)/vendor/github.com/tektoncd/plumbing/scri cd ${REPO_ROOT_DIR} -VERSION="release-1.7" +VERSION="release-1.8" # The list of dependencies that we track at HEAD and periodically # float forward in this repository. diff --git a/vendor/knative.dev/pkg/injection/sharedmain/main.go b/vendor/knative.dev/pkg/injection/sharedmain/main.go index 8af9eb5d1f7..3b8ab3f40bd 100644 --- a/vendor/knative.dev/pkg/injection/sharedmain/main.go +++ b/vendor/knative.dev/pkg/injection/sharedmain/main.go @@ -104,25 +104,6 @@ func GetLeaderElectionConfig(ctx context.Context) (*leaderelection.Config, error return leaderelection.NewConfigFromConfigMap(leaderElectionConfigMap) } -// GetObservabilityConfig gets the observability config from the (in order): -// 1. provided context, -// 2. reading from the API server, -// 3. defaults (if not found). -func GetObservabilityConfig(ctx context.Context) (*metrics.ObservabilityConfig, error) { - if cfg := metrics.GetObservabilityConfig(ctx); cfg != nil { - return cfg, nil - } - - observabilityConfigMap, err := kubeclient.Get(ctx).CoreV1().ConfigMaps(system.Namespace()).Get(ctx, metrics.ConfigMapName(), metav1.GetOptions{}) - if apierrors.IsNotFound(err) { - return metrics.NewObservabilityConfigFromConfigMap(nil) - } - if err != nil { - return nil, err - } - return metrics.NewObservabilityConfigFromConfigMap(observabilityConfigMap) -} - // EnableInjectionOrDie enables Knative Injection and starts the informers. // Both Context and Config are optional. // Deprecated: use injection.EnableInjectionOrDie @@ -268,8 +249,6 @@ func MainWithConfig(ctx context.Context, component string, cfg *rest.Config, cto leaderElectionConfig.GetComponentConfig(component)) } - SetupObservabilityOrDie(ctx, component, logger, profilingHandler) - controllers, webhooks := ControllersAndWebhooksFromCtors(ctx, cmw, ctors...) WatchLoggingConfigOrDie(ctx, cmw, logger, atomicLevel, component) WatchObservabilityConfigOrDie(ctx, cmw, profilingHandler, logger, component) @@ -348,18 +327,6 @@ func SetupLoggerOrDie(ctx context.Context, component string) (*zap.SugaredLogger return l, level } -// SetupObservabilityOrDie sets up the observability using the config from the given context -// or dies by calling log.Fatalf. -func SetupObservabilityOrDie(ctx context.Context, component string, logger *zap.SugaredLogger, profilingHandler *profiling.Handler) { - observabilityConfig, err := GetObservabilityConfig(ctx) - if err != nil { - logger.Fatal("Error loading observability configuration: ", err) - } - observabilityConfigMap := observabilityConfig.GetConfigMap() - metrics.ConfigMapWatcher(ctx, component, SecretFetcher(ctx), logger)(&observabilityConfigMap) - profilingHandler.UpdateFromConfigMap(&observabilityConfigMap) -} - // CheckK8sClientMinimumVersionOrDie checks that the hosting Kubernetes cluster // is at least the minimum allowable version or dies by calling log.Fatalw. func CheckK8sClientMinimumVersionOrDie(ctx context.Context, logger *zap.SugaredLogger) { diff --git a/vendor/knative.dev/pkg/metrics/config_observability.go b/vendor/knative.dev/pkg/metrics/config_observability.go index f95d6bc8cab..0a17e0f03be 100644 --- a/vendor/knative.dev/pkg/metrics/config_observability.go +++ b/vendor/knative.dev/pkg/metrics/config_observability.go @@ -17,10 +17,8 @@ limitations under the License. package metrics import ( - "context" "fmt" "os" - "strconv" texttemplate "text/template" corev1 "k8s.io/api/core/v1" @@ -83,22 +81,6 @@ type ObservabilityConfig struct { MetricsCollectorAddress string } -type ocfg struct{} - -// WithConfig associates a observability configuration with the context. -func WithConfig(ctx context.Context, cfg *ObservabilityConfig) context.Context { - return context.WithValue(ctx, ocfg{}, cfg) -} - -// GetObservability gets the observability config from the provided context. -func GetObservabilityConfig(ctx context.Context) *ObservabilityConfig { - untyped := ctx.Value(ocfg{}) - if untyped == nil { - return nil - } - return untyped.(*ObservabilityConfig) -} - func defaultConfig() *ObservabilityConfig { return &ObservabilityConfig{ LoggingURLTemplate: DefaultLogURLTemplate, @@ -138,21 +120,6 @@ func NewObservabilityConfigFromConfigMap(configMap *corev1.ConfigMap) (*Observab return oc, nil } -func (oc *ObservabilityConfig) GetConfigMap() corev1.ConfigMap { - return corev1.ConfigMap{ - Data: map[string]string{ - "logging.enable-var-log-collection": strconv.FormatBool(oc.EnableVarLogCollection), - "logging.revision-url-template": oc.LoggingURLTemplate, - ReqLogTemplateKey: oc.RequestLogTemplate, - EnableReqLogKey: strconv.FormatBool(oc.EnableRequestLog), - EnableProbeReqLogKey: strconv.FormatBool(oc.EnableProbeRequestLog), - "metrics.request-metrics-backend-destination": oc.RequestMetricsBackend, - "profiling.enable": strconv.FormatBool(oc.EnableProfiling), - "metrics.opencensus-address": oc.MetricsCollectorAddress, - }, - } -} - // ConfigMapName gets the name of the metrics ConfigMap func ConfigMapName() string { if cm := os.Getenv(configMapNameEnv); cm != "" { diff --git a/vendor/modules.txt b/vendor/modules.txt index 7d6fc4b809f..398b43eee1c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1389,7 +1389,7 @@ k8s.io/utils/net k8s.io/utils/pointer k8s.io/utils/strings/slices k8s.io/utils/trace -# knative.dev/pkg v0.0.0-20221014164553-b812affa3893 +# knative.dev/pkg v0.0.0-20221011175852-714b7630a836 ## explicit; go 1.18 knative.dev/pkg/apis knative.dev/pkg/apis/duck