diff --git a/CHANGELOG.md b/CHANGELOG.md index 5917c90e3cf7..820b68c78335 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,32 @@ internal API changes are not present. Main (unreleased) ----------------- +v0.24.1 (2022-04-14) +-------------------- + +### Bugfixes + +- Add missing version information back into agentctl --version. (@rlankfo) + +- Bump version of github-exporter to latest upstream SHA 284088c21e7d, which + includes fixes from bugs found in their latest tag. This includes a fix + where not all releases where retrieved when pulling release information. + (@rfratto) + +- Set the `Content-Type` HTTP header to `application/json` for API endpoints + returning json objects. (@marctc) + +- Operator: fix issue where a `username_file` field was incorrectly set. + (@rfratto) + +- Initialize the logger with default `log_level` and `log_format` parameters. + (@tpaschalis) + +### Other changes + +- Embed timezone data to enable Promtail pipelines using the `location` field + on Windows machines. (@tpaschalis) + v0.24.0 (2022-04-07) -------------------- diff --git a/cmd/agentctl/main.go b/cmd/agentctl/main.go index b41e6bb99d6f..e4bc7a51ed2d 100644 --- a/cmd/agentctl/main.go +++ b/cmd/agentctl/main.go @@ -13,8 +13,6 @@ import ( "gopkg.in/yaml.v2" - // Adds version information - _ "github.com/grafana/agent/pkg/build" "github.com/grafana/agent/pkg/client/grafanacloud" "github.com/grafana/agent/pkg/config" "github.com/olekukonko/tablewriter" @@ -45,6 +43,9 @@ import ( kclient "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/apiutil" kconfig "sigs.k8s.io/controller-runtime/pkg/client/config" + + // Adds version information + _ "github.com/grafana/agent/pkg/build" ) func main() { diff --git a/docs/user/configuration/integrations/node-exporter-config.md b/docs/user/configuration/integrations/node-exporter-config.md index f5caece34067..9483abfb528d 100644 --- a/docs/user/configuration/integrations/node-exporter-config.md +++ b/docs/user/configuration/integrations/node-exporter-config.md @@ -26,7 +26,7 @@ docker run \ -v "/proc:/host/proc:ro,rslave" \ -v /tmp/agent:/etc/agent \ -v /path/to/config.yaml:/etc/agent-config/agent.yaml \ - grafana/agent:v0.24.0 \ + grafana/agent:v0.24.1 \ --config.file=/etc/agent-config/agent.yaml ``` @@ -65,7 +65,7 @@ metadata: name: agent spec: containers: - - image: grafana/agent:v0.24.0 + - image: grafana/agent:v0.24.1 name: agent args: - --config.file=/etc/agent-config/agent.yaml diff --git a/docs/user/configuration/integrations/process-exporter-config.md b/docs/user/configuration/integrations/process-exporter-config.md index f6a8bc5d7910..fcbef20a8664 100644 --- a/docs/user/configuration/integrations/process-exporter-config.md +++ b/docs/user/configuration/integrations/process-exporter-config.md @@ -18,7 +18,7 @@ docker run \ -v "/proc:/proc:ro" \ -v /tmp/agent:/etc/agent \ -v /path/to/config.yaml:/etc/agent-config/agent.yaml \ - grafana/agent:v0.24.0 \ + grafana/agent:v0.24.1 \ --config.file=/etc/agent-config/agent.yaml ``` @@ -35,7 +35,7 @@ metadata: name: agent spec: containers: - - image: grafana/agent:v0.24.0 + - image: grafana/agent:v0.24.1 name: agent args: - --config.file=/etc/agent-config/agent.yaml diff --git a/docs/user/getting-started/_index.md b/docs/user/getting-started/_index.md index d11c380d80a2..35fe065c65b1 100644 --- a/docs/user/getting-started/_index.md +++ b/docs/user/getting-started/_index.md @@ -26,7 +26,7 @@ See the list of [Community Projects](#community-projects) for the community-driv docker run \ -v /tmp/agent:/etc/agent/data \ -v /path/to/config.yaml:/etc/agent/agent.yaml \ - grafana/agent:v0.24.0 + grafana/agent:v0.24.1 ``` Replace `/tmp/agent` with the folder you wish to store WAL data in. WAL data is diff --git a/docs/user/operator/custom-resource-quickstart.md b/docs/user/operator/custom-resource-quickstart.md index c7203edb2a3a..6116bdeedd5d 100644 --- a/docs/user/operator/custom-resource-quickstart.md +++ b/docs/user/operator/custom-resource-quickstart.md @@ -43,7 +43,7 @@ metadata: labels: app: grafana-agent spec: - image: grafana/agent:v0.24.0 + image: grafana/agent:v0.24.1 logLevel: info serviceAccountName: grafana-agent metrics: diff --git a/docs/user/operator/getting-started.md b/docs/user/operator/getting-started.md index 61a458b73c9e..6be6f8b5b476 100644 --- a/docs/user/operator/getting-started.md +++ b/docs/user/operator/getting-started.md @@ -72,7 +72,7 @@ spec: serviceAccountName: grafana-agent-operator containers: - name: operator - image: grafana/agent-operator:v0.24.0 + image: grafana/agent-operator:v0.24.1 args: - --kubelet-service=default/kubelet --- diff --git a/go.mod b/go.mod index 8703e0976def..29051be9d3c5 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/hashicorp/consul/api v1.12.0 github.com/hashicorp/go-cleanhttp v0.5.2 github.com/hashicorp/go-multierror v1.1.1 - github.com/infinityworks/github-exporter v0.0.0-20201016091012-831b72461034 + github.com/infinityworks/github-exporter v0.0.0-20210802160115-284088c21e7d github.com/johannesboyne/gofakes3 v0.0.0-20210819161434-5c8dfcfe5310 github.com/jsternberg/zap-logfmt v1.2.0 github.com/lib/pq v1.10.2 diff --git a/pkg/config/config.go b/pkg/config/config.go index 0aa109ebbb70..fa9ec97a3123 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -49,6 +49,7 @@ var ( // DefaultConfig holds default settings for all the subsystems. var DefaultConfig = Config{ // All subsystems with a DefaultConfig should be listed here. + Server: server.DefaultConfig, Metrics: metrics.DefaultConfig, Integrations: DefaultVersionedIntegrations, EnableConfigEndpoints: false, diff --git a/pkg/logs/logs.go b/pkg/logs/logs.go index e9933abca135..5f8e7b44475d 100644 --- a/pkg/logs/logs.go +++ b/pkg/logs/logs.go @@ -7,6 +7,7 @@ import ( "path/filepath" "sync" "time" + _ "time/tzdata" // embed timezone data "github.com/go-kit/log" "github.com/go-kit/log/level" diff --git a/pkg/metrics/cluster/configapi/types.go b/pkg/metrics/cluster/configapi/types.go index d9646e020f76..bf16b72bdb1f 100644 --- a/pkg/metrics/cluster/configapi/types.go +++ b/pkg/metrics/cluster/configapi/types.go @@ -61,11 +61,13 @@ type GetConfigurationResponse struct { // status code of statusCode. resp is marshaled to JSON. func WriteResponse(w http.ResponseWriter, statusCode int, resp interface{}) error { apiResp := &APIResponse{Status: "success", Data: resp} + w.Header().Set("Content-Type", "application/json") return apiResp.WriteTo(w, statusCode) } // WriteError writes an error response back to the ResponseWriter. func WriteError(w http.ResponseWriter, statusCode int, err error) error { resp := &APIResponse{Status: "error", Data: &ErrorResponse{Error: err.Error()}} + w.Header().Set("Content-Type", "application/json") return resp.WriteTo(w, statusCode) } diff --git a/pkg/operator/config/config_test.go b/pkg/operator/config/config_test.go index de1735481710..eb804887d69f 100644 --- a/pkg/operator/config/config_test.go +++ b/pkg/operator/config/config_test.go @@ -78,7 +78,7 @@ func TestBuildConfigMetrics(t *testing.T) { basicAuth: username: name: example-secret - key: uname + key: key password: name: example-secret key: pword @@ -111,7 +111,7 @@ func TestBuildConfigMetrics(t *testing.T) { remote_write: - url: http://localhost:9090/api/v1/write basic_auth: - username_file: /var/lib/grafana-agent/secrets/_secrets_default_example_secret_uname + username: somesecret password_file: /var/lib/grafana-agent/secrets/_secrets_default_example_secret_pword tls_config: ca_file: /var/lib/grafana-agent/secrets/_configMaps_default_example_cm_key diff --git a/pkg/operator/config/metrics_templates_test.go b/pkg/operator/config/metrics_templates_test.go index dc526e578be2..919e911cddaf 100644 --- a/pkg/operator/config/metrics_templates_test.go +++ b/pkg/operator/config/metrics_templates_test.go @@ -547,7 +547,7 @@ func TestRemoteWrite(t *testing.T) { expect: util.Untab(` url: http://cortex/api/prom/push basic_auth: - username_file: /var/lib/grafana-agent/secrets/_secrets_operator_obj_key + username: secretkey password_file: /var/lib/grafana-agent/secrets/_secrets_operator_obj_key `), }, diff --git a/pkg/operator/config/templates/component/metrics/remote_write.libsonnet b/pkg/operator/config/templates/component/metrics/remote_write.libsonnet index e172211ca226..e2a032353fff 100644 --- a/pkg/operator/config/templates/component/metrics/remote_write.libsonnet +++ b/pkg/operator/config/templates/component/metrics/remote_write.libsonnet @@ -30,7 +30,7 @@ function(namespace, rw) { basic_auth: ( if rw.BasicAuth != null then { - username_file: secrets.pathForSecret(namespace, rw.BasicAuth.Username), + username: secrets.valueForSecret(namespace, rw.BasicAuth.Username), password_file: secrets.pathForSecret(namespace, rw.BasicAuth.Password), } ), diff --git a/pkg/operator/defaults.go b/pkg/operator/defaults.go index c3b8f8b84683..704c6f1c6d4c 100644 --- a/pkg/operator/defaults.go +++ b/pkg/operator/defaults.go @@ -22,6 +22,7 @@ var ( "v0.22.0", "v0.23.0", "v0.24.0", + "v0.24.1", // NOTE(rfratto): when performing an upgrade, add the newest version above instead of changing the existing reference. } diff --git a/pkg/server/config.go b/pkg/server/config.go index 3beb033f5c2a..015d4bd546ff 100644 --- a/pkg/server/config.go +++ b/pkg/server/config.go @@ -43,9 +43,11 @@ type GRPCConfig struct { // Default configuration structs. var ( DefaultConfig = Config{ - GRPC: DefaultGRPCConfig, - HTTP: DefaultHTTPConfig, - Flags: DefaultFlags, + GRPC: DefaultGRPCConfig, + HTTP: DefaultHTTPConfig, + Flags: DefaultFlags, + LogLevel: DefaultLogLevel, + LogFormat: DefaultLogFormat, } DefaultHTTPConfig = HTTPConfig{ @@ -55,6 +57,18 @@ var ( DefaultGRPCConfig = GRPCConfig{ // No non-zero defaults yet } + + emptyFlagSet = flag.NewFlagSet("", flag.ExitOnError) + DefaultLogLevel = func() logging.Level { + var lvl logging.Level + lvl.RegisterFlags(emptyFlagSet) + return lvl + }() + DefaultLogFormat = func() logging.Format { + var fmt logging.Format + fmt.RegisterFlags(emptyFlagSet) + return fmt + }() ) // RegisterFlags registers flags for c to the given FlagSet. diff --git a/pkg/server/logger_test.go b/pkg/server/logger_test.go index e422b9412df3..59dec39bfb6e 100644 --- a/pkg/server/logger_test.go +++ b/pkg/server/logger_test.go @@ -10,6 +10,16 @@ import ( "gopkg.in/yaml.v2" ) +func TestLogger_DefaultParameters(t *testing.T) { + makeLogger := func(cfg *Config) (log.Logger, error) { + var l log.Logger + require.Equal(t, "info", cfg.LogLevel.String()) + require.Equal(t, "logfmt", cfg.LogFormat.String()) + return l, nil + } + newLogger(&DefaultConfig, makeLogger).makeLogger(&DefaultConfig) +} + func TestLogger_ApplyConfig(t *testing.T) { var buf bytes.Buffer makeLogger := func(cfg *Config) (log.Logger, error) { diff --git a/production/README.md b/production/README.md index f2cec3e973c5..9622ed9d4d1e 100644 --- a/production/README.md +++ b/production/README.md @@ -27,7 +27,7 @@ directory on your host that you want the agent to store its WAL. docker run \ -v /tmp/agent:/etc/agent/data \ -v /path/to/config.yaml:/etc/agent/agent.yaml \ - grafana/agent:v0.24.0 + grafana/agent:v0.24.1 ``` ## Running the Agent locally diff --git a/production/grafanacloud-install.sh b/production/grafanacloud-install.sh index 962932861328..f4a29047a465 100755 --- a/production/grafanacloud-install.sh +++ b/production/grafanacloud-install.sh @@ -50,7 +50,7 @@ PACKAGE_SYSTEM=${PACKAGE_SYSTEM:=} # # Global constants. # -RELEASE_VERSION="0.24.0" +RELEASE_VERSION="0.24.1" RELEASE_URL="https://github.com/grafana/agent/releases/download/v${RELEASE_VERSION}" DEB_URL="${RELEASE_URL}/grafana-agent-${RELEASE_VERSION}-1.${ARCH}.deb" diff --git a/production/kubernetes/agent-bare.yaml b/production/kubernetes/agent-bare.yaml index 942e703d7ad1..66a81b54ae4d 100644 --- a/production/kubernetes/agent-bare.yaml +++ b/production/kubernetes/agent-bare.yaml @@ -84,7 +84,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - image: grafana/agent:v0.24.0 + image: grafana/agent:v0.24.1 imagePullPolicy: IfNotPresent name: grafana-agent ports: diff --git a/production/kubernetes/agent-loki.yaml b/production/kubernetes/agent-loki.yaml index e47ede2af472..bf08060eed67 100644 --- a/production/kubernetes/agent-loki.yaml +++ b/production/kubernetes/agent-loki.yaml @@ -66,7 +66,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - image: grafana/agent:v0.24.0 + image: grafana/agent:v0.24.1 imagePullPolicy: IfNotPresent name: grafana-agent-logs ports: diff --git a/production/kubernetes/agent-traces.yaml b/production/kubernetes/agent-traces.yaml index f8fcfb37bfeb..d6a2da80e4f0 100644 --- a/production/kubernetes/agent-traces.yaml +++ b/production/kubernetes/agent-traces.yaml @@ -111,7 +111,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - image: grafana/agent:v0.24.0 + image: grafana/agent:v0.24.1 imagePullPolicy: IfNotPresent name: grafana-agent-traces ports: diff --git a/production/kubernetes/build/lib/version.libsonnet b/production/kubernetes/build/lib/version.libsonnet index 0160dd8fb6c1..700c7e575a0c 100644 --- a/production/kubernetes/build/lib/version.libsonnet +++ b/production/kubernetes/build/lib/version.libsonnet @@ -1 +1 @@ -'grafana/agent:v0.24.0' +'grafana/agent:v0.24.1' diff --git a/production/kubernetes/install-bare.sh b/production/kubernetes/install-bare.sh index 4147f0e00b21..8fc85ac1e0c7 100644 --- a/production/kubernetes/install-bare.sh +++ b/production/kubernetes/install-bare.sh @@ -25,7 +25,7 @@ check_installed() { check_installed curl check_installed envsubst -MANIFEST_BRANCH=v0.24.0 +MANIFEST_BRANCH=v0.24.1 MANIFEST_URL=${MANIFEST_URL:-https://raw.githubusercontent.com/grafana/agent/${MANIFEST_BRANCH}/production/kubernetes/agent-bare.yaml} NAMESPACE=${NAMESPACE:-default} diff --git a/production/tanka/grafana-agent/v1/main.libsonnet b/production/tanka/grafana-agent/v1/main.libsonnet index aa0e8ce8371c..0c113603db41 100644 --- a/production/tanka/grafana-agent/v1/main.libsonnet +++ b/production/tanka/grafana-agent/v1/main.libsonnet @@ -15,8 +15,8 @@ local service = k.core.v1.service; (import './lib/traces.libsonnet') + { _images:: { - agent: 'grafana/agent:v0.24.0', - agentctl: 'grafana/agentctl:v0.24.0', + agent: 'grafana/agent:v0.24.1', + agentctl: 'grafana/agentctl:v0.24.1', }, // new creates a new DaemonSet deployment of the grafana-agent. By default, diff --git a/production/tanka/grafana-agent/v2/internal/base.libsonnet b/production/tanka/grafana-agent/v2/internal/base.libsonnet index b518bf0c4478..907f3513e142 100644 --- a/production/tanka/grafana-agent/v2/internal/base.libsonnet +++ b/production/tanka/grafana-agent/v2/internal/base.libsonnet @@ -11,8 +11,8 @@ function(name='grafana-agent', namespace='') { local this = self, _images:: { - agent: 'grafana/agent:v0.24.0', - agentctl: 'grafana/agentctl:v0.24.0', + agent: 'grafana/agent:v0.24.1', + agentctl: 'grafana/agentctl:v0.24.1', }, _config:: { name: name, diff --git a/production/tanka/grafana-agent/v2/internal/syncer.libsonnet b/production/tanka/grafana-agent/v2/internal/syncer.libsonnet index d1fa35d54bd1..55fc9f11349b 100644 --- a/production/tanka/grafana-agent/v2/internal/syncer.libsonnet +++ b/production/tanka/grafana-agent/v2/internal/syncer.libsonnet @@ -14,7 +14,7 @@ function( ) { local _config = { api: error 'api must be set', - image: 'grafana/agentctl:v0.24.0', + image: 'grafana/agentctl:v0.24.1', schedule: '*/5 * * * *', configs: [], } + config,