Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/v0.13.0 #10

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/helmrelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
version: v3.7.1

- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.4.1
uses: helm/chart-releaser-action@v1.6.0
with:
charts_dir: deploy/kubernetes/helm
env:
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

## [Unreleased]

## [v0.13.2] - 2024-10-31

- Add forgotten v0.13.1 changelog entry [#9](https://github.com/linode-obs/sloth/pull/9)
- Fix buildvcs issues with test scripts [#9](https://github.com/linode-obs/sloth/pull/9)
- Bump golang version from 1.19.3 to 1.23 [#9](https://github.com/linode-obs/sloth/pull/9)
- Bump golangci-lint version from 1.50.0 to 1.61.0 [#9](https://github.com/linode-obs/sloth/pull/9)
- Bump helm-chart-releaser action from v1.4.1 to v1.6.0 [#9](https://github.com/linode-obs/sloth/pull/9)
- Ran `go mod tidy` [#9](https://github.com/linode-obs/sloth/pull/9)
- update test cases for new info labels
- remove info labels from K8sMeta spec

## [v0.13.1] - 2024-10-30

- disable buildvcs [#8](https://github.com/linode-obs/sloth/pull/8)

## [v0.13.0] - 2024-10-30

- Custom labels for `sloth_slo_info{}` metric [#4](https://github.com/linode-obs/sloth/pull/4)
Expand Down
4 changes: 2 additions & 2 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM golang:1.19.3
FROM golang:1.23

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

ARG GOLANGCI_LINT_VERSION="1.50.0"
ARG GOLANGCI_LINT_VERSION="1.61.0"
ARG MOCKERY_VERSION="2.14.0"
ARG GOMARKDOC_VERSION="0.4.1"
ARG HELM_VERSION="3.10.0"
Expand Down
8 changes: 4 additions & 4 deletions docker/prod/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Set also `ARCH` ARG here so we can use it on all the `FROM`s.
# Set also `ARCH` ARG here so we can use it on all the `FROM`s.
ARG ARCH

FROM golang:1.19.3-alpine as build-stage
FROM golang:1.23-alpine as build-stage

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

Expand All @@ -26,10 +26,10 @@ RUN ./scripts/build/bin/build-raw.sh

# Although we are on an specific architecture (normally linux/amd64) our go binary has been built for
# ${ARCH} specific architecture.
# To make portable our building process we base our final image on that same architecture as the binary
# To make portable our building process we base our final image on that same architecture as the binary
# to obtain a resulting ${ARCH} image independently where we are building this image.
FROM gcr.io/distroless/static:nonroot-${ARCH}

COPY --from=build-stage /src/bin/sloth /usr/local/bin/sloth

ENTRYPOINT ["/usr/local/bin/sloth"]
ENTRYPOINT ["/usr/local/bin/sloth"]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/slok/sloth

go 1.19
go 1.23

require (
github.com/OpenSLO/oslo v0.2.2-0.20210629193748-b882029ce777
Expand Down
50 changes: 50 additions & 0 deletions go.sum

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions internal/k8sprometheus/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ var prometheusServiceLevelFakes = []runtime.Object{
Labels: map[string]string{
"slo01k1": "slo01v1",
},
InfoLabels: map[string]string{
"foo": "bar",
},
SLI: slothv1.SLI{Events: &slothv1.SLIEvents{
ErrorQuery: `sum(rate(http_request_duration_seconds_count{job="myservice",code=~"(5..|429)"}[{{.window}}]))`,
TotalQuery: `sum(rate(http_request_duration_seconds_count{job="myservice"}[{{.window}}]))`,
Expand Down
1 change: 0 additions & 1 deletion internal/k8sprometheus/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ type K8sMeta struct {
Namespace string
Annotations map[string]string
Labels map[string]string
InfoLabels map[string]string
}

// SLOGroup is a Kubernetes SLO group. Is created based on a regular Prometheus
Expand Down
3 changes: 3 additions & 0 deletions internal/k8sprometheus/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func getGoodSLO(name string) prometheus.SLO {
"owner": "myteam",
"category": "test",
},
InfoLabels: map[string]string{
"foo": "bar",
},
PageAlertMeta: prometheus.AlertMeta{
Disable: false,
Name: "testAlert",
Expand Down
5 changes: 5 additions & 0 deletions internal/k8sprometheus/spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ spec:
- name: "slo1"
labels:
category: test
infoLabels:
foo: bar
objective: 99.99999
description: "This is a test."
sli:
Expand Down Expand Up @@ -299,6 +301,9 @@ spec:
"owner": "myteam",
"category": "test",
},
InfoLabels: map[string]string{
"foo": "bar",
},
PageAlertMeta: prometheus.AlertMeta{
Disable: false,
Name: "testAlert",
Expand Down
4 changes: 4 additions & 0 deletions internal/prometheus/recording_rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,9 @@ func TestGenerateMetaRecordingRules(t *testing.T) {
Labels: map[string]string{
"kind": "test",
},
InfoLabels: map[string]string{
"foo": "bar",
},
},
alertGroup: getAlertGroup(),
expRules: []rulefmt.Rule{
Expand Down Expand Up @@ -608,6 +611,7 @@ slo:error_budget:ratio{sloth_id="test", sloth_service="test-svc", sloth_slo="tes
"sloth_mode": "test",
"sloth_spec": "test/v1",
"sloth_objective": "99.9",
"foo": "bar",
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions scripts/check/unit-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
set -o errexit
set -o nounset

go test -race -coverprofile=.test_coverage.txt $(go list ./... | grep -v /test/integration )
go tool cover -func=.test_coverage.txt | tail -n1 | awk '{print "Total test coverage: " $3}'
go test -buildvcs=false -race -coverprofile=.test_coverage.txt $(go list ./... | grep -v /test/integration )
go tool cover -func=.test_coverage.txt | tail -n1 | awk '{print "Total test coverage: " $3}'
Loading