Skip to content

Commit 4321598

Browse files
committed
Update deps and add support for go 1.25 and k8s 1.34
Signed-off-by: Xabier Larrakoetxea <me@slok.dev>
1 parent ff0dced commit 4321598

28 files changed

Lines changed: 315 additions & 216 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ 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:
1212
- uses: actions/checkout@v4
1313
- run: |
@@ -41,7 +41,7 @@ jobs:
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..."
@@ -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:
7777
- uses: actions/checkout@v4
7878
- uses: actions/setup-go@v5
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..."

.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

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: 5 additions & 5 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,7 +162,7 @@ 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)
@@ -174,10 +174,10 @@ func (v validateCommand) Run(ctx context.Context, config RootConfig) error {
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"

docker/prod/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Set also `ARCH` ARG here so we can use it on all the `FROM`s.
22
ARG ARCH
33

4-
FROM golang:1.24.4-alpine as build-stage
4+
FROM golang:1.25-alpine as build-stage
55

66
LABEL org.opencontainers.image.source=https://github.com/slok/sloth
77

examples/_gen/k8s-getting-started.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
apiVersion: monitoring.coreos.com/v1
77
kind: PrometheusRule
88
metadata:
9-
creationTimestamp: null
109
labels:
1110
app.kubernetes.io/component: SLO
1211
app.kubernetes.io/managed-by: sloth

examples/_gen/k8s-home-wifi.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
apiVersion: monitoring.coreos.com/v1
77
kind: PrometheusRule
88
metadata:
9-
creationTimestamp: null
109
labels:
1110
app: sloth
1211
app.kubernetes.io/component: SLO

examples/_gen/k8s-multifile.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
apiVersion: monitoring.coreos.com/v1
77
kind: PrometheusRule
88
metadata:
9-
creationTimestamp: null
109
labels:
1110
app.kubernetes.io/component: SLO
1211
app.kubernetes.io/managed-by: sloth
@@ -265,7 +264,6 @@ spec:
265264
apiVersion: monitoring.coreos.com/v1
266265
kind: PrometheusRule
267266
metadata:
268-
creationTimestamp: null
269267
labels:
270268
app.kubernetes.io/component: SLO
271269
app.kubernetes.io/managed-by: sloth

examples/_gen/plugin-k8s-getting-started.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
apiVersion: monitoring.coreos.com/v1
77
kind: PrometheusRule
88
metadata:
9-
creationTimestamp: null
109
labels:
1110
app: sloth
1211
app.kubernetes.io/component: SLO

0 commit comments

Comments
 (0)