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

Mock server support for rolling restart #6658

Closed
dkaukov opened this issue Nov 25, 2024 · 1 comment · Fixed by #6723
Closed

Mock server support for rolling restart #6658

dkaukov opened this issue Nov 25, 2024 · 1 comment · Fixed by #6723
Assignees
Milestone

Comments

@dkaukov
Copy link
Contributor

dkaukov commented Nov 25, 2024

Describe the bug

Attempt to execute rolling restart on the Mock server, failing with error: Message: Unsupported Media Type.

Fabric8 Kubernetes Client version

6.13.4

Steps to reproduce

  • Configure Mock server in crud mode @EnableKubernetesMockClient(crud = true)
  • Create resource, for example Deployment
  • Execute rolling restart:
kubernetesClient.apps()
      .deployments()
      .inNamespace("ns")
      .withName("app01r")
      .rolling().restart();

Expected behavior

to work, ;)

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

1.25.3@latest

Environment

macOS

Fabric8 Kubernetes Client Logs

io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: PATCH at: https://localhost:57979/apis/apps/v1/namespaces/infra/deployments/mike-vd-server. Message: Unsupported Media Type. Received status: Status(apiVersion=v1, code=415, details=StatusDetails(causes=[], group=null, kind=Unknown, name=null, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=Unsupported Media Type, metadata=null, reason=Invalid, status=Failure, additionalProperties={}).

	at io.fabric8.kubernetes.client.KubernetesClientException.copyAsCause(KubernetesClientException.java:238)
	at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.waitForResult(OperationSupport.java:507)
	at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.handleResponse(OperationSupport.java:524)
	at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.handlePatch(OperationSupport.java:419)
	at io.fabric8.kubernetes.client.dsl.internal.HasMetadataOperation.patch(HasMetadataOperation.java:268)
	at io.fabric8.kubernetes.client.dsl.internal.HasMetadataOperation.patch(HasMetadataOperation.java:44)
	at io.fabric8.kubernetes.client.dsl.internal.apps.v1.RollingUpdater.applyPatch(RollingUpdater.java:173)
	at io.fabric8.kubernetes.client.dsl.internal.apps.v1.RollingUpdater.restart(RollingUpdater.java:185)
	at io.fabric8.kubernetes.client.dsl.internal.apps.v1.DeploymentOperationsImpl.restart(DeploymentOperationsImpl.java:102)
	at io.fabric8.kubernetes.client.dsl.internal.apps.v1.DeploymentOperationsImpl.restart(DeploymentOperationsImpl.java:52)
	at com.opentable.instanceno.machine.KubernetesClientTest.testGetDeployment(KubernetesClientTest.java:121)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: PATCH at: https://localhost:57979/apis/apps/v1/namespaces/infra/deployments/mike-vd-server. Message: Unsupported Media Type. Received status: Status(apiVersion=v1, code=415, details=StatusDetails(causes=[], group=null, kind=Unknown, name=null, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=Unsupported Media Type, metadata=null, reason=Invalid, status=Failure, additionalProperties={}).
	at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.requestFailure(OperationSupport.java:660)
	at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.requestFailure(OperationSupport.java:640)
	at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.assertResponseCode(OperationSupport.java:589)
	at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.lambda$handleResponse$0(OperationSupport.java:549)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
	at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
	at io.fabric8.kubernetes.client.http.StandardHttpClient.lambda$completeOrCancel$10(StandardHttpClient.java:141)
	at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
	at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
	at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
	at io.fabric8.kubernetes.client.http.ByteArrayBodyHandler.onBodyDone(ByteArrayBodyHandler.java:51)
	at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
	at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
	at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
	at io.fabric8.kubernetes.client.okhttp.OkHttpClientImpl$OkHttpAsyncBody.doConsume(OkHttpClientImpl.java:136)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

Additional context

It seems like rolling restarts using application/strategic-merge-patch+json https://github.com/fabric8io/kubernetes-client/pull/2272/files, but Mock server not supporting strategic merges.

@mikebell90
Copy link

Duplicate #2516 and similar

dkaukov added a commit to dkaukov/kubernetes-client that referenced this issue Dec 16, 2024
@manusa manusa moved this to In Progress in Eclipse JKube Dec 23, 2024
@manusa manusa moved this from In Progress to Planned in Eclipse JKube Jan 9, 2025
@manusa manusa moved this from Planned to In Progress in Eclipse JKube Jan 16, 2025
manusa pushed a commit to dkaukov/kubernetes-client that referenced this issue Jan 16, 2025
@manusa manusa added this to the 7.1.0 milestone Jan 16, 2025 — with automated-tasks
@manusa manusa moved this from In Progress to Review in Eclipse JKube Jan 16, 2025
@manusa manusa closed this as completed in 40a7763 Jan 16, 2025
@github-project-automation github-project-automation bot moved this from Review to Done in Eclipse JKube Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants