Skip to content

Commit 3f8ad74

Browse files
authored
Cut v4.0.0 release (#20)
1 parent 94e4e83 commit 3f8ad74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+173
-157
lines changed

CHANGELOG.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
9+
## [v4.0.0] - 2024-04-21
810
### Changed
9-
- Updated minimum Go version to `v1.22`.
11+
- **BREAKING CHANGE** Changed module path from `github.com/jthomperoo/k8shorizmetrics/v3` to
12+
`github.com/jthomperoo/k8shorizmetrics/v4`.
1013
- **BREAKING CHANGE** Types now use JSON tags which match Kubernetes convention, with naming using camel case rather
11-
than snake case. For example the Resource Metric field `PodMetricsInfo` is now serialized as `podMetricsInfo` rather
14+
than snake case. For example the Resource Metric field `PodMetricsInfo` is now serialised as `podMetricsInfo` rather
1215
than `pod_metrics_info`.
16+
- Updated minimum Go version to `v1.22`.
1317

1418
## [v3.0.0] - 2024-03-21
1519
### Changed
@@ -61,7 +65,8 @@ call time as a parameter.
6165
- Allows insights into how the HPA makes decisions.
6266
- Supports scaling to and from 0.
6367

64-
[Unreleased]: https://github.com/jthomperoo/k8shorizmetrics/compare/v3.0.0...HEAD
68+
[Unreleased]: https://github.com/jthomperoo/k8shorizmetrics/compare/v4.0.0...HEAD
69+
[v4.0.0]: https://github.com/jthomperoo/k8shorizmetrics/compare/v3.0.0...v4.0.0
6570
[v3.0.0]: https://github.com/jthomperoo/k8shorizmetrics/compare/v2.0.2...v3.0.0
6671
[v2.0.2]: https://github.com/jthomperoo/k8shorizmetrics/compare/v2.0.1...v2.0.2
6772
[v2.0.1]: https://github.com/jthomperoo/k8shorizmetrics/compare/v2.0.0...v2.0.1

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![Build](https://github.com/jthomperoo/k8shorizmetrics/workflows/main/badge.svg)](https://github.com/jthomperoo/k8shorizmetrics/actions)
2-
[![go.dev](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat)](https://pkg.go.dev/github.com/jthomperoo/k8shorizmetrics/v3)
2+
[![go.dev](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat)](https://pkg.go.dev/github.com/jthomperoo/k8shorizmetrics/v4)
33
[![Go Report
4-
Card](https://goreportcard.com/badge/github.com/jthomperoo/k8shorizmetrics/v3)](https://goreportcard.com/report/github.com/jthomperoo/k8shorizmetrics/v3)
4+
Card](https://goreportcard.com/badge/github.com/jthomperoo/k8shorizmetrics/v4)](https://goreportcard.com/report/github.com/jthomperoo/k8shorizmetrics/v4)
55
[![License](https://img.shields.io/:license-apache-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
66

77
# k8shorizmetrics
@@ -13,7 +13,7 @@ to work out the target replica count that the HPA does.
1313
## Install
1414

1515
```bash
16-
go get -u github.com/jthomperoo/k8shorizmetrics/v3@v3.0.0
16+
go get -u github.com/jthomperoo/k8shorizmetrics/v4@v4.0.0
1717
```
1818

1919
## Features
@@ -89,7 +89,7 @@ func main() {
8989

9090
## Documentation
9191

92-
See the [Go doc](https://pkg.go.dev/github.com/jthomperoo/k8shorizmetrics/v3).
92+
See the [Go doc](https://pkg.go.dev/github.com/jthomperoo/k8shorizmetrics/v4).
9393

9494
## Migration
9595

@@ -138,6 +138,17 @@ if err != nil {
138138

139139
You can use similar code for the `Evaluate` method of the `Evaluater`.
140140

141+
### From v3 to v4
142+
143+
To update to `v4` you will need to update all references in your code that refer to
144+
`github.com/jthomperoo/k8shorizmetrics/v3` to use `github.com/jthomperoo/k8shorizmetrics/v4`.
145+
146+
The only behaviour change is around serialisation into JSON. Fields are now serialised using camel case rather
147+
than snake case to match the Kubernetes conventions.
148+
149+
If you are relying on JSON serialised values you need to use camel case now. For example the Resource Metric field
150+
`PodMetricsInfo` is now serialised as `podMetricsInfo` ratherthan `pod_metrics_info`.
151+
141152
## Examples
142153

143154
See the [examples directory](./examples/) for some examples, [cpuprint](./examples/cpuprint/) is a good start.

evaluate.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ package k8shorizmetrics
3030
import (
3131
"fmt"
3232

33-
"github.com/jthomperoo/k8shorizmetrics/v3/internal/external"
34-
"github.com/jthomperoo/k8shorizmetrics/v3/internal/object"
35-
"github.com/jthomperoo/k8shorizmetrics/v3/internal/pods"
36-
"github.com/jthomperoo/k8shorizmetrics/v3/internal/replicas"
37-
"github.com/jthomperoo/k8shorizmetrics/v3/internal/resource"
38-
"github.com/jthomperoo/k8shorizmetrics/v3/metrics"
33+
"github.com/jthomperoo/k8shorizmetrics/v4/internal/external"
34+
"github.com/jthomperoo/k8shorizmetrics/v4/internal/object"
35+
"github.com/jthomperoo/k8shorizmetrics/v4/internal/pods"
36+
"github.com/jthomperoo/k8shorizmetrics/v4/internal/replicas"
37+
"github.com/jthomperoo/k8shorizmetrics/v4/internal/resource"
38+
"github.com/jthomperoo/k8shorizmetrics/v4/metrics"
3939
autoscalingv2 "k8s.io/api/autoscaling/v2"
4040
)
4141

evaluate_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import (
2121
"testing"
2222

2323
"github.com/google/go-cmp/cmp"
24-
"github.com/jthomperoo/k8shorizmetrics/v3"
25-
"github.com/jthomperoo/k8shorizmetrics/v3/internal/fake"
26-
"github.com/jthomperoo/k8shorizmetrics/v3/metrics"
24+
"github.com/jthomperoo/k8shorizmetrics/v4"
25+
"github.com/jthomperoo/k8shorizmetrics/v4/internal/fake"
26+
"github.com/jthomperoo/k8shorizmetrics/v4/metrics"
2727
v2 "k8s.io/api/autoscaling/v2"
2828
)
2929

examples/cpuandmemoryreplicaprint/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.22.0
55
toolchain go1.22.2
66

77
require (
8-
github.com/jthomperoo/k8shorizmetrics/v3 v3.0.0
8+
github.com/jthomperoo/k8shorizmetrics/v4 v4.0.0
99
k8s.io/api v0.30.0
1010
k8s.io/apimachinery v0.30.0
1111
k8s.io/client-go v0.30.0
@@ -57,4 +57,4 @@ require (
5757
sigs.k8s.io/yaml v1.4.0 // indirect
5858
)
5959

60-
replace github.com/jthomperoo/k8shorizmetrics/v3 => ../../
60+
replace github.com/jthomperoo/k8shorizmetrics/v4 => ../../

examples/cpuandmemoryreplicaprint/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import (
2323
"path/filepath"
2424
"time"
2525

26-
"github.com/jthomperoo/k8shorizmetrics/v3"
27-
"github.com/jthomperoo/k8shorizmetrics/v3/metricsclient"
28-
"github.com/jthomperoo/k8shorizmetrics/v3/podsclient"
26+
"github.com/jthomperoo/k8shorizmetrics/v4"
27+
"github.com/jthomperoo/k8shorizmetrics/v4/metricsclient"
28+
"github.com/jthomperoo/k8shorizmetrics/v4/podsclient"
2929
v2 "k8s.io/api/autoscaling/v2"
3030
corev1 "k8s.io/api/core/v1"
3131
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

examples/cpuprint/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.22.0
55
toolchain go1.22.2
66

77
require (
8-
github.com/jthomperoo/k8shorizmetrics/v3 v3.0.0
8+
github.com/jthomperoo/k8shorizmetrics/v4 v4.0.0
99
k8s.io/api v0.30.0
1010
k8s.io/apimachinery v0.30.0
1111
k8s.io/client-go v0.30.0
@@ -57,4 +57,4 @@ require (
5757
sigs.k8s.io/yaml v1.4.0 // indirect
5858
)
5959

60-
replace github.com/jthomperoo/k8shorizmetrics/v3 => ../../
60+
replace github.com/jthomperoo/k8shorizmetrics/v4 => ../../

examples/cpuprint/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import (
2121
"path/filepath"
2222
"time"
2323

24-
"github.com/jthomperoo/k8shorizmetrics/v3"
25-
"github.com/jthomperoo/k8shorizmetrics/v3/metricsclient"
26-
"github.com/jthomperoo/k8shorizmetrics/v3/podsclient"
24+
"github.com/jthomperoo/k8shorizmetrics/v4"
25+
"github.com/jthomperoo/k8shorizmetrics/v4/metricsclient"
26+
"github.com/jthomperoo/k8shorizmetrics/v4/podsclient"
2727
v2 "k8s.io/api/autoscaling/v2"
2828
corev1 "k8s.io/api/core/v1"
2929
"k8s.io/apimachinery/pkg/labels"

examples/cpureplicaprint/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.22.0
55
toolchain go1.22.2
66

77
require (
8-
github.com/jthomperoo/k8shorizmetrics/v3 v3.0.0
8+
github.com/jthomperoo/k8shorizmetrics/v4 v4.0.0
99
k8s.io/api v0.30.0
1010
k8s.io/apimachinery v0.30.0
1111
k8s.io/client-go v0.30.0
@@ -57,4 +57,4 @@ require (
5757
sigs.k8s.io/yaml v1.4.0 // indirect
5858
)
5959

60-
replace github.com/jthomperoo/k8shorizmetrics/v3 => ../../
60+
replace github.com/jthomperoo/k8shorizmetrics/v4 => ../../

examples/cpureplicaprint/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import (
2222
"path/filepath"
2323
"time"
2424

25-
"github.com/jthomperoo/k8shorizmetrics/v3"
26-
"github.com/jthomperoo/k8shorizmetrics/v3/metricsclient"
27-
"github.com/jthomperoo/k8shorizmetrics/v3/podsclient"
25+
"github.com/jthomperoo/k8shorizmetrics/v4"
26+
"github.com/jthomperoo/k8shorizmetrics/v4/metricsclient"
27+
"github.com/jthomperoo/k8shorizmetrics/v4/podsclient"
2828
v2 "k8s.io/api/autoscaling/v2"
2929
corev1 "k8s.io/api/core/v1"
3030
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

0 commit comments

Comments
 (0)