godaddy / godaddy/kubernetes-client

Ensure webpack will work with (or ignore) static swagger definitions

Open
#273 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
JavaScript
Stars
962
Forks
189
PR merge metrics
No merged PRs in 30d

Description

I used this...
```
const Client = require('kubernetes-client').Client;
const config = require('kubernetes-client').config;
const client = new Client({ config: config.fromKubeconfig(), version: '1.8' });
```

and got this...
```
WARNING in ./~/kubernetes-client/lib/request.js
Critical dependencies:
13:21-59 the request of a dependency is an expression
@ ./~/kubernetes-client/lib/request.js 13:21-59

WARNING in ./~/kubernetes-client/lib/specs/swagger-1.9.json.gz
Module parse failed: /mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/kubernetes-client/lib/specs/swagger-1.9.json.gz Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '' (1:0)
at Parser.pp$4.raise (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp$7.getTokenFromCode (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:2756:10)
at Parser.pp$7.readToken (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:2477:17)
at Parser.pp$7.nextToken (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:2468:15)
at Parser.parse (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:515:10)
at Object.parse (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:3098:39)
at Parser.parse (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/lib/Parser.js:902:15)
at NormalModule. (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/lib/NormalModule.js:104:16)
at NormalModule.onModuleBuild (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
at nextLoader (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25)
at /mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5
at Storage.finished (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16)
at /mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/graceful-fs/graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
@ ./~/kubernetes-client/lib ^\.\/.*$

WARNING in ./~/kubernetes-client/lib/specs/swagger-1.8.json.gz
Module parse failed: /mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/kubernetes-client/lib/specs/swagger-1.8.json.gz Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '' (1:0)
at Parser.pp$4.raise (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp$7.getTokenFromCode (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:2756:10)
at Parser.pp$7.readToken (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:2477:17)
at Parser.pp$7.nextToken (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:2468:15)
at Parser.parse (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:515:10)
at Object.parse (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:3098:39)
at Parser.parse (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/lib/Parser.js:902:15)
at NormalModule. (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/lib/NormalModule.js:104:16)
at NormalModule.onModuleBuild (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
at nextLoader (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25)
at /mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5
at Storage.finished (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16)
at /mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/graceful-fs/graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
@ ./~/kubernetes-client/lib ^\.\/.*$

WARNING in ./~/kubernetes-client/lib/specs/swagger-1.7.json.gz
Module parse failed: /mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/kubernetes-client/lib/specs/swagger-1.7.json.gz Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '' (1:0)
at Parser.pp$4.raise (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp$7.getTokenFromCode (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:2756:10)
at Parser.pp$7.readToken (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:2477:17)
at Parser.pp$7.nextToken (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:2468:15)
at Parser.parse (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:515:10)
at Object.parse (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/node_modules/acorn/dist/acorn.js:3098:39)
at Parser.parse (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/lib/Parser.js:902:15)
at NormalModule. (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack/lib/NormalModule.js:104:16)
at NormalModule.onModuleBuild (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
at nextLoader (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25)
at /mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5
at Storage.finished (/mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16)
at /mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/graceful-fs/graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
@ ./~/kubernetes-client/lib ^\.\/.*$

WARNING in ./~/keyv/src/index.js
Critical dependencies:
18:14-40 the request of a dependency is an expression
@ ./~/keyv/src/index.js 18:14-40

ERROR in ./~/kubernetes-client/lib/swagger-client.js
Module not found: Error: Cannot resolve module 'fs' in /mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/kubernetes-client/lib
@ ./~/kubernetes-client/lib/swagger-client.js 26:11-24

ERROR in ./~/kubernetes-client/lib/config.js
Module not found: Error: Cannot resolve module 'fs' in /mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/kubernetes-client/lib
@ ./~/kubernetes-client/lib/config.js 4:11-24

ERROR in ./~/kubernetes-client/lib/auth-providers/cmd.js
Module not found: Error: Cannot resolve module 'child_process' in /mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/kubernetes-client/lib/auth-providers
@ ./~/kubernetes-client/lib/auth-providers/cmd.js 9:18-42

ERROR in ./~/forever-agent/index.js
Module not found: Error: Cannot resolve module 'net' in /mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/forever-agent
@ ./~/forever-agent/index.js 6:10-24

ERROR in ./~/forever-agent/index.js
Module not found: Error: Cannot resolve module 'tls' in /mnt/c/linux/repos/shadycuz/kube-vizion/node_modules/forever-agent
@ ./~/forever-agent/index.js 7:10-24
```

Is it because my kubeconfig is in yaml? No I don't think so. I switched it to json same issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the webpack build and inspect lib/request.js, lib/specs/swagger-1.9.json.gz, lib/specs/swagger-1.8.json.gz, lib/specs/swagger-1.7.json.gz, lib/swagger-client.js, lib/config.js, and lib/auth-providers/cmd.js. Determine the intended browser or webpack support boundary; done means the reported static-definition and Node-module errors are resolved or explicitly excluded without breaking the Node.js client.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, webpack
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.