Skip to content

Commit bfaab33

Browse files
committed
Update README and CHANGELOG
1 parent 3aee3dc commit bfaab33

File tree

3 files changed

+52
-11
lines changed

3 files changed

+52
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.16.0
4+
5+
- Make all resources `Sendable`
6+
37
## 0.15.0
48

59
- Update to Kubernetes v1.32.0

README.md

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,23 @@
4040
- [x] Model structs for all Kubernetes objects
4141
- [x] `Codable` support
4242
- [x] `Hashable` resources
43+
- [x] `Sendable` support
4344
- [x] Closure-based builders for convenient object composition
4445
- [x] Type-erased wrappers for Kubernetes resources
4546
- [x] `UnstructuredResource` type for handling any Kubernetes resource
4647

4748
## Compatibility Matrix
4849

49-
| | 1.25.9 | 1.26.4 | 1.28.0 | 1.28.3 | 1.29.6 | 1.32.0 |
50-
|----------|--------|--------|--------|--------|--------|--------|
51-
| `0.9.x` || - | - | - | - | - |
52-
| `0.10.x` | - || - | - | - | - |
53-
| `0.11.x` | - || - | - | - | - |
54-
| `0.12.x` | - | - || - | - | - |
55-
| `0.13.x` | - | - | - ||| - |
56-
| `0.14.x` | - | - | - | - || - |
57-
| `0.15.x` | - | - | - | - | - ||
50+
| | 1.25.9 | 1.26.4 | 1.28.0 | 1.28.3 | 1.29.6 | 1.32.0 | 1.32.0 |
51+
|----------|--------|--------|--------|--------|--------|--------|--------|
52+
| `0.9.x` || - | - | - | - | - | - |
53+
| `0.10.x` | - || - | - | - | - | - |
54+
| `0.11.x` | - || - | - | - | - | - |
55+
| `0.12.x` | - | - || - | - | - | - |
56+
| `0.13.x` | - | - | - ||| - | - |
57+
| `0.14.x` | - | - | - | - || - | - |
58+
| `0.15.x` | - | - | - | - | - |||
59+
| `0.16.x` | - | - | - | - | - |||
5860

5961
- `` Exact match of API objects in both model and the Kubernetes version.
6062
- `-` API objects mismatches either due to the removal of old API or the addition of new API. However, everything the
@@ -183,6 +185,39 @@ let deployment = apps.v1.Deployment(
183185
)
184186
```
185187

188+
### Sendables
189+
190+
All resources are `Sendable` structs.
191+
192+
There is, however, one caveat when working with resources having a `JSONObject` field:
193+
194+
- `apiextensions.v1.CustomResourceValidation`
195+
- `apps.v1.ControllerRevision`
196+
- `meta.v1.ManagedFieldsEntry`
197+
- `meta.v1.WatchEvent`
198+
- `resource.v1alpha3.AllocatedDeviceStatus`
199+
- `resource.v1alpha3.OpaqueDeviceConfiguration`
200+
201+
or when working with `UnstructuredResource`.
202+
203+
They store their properties as `Dictionary<String, any Sendable>`. Thus, dictionary literals must be
204+
explicitly cast to `[String: any Sendable]`.
205+
206+
For example:
207+
208+
```swift
209+
UnstructuredResource(properties: [
210+
"apiVersion": "v1",
211+
"kind": "ConfigMap",
212+
"metadata": meta.v1.ObjectMeta(name: "configs", namespace: "default"),
213+
"data": [
214+
"foo": 42,
215+
"bar": "baz"
216+
] as [String: any Sendable]
217+
])
218+
```
219+
220+
186221
### Builders
187222

188223
From the above example it is clear, that a certain knowledge of all the subtypes and their API groups is required, in
@@ -415,7 +450,7 @@ print(spec?["cronSpec"])
415450
To use the `SwiftkubeModel` in a SwiftPM project, add the following line to the dependencies in your `Package.swift` file:
416451

417452
```swift
418-
.package(name: "SwiftkubeModel", url: "https://github.com/swiftkube/model.git", from: "0.14.0")
453+
.package(name: "SwiftkubeModel", url: "https://github.com/swiftkube/model.git", from: "0.16.0")
419454
```
420455

421456
then include it as a dependency in your target:
@@ -426,7 +461,7 @@ import PackageDescription
426461
let package = Package(
427462
// ...
428463
dependencies: [
429-
.package(name: "SwiftkubeModel", url: "https://github.com/swiftkube/model.git", from: "0.14.0")
464+
.package(name: "SwiftkubeModel", url: "https://github.com/swiftkube/model.git", from: "0.16.0")
430465
],
431466
targets: [
432467
.target(name: "<your-target>", dependencies: [

Sources/Model/JSONObject.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import Foundation
2525
/// - apps.v1.ControllerRevision
2626
/// - meta.v1.ManagedFieldsEntry
2727
/// - meta.v1.WatchEvent
28+
/// - resource.v1alpha3.AllocatedDeviceStatus
29+
/// - resource.v1alpha3.OpaqueDeviceConfiguration
2830
///
2931
/// in order to allow for implementing ``Hashable`` protocol
3032
///

0 commit comments

Comments
 (0)