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

1.0.0-rc3 Error "None of the given media types are supported" #1398

Closed
tugtugtug opened this issue Nov 8, 2023 · 5 comments
Closed

1.0.0-rc3 Error "None of the given media types are supported" #1398

tugtugtug opened this issue Nov 8, 2023 · 5 comments

Comments

@tugtugtug
Copy link

tugtugtug commented Nov 8, 2023

Describe the bug
When any patch functions are called, such as patchNamespacedStatefulSet, the client throws "None of the given media types are supported"

** Client Version **
e.g. 1.0.0-rc3

** Server Version **
e.g. 1.25.1

To Reproduce
Steps to reproduce the behavior:

  • make a call to patchNamespacedStatefulSet with any parameters

Expected behavior
The patch functions should work. And in addition to be working, I'm also not sure how the API will figure out which mediaType to prefer given the content of the body. The old api allows overriding the headers via the options, now this is no longer available.

** Example Code**

let kubeConfig = new k8s.KubeConfig();
kubeConfig.loadFromDefault();
const k8sAppsApi = kubeConfig.makeApiClient(k8s.AppsV1Api);
// how to make sure this is done with header
// 'Content-Type': 'application/merge-patch+json'??
await k8sAppsApi.patchNamespacedStatefulSet({
			name: 'test',
			namespace: 'default',
			body: {
				spec: {
					replicas: replicas,
				},
			}
		})

Environment (please complete the following information):
OS: [Ubuntu 22.04]
NodeJS Version [18]
Cloud runtime [NA]

Additional context
Is there a general status the testing coverage of the 1.0.0 branch?
Given the release candidate tag, I had higher expectation of the quality of the code, but it seems quite hard to move forward with all these bugs.

@mstruebing
Copy link
Member

I think this is connected to #1341 and should be supported if we merge this and cut another RC.

mstruebing added a commit to mstruebing/javascript that referenced this issue Nov 22, 2023
I wanted to publish a new release for kubernetes-client#1398
but it seems like the workflow is only available on the master branch thus it means it can not get
executed in the release-1.x branch. Porting over the file and use latest node LTS in the
setup-node action.
mstruebing added a commit to mstruebing/javascript that referenced this issue Nov 28, 2023
I wanted to publish a new release for kubernetes-client#1398
but it seems like the workflow is only available on the master branch thus it means it can not get
executed in the release-1.x branch. Porting over the file and use latest node LTS in the
setup-node action.
mstruebing added a commit to mstruebing/javascript that referenced this issue Nov 28, 2023
I wanted to publish a new release for kubernetes-client#1398
but it seems like the workflow is only available on the master branch thus it means it can not get
executed in the release-1.x branch. Porting over the file and use latest node LTS in the
setup-node action.
mstruebing added a commit that referenced this issue Dec 15, 2023
I wanted to cut another RC to potentially close
* #1420
* #1398
* #1397

but the release is erroring at the test because of the memory limit
so I moved the increased memory limit node options into the npm script
rather than the Kubernetes Javascript Client - Validation workflow
mstruebing added a commit that referenced this issue Dec 15, 2023
I wanted to cut another RC to potentially close
* #1420
* #1398
* #1397

but the release is erroring at the test because of the memory limit
so I decided to use c8 instead of nyc because when trying to remove nyc
I concluded that the memory error comes from it and its last release was
4 years ago. It works as a drop-in replacement.

https://www.npmjs.com/package/c8
@mstruebing
Copy link
Member

@tugtugtug I've published a new release 1.0.0-rc4: https://www.npmjs.com/package/@kubernetes/client-node/v/1.0.0-rc4
Could you confirm that this issue is solved in this release?

@tugtugtug
Copy link
Author

Verified fixed!

@tugtugtug tugtugtug reopened this Jan 4, 2024
@tugtugtug
Copy link
Author

tugtugtug commented Jan 4, 2024

Hi @mstruebing,
I thought things were working as no errors were reported. But apparently the example that changes the content-type does not work.
e.g.

    patchNamespacedStatefulSetWithHttpInfo(name, namespace, body, pretty, dryRun, fieldManager, fieldValidation, force, _options) {
        const requestContextPromise = this.requestFactory.patchNamespacedStatefulSet(name, namespace, body, pretty, dryRun, fieldManager, fieldValidation, force, _options);
        // build promise chain
        let middlewarePreObservable = (0, rxjsStub_1.from)(requestContextPromise);
        for (let middleware of this.configuration.middleware) {
            middlewarePreObservable = middlewarePreObservable.pipe((0, rxjsStub_2.mergeMap)((ctx) => middleware.pre(ctx)));
        }

the passed _options is not used in the case, instead the object's this.configuration.middleware is used.

One workaround found, that should be future compatible.

		return createConfiguration({
			baseServer: baseServerConfig,
			middleware: [mw],
			authMethods: {
				default: {
					applySecurityAuthentication: async (req) => {
						await mw.pre(req).toPromise();
						await kc.applySecurityAuthentication(req);
					}
				},
			},
		});

Let me know if you prefer a new issue tho.

@tugtugtug
Copy link
Author

made a new issue #1499

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

No branches or pull requests

2 participants