Skip to content

Commit

Permalink
fix(CRDs): malformed watch paths for namespaced CRDs (#470)
Browse files Browse the repository at this point in the history
Currently, URLs for namespaced watches for CRD
objects are incorrectly formatted (the result instead
tries to do a GET on a CRD named `watch`), causing k8s to
return a 404.

This patch corrects this issue

Fixes #468
  • Loading branch information
iffyio authored and Silas Boyd-Wickizer committed May 19, 2019
1 parent 1d507c4 commit 0652b14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/swagger-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class Root extends Component {

const watchPaths = {
watchCluster: `/apis/${group}/${version}/watch/${name}`,
watchNamespace: `/apis/${group}/${version}${namespace}/watch/${name}`,
watchResource: `/apis/${group}/${version}${namespace}/watch/${name}/{name}`
watchNamespace: `/apis/${group}/${version}/watch${namespace}/${name}`,
watchResource: `/apis/${group}/${version}/watch${namespace}/${name}/{name}`
}
Object.keys(watchPaths).forEach(operationId => {
const watchPath = watchPaths[operationId]
Expand Down
4 changes: 2 additions & 2 deletions lib/swagger-client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ describe('lib.swagger-client', () => {
expect(client.apis['stable.example.com'].v1.namespaces('default').foos('blah').patch).is.a('function')
expect(client.apis['stable.example.com'].v1.namespaces('default').foos('blah').put).is.a('function')
expect(client.apis['stable.example.com'].v1.watch.foos.getStream).is.a('function')
expect(client.apis['stable.example.com'].v1.namespaces('default').watch.foos.getStream).is.a('function')
expect(client.apis['stable.example.com'].v1.namespaces('default').watch.foos('blah').getStream).is.a('function')
expect(client.apis['stable.example.com'].v1.watch.namespaces('default').foos.getStream).is.a('function')
expect(client.apis['stable.example.com'].v1.watch.namespaces('default').foos('blah').getStream).is.a('function')
})

it('adds functions for Cluster CustomResourceDefinitions', () => {
Expand Down

0 comments on commit 0652b14

Please sign in to comment.