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

fix #4478: status handling was inserting an explicit missing node #4480

Merged
merged 1 commit into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
### 6.2-SNAPSHOT

#### Bugs
* Fix #3733: The authentication command from the .kube/config won't be discarded if no arguments are specified
* Fix #4312: fix timestamp can't be deserialized for IstioCondition
* Fix #4369: Informers will retry with a backoff on list/watch failure as they did in 5.12 and prior.
* Fix #4350: SchemaSwap annotation is now repeatable and is applied multiple times if classes are used more than once in the class hierarchy.
* Fix #3733: The authentication command from the .kube/config won't be discarded if no arguments are specified
* Fix #4460: removing split packages. Converting Default clients into adapters rather than real instances.
* Fix #4426: [java-generator] Encode an `AnyType` instead of an Object if `x-kubernetes-preserve-unknown-fields` is present and the type is null.
* Fix #4441: corrected patch base handling for the patch methods available from a Resource - resource(item).patch() will be evaluated as resource(latest).patch(item). Also undeprecated patch(item), which is consistent with leaving patch(context, item) undeprecated as well. For consistency with the other operations (such as edit), patch(item) will use the context item as the base when available, or the server side item when not. This means that patch(item) is only the same as resource(item).patch() when the patch(item) is called when the context item is missing or is the same as the latest.
* Fix #4442: TokenRefreshInterceptor doesn't overwrite existing OAuth token with empty string
* Fix #4350: SchemaSwap annotation is now repeatable and is applied multiple times if classes are used more than once in the class hierarchy.
* Fix #4459: Fixed OSGi startup exceptions while using KubernetesClient/OpenShiftClient
* Fix #4482: Fixing blocking behavior of okhttp log watch
* Fix #4460: removing split packages. Converting Default clients into adapters rather than real instances.
* Fix #4473: Fix regression in backoff interval introduced in #4365
* Fix #4426: [java-generator] Encode an `AnyType` instead of an Object if `x-kubernetes-preserve-unknown-fields` is present and the type is null.
* Fix #4478: Removing the resourceVersion bump with null status
* Fix #4482: Fixing blocking behavior of okhttp log watch

#### Improvements
* Fix #4471: Adding KubernetesClientBuilder.withHttpClientBuilderConsumer to further customize the HttpClient for any implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public MockResponse handle(String path, String contentType, String requestBody)
final JsonNode updatedResource;
if (isStatusPath(path)) {
updatedResource = currentResource.deepCopy();
setStatus(updatedResource, fullPatch.path(STATUS));
setStatus(updatedResource, fullPatch.get(STATUS));
} else {
updatedResource = fullPatch;
// preserve original status (PATCH requests to the custom resource ignore changes to the status stanza)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public MockResponse handle(String path, String contentType, String requestBody)
final JsonNode updatedResource;
if (isStatusPath(path)) {
updatedResource = currentResource.deepCopy();
setStatus(updatedResource, persistence.asNode(requestBody).path(STATUS));
setStatus(updatedResource, persistence.asNode(requestBody).get(STATUS));
} else {
updatedResource = persistence.asNode(requestBody);
// preserve original status (PUT requests to the custom resource ignore changes to the status stanza)
if (persistence.isStatusSubresourceEnabledForResource(path)) {
setStatus(updatedResource, currentResource.path(STATUS));
setStatus(updatedResource, currentResource.get(STATUS));
}
}
validatePath(attributes, updatedResource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,30 @@ void testStatusPatch() {
assertNotNull(result.getStatus());
}

@Test
void testNullStatus() {
CronTab cronTab = createCronTab("my-new-cron-object", "* * * * */5", 3, "my-awesome-cron-image");

NonNamespaceOperation<CronTab, KubernetesResourceList<CronTab>, Resource<CronTab>> cronTabClient = client
.resources(CronTab.class).inNamespace("test-ns");

CronTab result = cronTabClient.resource(cronTab).create();

// should be null after create
assertNull(result.getStatus());
String resourceVersion = result.getMetadata().getResourceVersion();

// should be a no-op
result = cronTabClient.resource(result).patchStatus();
assertNull(result.getStatus());
assertEquals(resourceVersion, result.getMetadata().getResourceVersion());

// should be a no-op
result = cronTabClient.resource(result).replace();
assertNull(result.getStatus());
assertEquals(resourceVersion, result.getMetadata().getResourceVersion());
}

void assertCronTab(CronTab cronTab, String name, String cronTabSpec, int replicas, String image) {
assertEquals(name, cronTab.getMetadata().getName());
assertEquals(cronTabSpec, cronTab.getSpec().getCronSpec());
Expand Down