Skip to content

Commit 25c5ed0

Browse files
authored
Merge pull request #662 from slok/slok/k8s-v134
Update deps and add support for go 1.25 and k8s 1.34
2 parents ff0dced + 16be379 commit 25c5ed0

33 files changed

Lines changed: 334 additions & 234 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ jobs:
77
name: Check
88
runs-on: ubuntu-latest
99
# Execute the checks inside the container instead the VM.
10-
container: golangci/golangci-lint:v1.64.8-alpine
10+
container: golangci/golangci-lint:v2.4.0-alpine
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@v5
1313
- run: |
1414
# We need this go flag because it started to error after golangci-lint is using Go 1.21.
1515
# TODO(slok): Remove it on next (>1.54.1) golangci-lint upgrade to check if this problem has gone.
@@ -20,8 +20,8 @@ jobs:
2020
name: Unit test
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v4
24-
- uses: actions/setup-go@v5
23+
- uses: actions/checkout@v5
24+
- uses: actions/setup-go@v6
2525
with:
2626
go-version-file: go.mod
2727
- run: make ci-test
@@ -35,13 +35,13 @@ jobs:
3535
name: Helm chart test
3636
runs-on: ubuntu-latest
3737
steps:
38-
- uses: actions/checkout@v4
39-
- uses: actions/setup-go@v5
38+
- uses: actions/checkout@v5
39+
- uses: actions/setup-go@v6
4040
with:
4141
go-version-file: go.mod
4242
- name: Execute tests
4343
env:
44-
HELM_VERSION: v3.6.3
44+
HELM_VERSION: v3.17.0
4545
run: |
4646
# Get dependencies.
4747
echo "Getting dependencies..."
@@ -52,8 +52,8 @@ jobs:
5252
name: Integration test CLI
5353
runs-on: ubuntu-latest
5454
steps:
55-
- uses: actions/checkout@v4
56-
- uses: actions/setup-go@v5
55+
- uses: actions/checkout@v5
56+
- uses: actions/setup-go@v6
5757
with:
5858
go-version-file: go.mod
5959
- name: Execute tests
@@ -72,15 +72,15 @@ jobs:
7272
runs-on: ubuntu-latest
7373
strategy:
7474
matrix:
75-
kubernetes: [1.30.13, 1.31.9, 1.32.5, 1.33.1]
75+
kubernetes: [1.31.12, 1.32.8, 1.33.4, 1.34.0]
7676
steps:
77-
- uses: actions/checkout@v4
78-
- uses: actions/setup-go@v5
77+
- uses: actions/checkout@v5
78+
- uses: actions/setup-go@v6
7979
with:
8080
go-version-file: go.mod
8181
- name: Execute tests
8282
env:
83-
KIND_VERSION: v0.28.0
83+
KIND_VERSION: v0.30.0
8484
run: |
8585
# Get dependencies.
8686
echo "Getting dependencies..."
@@ -124,7 +124,7 @@ jobs:
124124
name: Release images
125125
runs-on: ubuntu-latest
126126
steps:
127-
- uses: actions/checkout@v4
127+
- uses: actions/checkout@v5
128128
- name: Docker login
129129
run: docker login ghcr.io -u ${{ github.actor }} -p "${{ secrets.GITHUB_TOKEN }}"
130130
- name: Build and publish docker images
@@ -147,7 +147,7 @@ jobs:
147147
runs-on: ubuntu-latest
148148
steps:
149149
- run: echo "VERSION=${GITHUB_REF#refs/*/}" >> ${GITHUB_ENV} # Sets VERSION env var.
150-
- uses: actions/checkout@v4
150+
- uses: actions/checkout@v5
151151
- name: Docker login
152152
run: docker login ghcr.io -u ${{ github.actor }} -p "${{ secrets.GITHUB_TOKEN }}"
153153
- name: Build and publish docker images
@@ -168,7 +168,7 @@ jobs:
168168
runs-on: ubuntu-latest
169169
steps:
170170
- run: echo "VERSION=${GITHUB_REF#refs/*/}" >> ${GITHUB_ENV} # Sets VERSION env var.
171-
- uses: actions/checkout@v4
171+
- uses: actions/checkout@v5
172172
- name: Build binaries
173173
run: |
174174
mkdir -p ./bin

.github/workflows/close-stale.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
stale:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/stale@v9
10+
- uses: actions/stale@v10
1111
with:
1212
days-before-stale: 60
1313
days-before-close: 15

.github/workflows/generate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
name: Generate the SLOs
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v5
1515
- name: download and setup generator binary
1616
run: |
1717
wget https://github.com/slok/sloth/releases/download/v0.9.0/sloth-linux-amd64

.github/workflows/helmrelease.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v4
15+
uses: actions/checkout@v5
1616
with:
1717
fetch-depth: 0
1818

.golangci.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
1-
---
1+
version: "2"
22
run:
3-
timeout: 3m
43
build-tags:
54
- integration
6-
75
linters:
86
enable:
7+
- godot
98
- misspell
10-
- goimports
119
- revive
10+
settings:
11+
revive:
12+
rules:
13+
# Spammy linter and complex to fix on lots of parameters. Makes more harm that it solves.
14+
- name: unused-parameter
15+
disabled: true
16+
staticcheck:
17+
checks:
18+
- all
19+
# Omit embedded fields from selector expression.
20+
# https://staticcheck.dev/docs/checks/#QF1008
21+
- -QF1008
22+
exclusions:
23+
generated: lax
24+
presets:
25+
- comments
26+
- std-error-handling
27+
formatters:
28+
enable:
1229
- gofmt
13-
#- depguard
14-
- godot
15-
16-
linters-settings:
17-
revive:
18-
rules:
19-
# Spammy linter and complex to fix on lots of parameters. Makes more harm that it solves.
20-
- name: unused-parameter
21-
disabled: true
30+
- goimports

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
- (BREAKING) `--sli-plugins-path`, `--slo-plugins-path`, `-m` args and it's env vars `SLOTH_SLI_PLUGINS_PATH`and `SLOTH_SLO_PLUGINS_PATH` have been removed in favor or `--plugins-path`, `-p` and it's env var `SLOTH_PLUGINS_PATH` that discovers and loads SLI and SLO plugins with a single flag.
1111
- Simplify validation and improve validation message by using custom logic instead of `go-playground/validator`.
1212
- (BREAKING) `--disable-optimized-rules` flag and associated env var has been removed.
13-
- Update to Kubernetes v1.33.
13+
- Update to Kubernetes v1.34.
14+
- Update to Go v1.25.
1415

1516
### Added
1617

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![Go Report Card](https://goreportcard.com/badge/github.com/slok/sloth)](https://goreportcard.com/report/github.com/slok/sloth)
99
[![Apache 2 licensed](https://img.shields.io/badge/license-Apache2-blue.svg)](https://raw.githubusercontent.com/slok/sloth/master/LICENSE)
1010
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/slok/sloth)](https://github.com/slok/sloth/releases/latest)
11-
![Kubernetes release](https://img.shields.io/badge/Kubernetes-v1.33-green?logo=Kubernetes&style=flat&color=326CE5&logoColor=white)
11+
![Kubernetes release](https://img.shields.io/badge/Kubernetes-v1.34-green?logo=Kubernetes&style=flat&color=326CE5&logoColor=white)
1212
[![OpenSLO](https://img.shields.io/badge/OpenSLO-v1alpha-green?color=4974EA&style=flat)](https://github.com/OpenSLO/OpenSLO#slo)
1313

1414
## Project status

cmd/sloth/commands/helpers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ func mapCmdPluginToModel(ctx context.Context, jsonPlugins []string) ([]model.Pro
133133
}
134134

135135
func createDefaultSLOPlugins(logger log.Logger, disableRecordings, disableAlerts bool) ([]generate.SLOProcessor, error) {
136-
var sliRuleGen generate.SLOProcessor = generate.NoopPlugin
137-
var metaRuleGen generate.SLOProcessor = generate.NoopPlugin
136+
sliRuleGen := generate.NoopPlugin
137+
metaRuleGen := generate.NoopPlugin
138138
if !disableRecordings {
139139
sliPlugin, err := generate.NewSLOProcessorFromSLOPluginV1(
140140
plugincoreslirulesv1.NewPlugin,
@@ -167,7 +167,7 @@ func createDefaultSLOPlugins(logger log.Logger, disableRecordings, disableAlerts
167167
}
168168

169169
// Disable alert rules if required.
170-
var alertRuleGen generate.SLOProcessor = generate.NoopPlugin
170+
alertRuleGen := generate.NoopPlugin
171171
if !disableAlerts {
172172
plugin, err := generate.NewSLOProcessorFromSLOPluginV1(
173173
plugincorealertrulesv1.NewPlugin,

cmd/sloth/commands/validate.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ func (v validateCommand) Run(ctx context.Context, config RootConfig) error {
145145
if promErr == nil {
146146
err := gen.GeneratePrometheus(ctx, *slos, io.Discard)
147147
if err != nil {
148-
validation.Errs = []error{fmt.Errorf("Could not generate Prometheus format rules: %w", err)}
148+
validation.Errs = []error{fmt.Errorf("could not generate Prometheus format rules: %w", err)}
149149
}
150150
continue
151151
}
152152

153-
validation.Errs = []error{fmt.Errorf("Tried loading raw prometheus SLOs spec, it couldn't: %w", promErr)}
153+
validation.Errs = []error{fmt.Errorf("tried loading raw prometheus SLOs spec, it couldn't: %w", promErr)}
154154

155155
case kubeYAMLLoader.IsSpecType(ctx, dataB):
156156
sloGroup, k8sErr := kubeYAMLLoader.LoadSpec(ctx, dataB)
@@ -162,22 +162,22 @@ func (v validateCommand) Run(ctx context.Context, config RootConfig) error {
162162
continue
163163
}
164164

165-
validation.Errs = []error{fmt.Errorf("Tried loading Kubernetes prometheus SLOs spec, it couldn't: %w", k8sErr)}
165+
validation.Errs = []error{fmt.Errorf("tried loading Kubernetes prometheus SLOs spec, it couldn't: %w", k8sErr)}
166166

167167
case openSLOYAMLLoader.IsSpecType(ctx, dataB):
168168
slos, openSLOErr := openSLOYAMLLoader.LoadSpec(ctx, dataB)
169169
if openSLOErr == nil {
170170
err := gen.GenerateOpenSLO(ctx, *slos, io.Discard)
171171
if err != nil {
172-
validation.Errs = []error{fmt.Errorf("Could not generate OpenSLO format rules: %w", err)}
172+
validation.Errs = []error{fmt.Errorf("could not generate OpenSLO format rules: %w", err)}
173173
}
174174
continue
175175
}
176176

177-
validation.Errs = []error{fmt.Errorf("Tried loading OpenSLO SLOs spec, it couldn't: %s", openSLOErr)}
177+
validation.Errs = []error{fmt.Errorf("tried loading OpenSLO SLOs spec, it couldn't: %s", openSLOErr)}
178178

179179
default:
180-
validation.Errs = []error{fmt.Errorf("Unknown spec type")}
180+
validation.Errs = []error{fmt.Errorf("unknown spec type")}
181181
}
182182
}
183183

docker/dev/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM golang:1.24
1+
FROM golang:1.25
22

33
LABEL org.opencontainers.image.source=https://github.com/slok/sloth
44

5-
ARG GOLANGCI_LINT_VERSION="1.64.8"
6-
ARG MOCKERY_VERSION="3.1.0"
5+
ARG GOLANGCI_LINT_VERSION="2.4.0"
6+
ARG MOCKERY_VERSION="3.5.4"
77
ARG GOMARKDOC_VERSION="1.1.0"
88
ARG HELM_VERSION="3.17.0"
99
ARG YAEGI_VERSION="0.16.1"

0 commit comments

Comments
 (0)