Skip to content

Commit cacf194

Browse files
authored
Merge pull request #100 from cisco-open/dependabot/go_modules/gomod-08ac6d2c31
build(deps): bump the gomod group with 2 updates
2 parents 26241f6 + 39671a6 commit cacf194

File tree

12 files changed

+56
-273
lines changed

12 files changed

+56
-273
lines changed

.github/workflows/ci.yaml

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
go: ["1.18", "1.19", "1.20"]
16+
go: ["1.22"]
1717

1818
steps:
1919
- name: Set up Go
@@ -33,16 +33,15 @@ jobs:
3333
strategy:
3434
fail-fast: false
3535
matrix:
36-
kube: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24"]
37-
# kube: ["1.19", "1.20", "1.21", "1.22", "1.23", "1.24", "1.25", "1.26"]
36+
kube: ["1.25", "1.26", "1.27", "1.28", "1.29", "1.30"]
3837
env:
3938
KUBECONFIG: ${{ github.workspace }}/.kube/config
4039

4140
steps:
4241
- name: Set up Go
4342
uses: actions/setup-go@v5
4443
with:
45-
go-version: '1.20'
44+
go-version: '1.22'
4645

4746
- name: Checkout code
4847
uses: actions/checkout@v4
@@ -52,23 +51,18 @@ jobs:
5251
id: node_image
5352
run: |
5453
case ${{ matrix.kube }} in
55-
1.19)
56-
NODE_IMAGE=kindest/node:v1.19.16@sha256:476cb3269232888437b61deca013832fee41f9f074f9bed79f57e4280f7c48b7 ;;
57-
1.20)
58-
NODE_IMAGE=kindest/node:v1.20.15@sha256:a32bf55309294120616886b5338f95dd98a2f7231519c7dedcec32ba29699394 ;;
59-
1.21)
60-
NODE_IMAGE=kindest/node:v1.21.14@sha256:9d9eb5fb26b4fbc0c6d95fa8c790414f9750dd583f5d7cee45d92e8c26670aa1 ;;
61-
1.22)
62-
NODE_IMAGE=kindest/node:v1.22.15@sha256:7d9708c4b0873f0fe2e171e2b1b7f45ae89482617778c1c875f1053d4cef2e41 ;;
63-
1.23)
64-
NODE_IMAGE=kindest/node:v1.23.13@sha256:ef453bb7c79f0e3caba88d2067d4196f427794086a7d0df8df4f019d5e336b61 ;;
65-
1.24)
66-
NODE_IMAGE=kindest/node:v1.24.7@sha256:577c630ce8e509131eab1aea12c022190978dd2f745aac5eb1fe65c0807eb315 ;;
67-
# Integration tests don't pass on these versions due to API incompatibilities
68-
# 1.25)
69-
# NODE_IMAGE=kindest/node:v1.25.3@sha256:f52781bc0d7a19fb6c405c2af83abfeb311f130707a0e219175677e366cc45d1 ;;
70-
# 1.26)
71-
# NODE_IMAGE=kindest/node:v1.26.0@sha256:691e24bd2417609db7e589e1a479b902d2e209892a10ce375fab60a8407c7352 ;;
54+
1.25)
55+
NODE_IMAGE=kindest/node:v1.25.11@sha256:227fa11ce74ea76a0474eeefb84cb75d8dad1b08638371ecf0e86259b35be0c8 ;;
56+
1.26)
57+
NODE_IMAGE=kindest/node:v1.26.6@sha256:6e2d8b28a5b601defe327b98bd1c2d1930b49e5d8c512e1895099e4504007adb ;;
58+
1.27)
59+
NODE_IMAGE=kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72 ;;
60+
1.28)
61+
NODE_IMAGE=kindest/node:v1.28.9@sha256:9ba4d311e7861d27b210e5960e5ce921a7c53d3c67e0545fd8a1cb9a76dfa2cb ;;
62+
1.29)
63+
NODE_IMAGE=kindest/node:v1.29.4@sha256:ea40a6bd365a17f71fd3883a1d34a0791d7d6b0eb75832c6d85b6f2326827f1e ;;
64+
1.30)
65+
NODE_IMAGE=kindest/node:v1.30.0@sha256:2af5d1b382926abcd6336312d652cd045b7cc47475844a608669c71b1fefcfbc ;;
7266
esac
7367
echo "image=$NODE_IMAGE" >> $GITHUB_OUTPUT
7468
@@ -89,7 +83,7 @@ jobs:
8983
- name: Set up Go
9084
uses: actions/setup-go@v5
9185
with:
92-
go-version: '1.20'
86+
go-version: '1.22'
9387

9488
- name: Checkout code
9589
uses: actions/checkout@v4
@@ -107,7 +101,7 @@ jobs:
107101
- name: Set up Go
108102
uses: actions/setup-go@v5
109103
with:
110-
go-version: '1.20'
104+
go-version: '1.22'
111105

112106
- name: Checkout code
113107
uses: actions/checkout@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/vendor/
22
/bin/
33
/.licensei.cache
4+
.idea

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
LICENSEI_VERSION = 0.5.0
2-
GOLANGCI_VERSION = 1.51.1
1+
LICENSEI_VERSION = 0.9.0
2+
GOLANGCI_VERSION = 1.59.0
33

44
all: license fmt vet test
55

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ In certain cases there is a need to filter out certain fields when the patch gen
6565
To help in these scenarios there are the following options to be used when calculating diffs:
6666
- `IgnoreStatusFields`
6767
- `IgnoreVolumeClaimTemplateTypeMetaAndStatus`
68-
- `IgnorePDBSelector`
6968
- `IgnoreField("field-name-to-ignore")`
7069

7170
Example:
@@ -88,11 +87,6 @@ This CalculateOptions removes status fields from both objects before comparing.
8887

8988
This CalculateOption clears volumeClaimTemplate fields from both objects before comparing (applies to statefulsets).
9089

91-
#### IgnorePdbSelector
92-
93-
Checks `selector` fields of PDB objects before comparing and removes them if they match. `reflect.DeepEquals` is used for the equality check.
94-
This is required because map fields using `patchStrategy:"replace"` will always diff regardless if they are otherwise equal.
95-
9690
#### IgnoreField("field-name-to-ignore")
9791

9892
This CalculateOption removes the field provided (as a string) in the call before comparing them. A common usage might be to remove the metadata fields by using the `IgnoreField("metadata")` option.

docs/legacy.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ The legacy version was last available with the 0.1.1 version.
2020
- PersistentVolumeClaim
2121
- Service
2222
- ServiceAccount
23-
- PodDisruptionBudget
2423
- Unstructured
2524
- Node
2625

@@ -33,11 +32,11 @@ objectMatcher.Match(e.ObjectOld, e.ObjectNew)
3332

3433
### The idea
3534

36-
There are existing libraries in the wild that can calculate a patch by giving them two different objects. If the patch is empty the two objects match and we are ready, right?
35+
There are existing libraries in the wild that can calculate a patch by giving them two different objects. If the patch is empty the two objects match and we are ready, right?
3736
Well not quite. JSON Merge Patch, defined by [rfc7396](https://tools.ietf.org/html/rfc7396) replaces lists completely which is not always what we need. Kubernetes defines
3837
and uses a modified version called [strategic merge patch](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-api-machinery/strategic-merge-patch.md).
3938

40-
Strategic Merge Patch extends the JSON Merge Patch format by adding explicit directives for deleting, replacing, ordering and merging lists.
39+
Strategic Merge Patch extends the JSON Merge Patch format by adding explicit directives for deleting, replacing, ordering and merging lists.
4140
It uses the go struct tag of the API objects to determine what lists should be merged and which ones should not. Worth to note it's not tied to
4241
Kubernetes objects only, so we can use this for matching custom go structs as well.
4342

@@ -46,21 +45,21 @@ Kubernetes objects only, so we can use this for matching custom go structs as we
4645
#### Defaults and version compatibility
4746

4847
As outlined previously Kubernetes objects are amended with different default values when submitted. For example PodSpec.RestartPolicy will be set to "Always" when
49-
ommitted from the object, so we will have a mismatch when we try to compare it later. This library uses the same functions to set the default values on the local
50-
objects before matching so that they won't differ.
48+
ommitted from the object, so we will have a mismatch when we try to compare it later. This library uses the same functions to set the default values on the local
49+
objects before matching so that they won't differ.
5150

52-
Since the defaults functions are defined in the main kubernetes repo, there is a higher chance that objects decorated using these functions will be incompatible
51+
Since the defaults functions are defined in the main kubernetes repo, there is a higher chance that objects decorated using these functions will be incompatible
5352
when comparing them with objects coming from different server versions. Also since the library depends on the kubernetes repo it is more tightly coupled to it's
5453
version.
5554

56-
To preserve compatibility between the client and server versions [.circleci/config.yml](.circleci/config.yml) contains jobs that run the integration test suite against Kubernetes
55+
To preserve compatibility between the client and server versions [.circleci/config.yml](.circleci/config.yml) contains jobs that run the integration test suite against Kubernetes
5756
versions from 1.10 to 1.14. The library itself is known and tested to be working with operators depending on Kubernetes client version 1.12 and 1.13.
5857

5958
#### Generated values
6059

61-
There are values that are generated by the API Server dynamically. To workaround this the library removes null fields from the patch as long as it's not inside a list.
62-
(In case of lists, even if we remove null fields we would still left with `setElementOrder` directives)
63-
This works as long as we don't set/unset complete fields on the objects conditionally, because in that case we would miss to detect a change to unset something.
60+
There are values that are generated by the API Server dynamically. To workaround this the library removes null fields from the patch as long as it's not inside a list.
61+
(In case of lists, even if we remove null fields we would still left with `setElementOrder` directives)
62+
This works as long as we don't set/unset complete fields on the objects conditionally, because in that case we would miss to detect a change to unset something.
6463

65-
In case a field gets removed from somewhere inside a list we have to explicitly tell to ignore it. One example is NodePort in Service objects, see [service.go](service.go).
64+
In case a field gets removed from somewhere inside a list we have to explicitly tell to ignore it. One example is NodePort in Service objects, see [service.go](service.go).
6665
Another example is Volume and VolumeMount generated automatically for the service account token, see [pod.go](pod.go).

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module github.com/cisco-open/k8s-objectmatcher
22

3-
go 1.17
3+
go 1.22.0
44

55
require (
66
emperror.dev/errors v0.8.1
7-
github.com/evanphx/json-patch v5.6.0+incompatible
7+
github.com/evanphx/json-patch v5.9.0+incompatible
88
github.com/json-iterator/go v1.1.12
9-
k8s.io/apimachinery v0.19.2
9+
k8s.io/apimachinery v0.19.16
1010
)
1111

1212
require (
@@ -28,6 +28,6 @@ require (
2828
gopkg.in/yaml.v2 v2.2.8 // indirect
2929
k8s.io/klog/v2 v2.2.0 // indirect
3030
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6 // indirect
31-
sigs.k8s.io/structured-merge-diff/v4 v4.0.1 // indirect
31+
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
3232
sigs.k8s.io/yaml v1.2.0 // indirect
3333
)

0 commit comments

Comments
 (0)