Skip to content

Commit

Permalink
Update version number to v0.18.2 and fix issues with prefixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdurham committed Aug 12, 2021
1 parent 5520754 commit a1eb30c
Show file tree
Hide file tree
Showing 19 changed files with 38 additions and 32 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/operator/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 12 additions & 11 deletions pkg/prom/instance/configstore/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand All @@ -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{}{}
Expand Down Expand Up @@ -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
})

Expand All @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion production/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion production/grafanacloud-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion production/kubernetes/agent-bare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion production/kubernetes/agent-loki.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions production/kubernetes/agent-sigv4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion production/kubernetes/agent-tempo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions production/kubernetes/agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion production/kubernetes/build/lib/version.libsonnet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
'grafana/agent:v0.18.1'
'grafana/agent:v0.18.2'
2 changes: 1 addition & 1 deletion production/kubernetes/install-bare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
2 changes: 1 addition & 1 deletion production/kubernetes/install-loki.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
2 changes: 1 addition & 1 deletion production/kubernetes/install-sigv4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:-}
Expand Down
2 changes: 1 addition & 1 deletion production/kubernetes/install-tempo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
2 changes: 1 addition & 1 deletion production/kubernetes/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
4 changes: 2 additions & 2 deletions production/tanka/grafana-agent/v1/main.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a1eb30c

Please sign in to comment.