diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ceac8dd94a6..404da6452eab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,11 @@ `loki_tag` is now `logs_instance_tag`, and `backend: loki` is now `backend: logs_instance`. (@rfratto) + +# v0.18.2 (2021-08-12) + +- [BUGFIX] Honor the prefix and remove prefix from consul list results (@mattdurham) + # v0.18.1 (2021-08-09) - [BUGFIX] Reduce number of consul calls when ran in scrape service mode (@mattdurham) diff --git a/docs/configuration-reference.md b/docs/configuration-reference.md index ee07f6acfe4a..20eb6919fa6c 100644 --- a/docs/configuration-reference.md +++ b/docs/configuration-reference.md @@ -2667,7 +2667,7 @@ metadata: name: agent spec: containers: - - image: grafana/agent:v0.18.1 + - image: grafana/agent:v0.18.2 name: agent args: - --config.file=/etc/agent-config/agent.yaml diff --git a/docs/getting-started.md b/docs/getting-started.md index b68aec5bac69..32d7b4161abf 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -51,7 +51,7 @@ Currently, there are five ways to install the agent: ### Docker Container ``` -docker pull grafana/agent:v0.18.1 +docker pull grafana/agent:v0.18.2 ``` ### Kubernetes Install Script @@ -287,7 +287,7 @@ path of your Agent's YAML configuration file. docker run \ -v /tmp/agent:/etc/agent \ -v /path/to/config.yaml:/etc/agent/agent.yaml \ - grafana/agent:v0.18.1 + grafana/agent:v0.18.2 ``` ### Locally diff --git a/docs/operator/getting-started.md b/docs/operator/getting-started.md index e3757fff894a..345db9346a4d 100644 --- a/docs/operator/getting-started.md +++ b/docs/operator/getting-started.md @@ -49,7 +49,7 @@ spec: serviceAccountName: grafana-agent-operator containers: - name: operator - image: grafana/agent-operator:v0.18.1 + image: grafana/agent-operator:v0.18.2 --- apiVersion: v1 diff --git a/pkg/prom/instance/configstore/remote.go b/pkg/prom/instance/configstore/remote.go index 1e583abad9d2..fbb5c3384097 100644 --- a/pkg/prom/instance/configstore/remote.go +++ b/pkg/prom/instance/configstore/remote.go @@ -10,8 +10,6 @@ import ( "github.com/weaveworks/common/instrument" - "github.com/cortexproject/cortex/pkg/ring/kv/consul" - "github.com/hashicorp/go-cleanhttp" "github.com/hashicorp/consul/api" @@ -59,8 +57,8 @@ type Remote struct { // consul kv stores type agentRemoteClient struct { kv.Client - consul *api.Client - consulConfig consul.Config + consul *api.Client + config kv.Config } // NewRemote creates a new Remote store that uses a Key-Value client to store @@ -102,7 +100,7 @@ func (r *Remote) ApplyConfig(cfg kv.Config, enable bool) error { r.reg.UnregisterAll() if !enable { - r.setClient(nil, nil) + r.setClient(nil, nil, kv.Config{}) return nil } @@ -129,19 +127,20 @@ func (r *Remote) ApplyConfig(cfg kv.Config, enable bool) error { return fmt.Errorf("failed to create kv client: %w", err) } - r.setClient(cli, consulClient) + r.setClient(cli, consulClient, cfg) return nil } // setClient sets the active client and notifies run to restart the // kv watcher. -func (r *Remote) setClient(client kv.Client, consulClient *api.Client) { +func (r *Remote) setClient(client kv.Client, consulClient *api.Client, config kv.Config) { if client == nil && consulClient == nil { r.kv = nil } else { r.kv = &agentRemoteClient{ Client: client, consul: consulClient, + config: config, } } r.reloadKV <- struct{}{} @@ -227,14 +226,13 @@ func (r *Remote) listConsul(ctx context.Context) (api.KVPairs, error) { var pairs api.KVPairs options := &api.QueryOptions{ - AllowStale: !r.kv.consulConfig.ConsistentReads, - RequireConsistent: r.kv.consulConfig.ConsistentReads, + AllowStale: !r.kv.config.Consul.ConsistentReads, + RequireConsistent: r.kv.config.Consul.ConsistentReads, } // This is copied from cortex list so that stats stay the same err := instrument.CollectedRequest(ctx, "List", consulRequestDuration, instrument.ErrorCode, func(ctx context.Context) error { var err error - // This mirrors the default prefix in cortex - pairs, _, err = r.kv.consul.KV().List("configurations/", options.WithContext(ctx)) + pairs, _, err = r.kv.consul.KV().List(r.kv.config.Prefix, options.WithContext(ctx)) return err }) @@ -246,6 +244,9 @@ func (r *Remote) listConsul(ctx context.Context) (api.KVPairs, error) { blankPairs := make(api.KVPairs, 0) return blankPairs, nil } + for _, kvp := range pairs { + kvp.Key = strings.TrimPrefix(kvp.Key, r.kv.config.Prefix) + } return pairs, nil } diff --git a/production/README.md b/production/README.md index 5322564411ab..2298bc3f5398 100644 --- a/production/README.md +++ b/production/README.md @@ -41,7 +41,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.18.1 + grafana/agent:v0.18.2 ``` ## Running the Agent locally diff --git a/production/grafanacloud-install.sh b/production/grafanacloud-install.sh index 433b8718e78a..b03e67f17d60 100755 --- a/production/grafanacloud-install.sh +++ b/production/grafanacloud-install.sh @@ -47,7 +47,7 @@ PACKAGE_SYSTEM=${PACKAGE_SYSTEM:=} # # Global constants. # -RELEASE_VERSION="0.18.1" +RELEASE_VERSION="0.18.2" 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 3ea150ae1b9e..0c746c93af03 100644 --- a/production/kubernetes/agent-bare.yaml +++ b/production/kubernetes/agent-bare.yaml @@ -61,7 +61,7 @@ spec: - -config.file=/etc/agent/agent.yaml command: - /bin/agent - image: grafana/agent:v0.18.1 + image: grafana/agent:v0.18.2 imagePullPolicy: IfNotPresent name: agent ports: diff --git a/production/kubernetes/agent-loki.yaml b/production/kubernetes/agent-loki.yaml index 293fa3dc8822..0f3e756c4191 100644 --- a/production/kubernetes/agent-loki.yaml +++ b/production/kubernetes/agent-loki.yaml @@ -328,7 +328,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - image: grafana/agent:v0.18.1 + image: grafana/agent:v0.18.2 imagePullPolicy: IfNotPresent name: agent ports: diff --git a/production/kubernetes/agent-sigv4.yaml b/production/kubernetes/agent-sigv4.yaml index 743040494aff..245646643ee0 100644 --- a/production/kubernetes/agent-sigv4.yaml +++ b/production/kubernetes/agent-sigv4.yaml @@ -278,7 +278,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - image: grafana/agent:v0.18.1 + image: grafana/agent:v0.18.2 imagePullPolicy: IfNotPresent name: agent ports: @@ -329,7 +329,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - image: grafana/agent:v0.18.1 + image: grafana/agent:v0.18.2 imagePullPolicy: IfNotPresent name: agent ports: diff --git a/production/kubernetes/agent-tempo.yaml b/production/kubernetes/agent-tempo.yaml index 76e23257f659..757c422f7c1a 100644 --- a/production/kubernetes/agent-tempo.yaml +++ b/production/kubernetes/agent-tempo.yaml @@ -169,7 +169,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - image: grafana/agent:v0.18.1 + image: grafana/agent:v0.18.2 imagePullPolicy: IfNotPresent name: agent ports: diff --git a/production/kubernetes/agent.yaml b/production/kubernetes/agent.yaml index 2c457082619d..9d23fc68c7c5 100644 --- a/production/kubernetes/agent.yaml +++ b/production/kubernetes/agent.yaml @@ -278,7 +278,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - image: grafana/agent:v0.18.1 + image: grafana/agent:v0.18.2 imagePullPolicy: IfNotPresent name: agent ports: @@ -329,7 +329,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - image: grafana/agent:v0.18.1 + image: grafana/agent:v0.18.2 imagePullPolicy: IfNotPresent name: agent ports: diff --git a/production/kubernetes/build/lib/version.libsonnet b/production/kubernetes/build/lib/version.libsonnet index e49b3e4875ec..4556cb14d30d 100644 --- a/production/kubernetes/build/lib/version.libsonnet +++ b/production/kubernetes/build/lib/version.libsonnet @@ -1 +1 @@ -'grafana/agent:v0.18.1' +'grafana/agent:v0.18.2' diff --git a/production/kubernetes/install-bare.sh b/production/kubernetes/install-bare.sh index c7b27fbf1d50..3841efff9534 100644 --- a/production/kubernetes/install-bare.sh +++ b/production/kubernetes/install-bare.sh @@ -17,7 +17,7 @@ check_installed() { check_installed curl check_installed envsubst -MANIFEST_BRANCH=v0.18.1 +MANIFEST_BRANCH=v0.18.2 MANIFEST_URL=${MANIFEST_URL:-https://raw.githubusercontent.com/grafana/agent/${MANIFEST_BRANCH}/production/kubernetes/agent-bare.yaml} NAMESPACE=${NAMESPACE:-default} diff --git a/production/kubernetes/install-loki.sh b/production/kubernetes/install-loki.sh index a9aada60047d..c90114c1c476 100644 --- a/production/kubernetes/install-loki.sh +++ b/production/kubernetes/install-loki.sh @@ -31,7 +31,7 @@ check_installed() { check_installed curl check_installed envsubst -MANIFEST_BRANCH=v0.18.1 +MANIFEST_BRANCH=v0.18.2 MANIFEST_URL=${MANIFEST_URL:-https://raw.githubusercontent.com/grafana/agent/${MANIFEST_BRANCH}/production/kubernetes/agent-loki.yaml} NAMESPACE=${NAMESPACE:-default} diff --git a/production/kubernetes/install-sigv4.sh b/production/kubernetes/install-sigv4.sh index 4afc0fee869c..883b192e5b82 100644 --- a/production/kubernetes/install-sigv4.sh +++ b/production/kubernetes/install-sigv4.sh @@ -30,7 +30,7 @@ check_installed() { check_installed curl check_installed envsubst -MANIFEST_BRANCH=v0.18.1 +MANIFEST_BRANCH=v0.18.2 MANIFEST_URL=${MANIFEST_URL:-https://raw.githubusercontent.com/grafana/agent/${MANIFEST_BRANCH}/production/kubernetes/agent-sigv4.yaml} NAMESPACE=${NAMESPACE:-default} ROLE_ARN=${ROLE_ARN:-} diff --git a/production/kubernetes/install-tempo.sh b/production/kubernetes/install-tempo.sh index f0a11fb5712b..df296ba9226b 100644 --- a/production/kubernetes/install-tempo.sh +++ b/production/kubernetes/install-tempo.sh @@ -31,7 +31,7 @@ check_installed() { check_installed curl check_installed envsubst -MANIFEST_BRANCH=v0.18.1 +MANIFEST_BRANCH=v0.18.2 MANIFEST_URL=${MANIFEST_URL:-https://raw.githubusercontent.com/grafana/agent/${MANIFEST_BRANCH}/production/kubernetes/agent-tempo.yaml} NAMESPACE=${NAMESPACE:-default} diff --git a/production/kubernetes/install.sh b/production/kubernetes/install.sh index 3ddd8df018c0..77742b334e36 100644 --- a/production/kubernetes/install.sh +++ b/production/kubernetes/install.sh @@ -32,7 +32,7 @@ check_installed() { check_installed curl check_installed envsubst -MANIFEST_BRANCH=v0.18.1 +MANIFEST_BRANCH=v0.18.2 MANIFEST_URL=${MANIFEST_URL:-https://raw.githubusercontent.com/grafana/agent/${MANIFEST_BRANCH}/production/kubernetes/agent.yaml} NAMESPACE=${NAMESPACE:-default} diff --git a/production/tanka/grafana-agent/v1/main.libsonnet b/production/tanka/grafana-agent/v1/main.libsonnet index e31fd546d5cb..db4b4fbe5acf 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/tempo.libsonnet') + { _images:: { - agent: 'grafana/agent:v0.18.1', - agentctl: 'grafana/agentctl:v0.18.1', + agent: 'grafana/agent:v0.18.2', + agentctl: 'grafana/agentctl:v0.18.2', }, // new creates a new DaemonSet deployment of the grafana-agent. By default,