Skip to content

Commit

Permalink
Prepare for 0.24.1 (#1615)
Browse files Browse the repository at this point in the history
* Set up the default logger parameters (#1611)

* Set up the default logger parameters

Signed-off-by: Paschalis Tsilias <[email protected]>

* Set up the default logger parameters vol.2

Signed-off-by: Paschalis Tsilias <[email protected]>
(cherry picked from commit 3b8d8b9)

* pkg/operator/config: don't set non-existent username_file field (#1612)

PR #1441 introduced a change to use password_file for basic auth, but
accidentally also generated a username_file field which doesn't exist.

(cherry picked from commit 378ffed)

* Bump GitHub exporter version (#1589)

* bump version of github-exporter

This bumps the version of github-exporter to the latest upstream commit,
fixing numerous bugs since the latest development release.

Closes #1588.

* add changelog entry

Also add a retroactive changelog entry for #1584

(cherry picked from commit 61e8f37)

* udpate import order in agentctl main.go (#1584)

(cherry picked from commit 78aa623)

* Embed time zone data for logs package (#1594)

(cherry picked from commit 2c53aff)

* changelog: add changelog entry for agentctl version info bugfix

* Set `Content-Type` as `application/json` to JSON endpoints (#1596)

* Set json content-type to JSON endpoints

* Update CHANGELOG

(cherry picked from commit cff7cb4)

* prepare for 0.24.1 release

Co-authored-by: Paschalis Tsilias <[email protected]>
Co-authored-by: Robert Lankford <[email protected]>
Co-authored-by: Marc Tudurí <[email protected]>
  • Loading branch information
4 people authored Apr 14, 2022
1 parent 4ec400b commit 35015aa
Show file tree
Hide file tree
Showing 27 changed files with 85 additions and 29 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
--------------------

Expand Down
5 changes: 3 additions & 2 deletions cmd/agentctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions docs/user/configuration/integrations/node-exporter-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/user/getting-started/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/user/operator/custom-resource-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion docs/user/operator/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions pkg/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions pkg/metrics/cluster/configapi/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
4 changes: 2 additions & 2 deletions pkg/operator/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestBuildConfigMetrics(t *testing.T) {
basicAuth:
username:
name: example-secret
key: uname
key: key
password:
name: example-secret
key: pword
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/config/metrics_templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
`),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
),
Expand Down
1 change: 1 addition & 0 deletions pkg/operator/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
Expand Down
20 changes: 17 additions & 3 deletions pkg/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions pkg/server/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion production/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion production/grafanacloud-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
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 @@ -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:
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 @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion production/kubernetes/agent-traces.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
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.24.0'
'grafana/agent:v0.24.1'
2 changes: 1 addition & 1 deletion production/kubernetes/install-bare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}

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

0 comments on commit 35015aa

Please sign in to comment.