Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kubernetes-client/javascript
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8db906a63eff5bf296f3fac4572f83ea3db51283
Choose a base ref
...
head repository: kubernetes-client/javascript
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1da8d1044b868d35cdc34c84ab78ede548a3a099
Choose a head ref

Commits on Feb 10, 2022

  1. Copy the full SHA
    3945f3b View commit details

Commits on Feb 16, 2022

  1. Copy the full SHA
    74f75fd View commit details
  2. revert typescript version

    davidgamero committed Feb 16, 2022
    Copy the full SHA
    dcf7a94 View commit details
  3. revert typescript version

    davidgamero committed Feb 16, 2022
    Copy the full SHA
    e9c13b6 View commit details

Commits on Feb 18, 2022

  1. Merge pull request #777 from davidgamero/generated-code-upgrade

    Generated code upgrade
    k8s-ci-robot authored Feb 18, 2022
    Copy the full SHA
    2dc8740 View commit details

Commits on Mar 22, 2022

  1. metrics migration

    davidgamero committed Mar 22, 2022
    Copy the full SHA
    f0630e5 View commit details
  2. Copy the full SHA
    fb4405e View commit details

Commits on Mar 24, 2022

  1. Security authentication support and watch migration (#786)

    * switch to https options based requestcontext
    
    * migrate watch to node-fetch
    
    * azure_auth test update to fetch
    
    * remove incomplete changes
    
    * remove log changes
    
    * remove azure_auth changes
    
    * fix import
    
    * nit fix
    davidgamero authored Mar 24, 2022
    Copy the full SHA
    eb25280 View commit details

Commits on Mar 25, 2022

  1. merge master

    davidgamero committed Mar 25, 2022
    Copy the full SHA
    221aeb5 View commit details
  2. revert temp changes

    davidgamero committed Mar 25, 2022
    Copy the full SHA
    193667f View commit details

Commits on Mar 26, 2022

  1. Merge pull request #789 from davidgamero/metrics-migration

    Metrics migration
    k8s-ci-robot authored Mar 26, 2022
    Copy the full SHA
    b54ace6 View commit details

Commits on Mar 29, 2022

  1. Copy the full SHA
    2e5cacf View commit details
  2. Merge pull request #790 from davidgamero/azure_auth_tests_update

    Azure auth tests update
    k8s-ci-robot authored Mar 29, 2022
    Copy the full SHA
    44f5170 View commit details

Commits on Jun 17, 2022

  1. Copy the full SHA
    763b791 View commit details

Commits on Jun 18, 2022

  1. Brendan's comments

    davidgamero committed Jun 18, 2022
    Copy the full SHA
    a94cb0b View commit details
  2. unit test

    davidgamero committed Jun 18, 2022
    Copy the full SHA
    e333b4d View commit details
  3. Merge pull request #822 from davidgamero/davidgamero/log-migration

    convert log to use fetch streaming
    k8s-ci-robot authored Jun 18, 2022
    Copy the full SHA
    99368ce View commit details

Commits on Jun 24, 2022

  1. Copy the full SHA
    45b2682 View commit details

Commits on Jun 27, 2022

  1. Merge pull request #829 from davidgamero/davidgamero/get-unit-tests-r…

    …unning
    
    remove Object.ts and get unit tests runnable again
    k8s-ci-robot authored Jun 27, 2022
    Copy the full SHA
    a510a5c View commit details

Commits on Jul 8, 2022

  1. Fix interpolation.

    brendandburns authored Jul 8, 2022
    Copy the full SHA
    c67b84d View commit details

Commits on Jul 10, 2022

  1. Merge pull request #839 from brendandburns/fetch

    Fix interpolation in config.ts
    k8s-ci-robot authored Jul 10, 2022
    Copy the full SHA
    89e462d View commit details

Commits on Aug 3, 2022

  1. add V1MicroTime

    uesyn committed Aug 3, 2022
    Copy the full SHA
    1e92767 View commit details
  2. update kuberenetes/gen and openapi generator

    uesyn committed Aug 3, 2022
    Copy the full SHA
    9d24fb2 View commit details
  3. Run ./generate-client.sh

    uesyn committed Aug 3, 2022
    Copy the full SHA
    cf0714c View commit details

Commits on Aug 11, 2022

  1. Merge pull request #850 from uesyn/regenerate-with-new-openapi-generator

    Regenerate with new openapi generator
    k8s-ci-robot authored Aug 11, 2022
    Copy the full SHA
    ca44c13 View commit details

Commits on Aug 31, 2022

  1. update config tests

    davidgamero committed Aug 31, 2022
    Copy the full SHA
    aba2e56 View commit details

Commits on Sep 1, 2022

  1. Merge pull request #869 from davidgamero/config-and-tests

    update config tests
    k8s-ci-robot authored Sep 1, 2022
    Copy the full SHA
    453e787 View commit details

Commits on Sep 2, 2022

  1. fix or skip tests

    davidgamero committed Sep 2, 2022
    Copy the full SHA
    68bdbde View commit details
  2. enable tests

    davidgamero committed Sep 2, 2022
    Copy the full SHA
    78a2b46 View commit details

Commits on Sep 5, 2022

  1. Merge pull request #870 from davidgamero/enable-tests

    Enable release-1.x tests
    k8s-ci-robot authored Sep 5, 2022
    Copy the full SHA
    912ceb5 View commit details

Commits on Jan 26, 2023

  1. Copy the full SHA
    893d9a2 View commit details

Commits on Feb 15, 2023

  1. Copy the full SHA
    9902af9 View commit details
  2. Copy the full SHA
    c983de0 View commit details

Commits on Feb 16, 2023

  1. Copy the full SHA
    e24ff99 View commit details

Commits on Mar 2, 2023

  1. Copy the full SHA
    99ddffd View commit details

Commits on Mar 3, 2023

  1. Merge pull request #991 from clintonmedbery/clean-up-lint-and-prettie…

    …r-errors
    
    Clean up lint and prettier errors
    k8s-ci-robot authored Mar 3, 2023
    Copy the full SHA
    5a08ea9 View commit details
  2. Copy the full SHA
    5bb6684 View commit details
  3. Merge pull request #1004 from clintonmedbery/fix-codeql-and-remove-bo…

    …ilerplate
    
    fixes the bad workflow file and removes the boilerplate
    k8s-ci-robot authored Mar 3, 2023
    Copy the full SHA
    a362b01 View commit details

Commits on Mar 14, 2023

  1. Copy the full SHA
    71680dc View commit details

Commits on Mar 16, 2023

  1. Merge pull request #1008 from davidgamero/davidgamero/bump-openapigen-2

    bump openapi gen commit for URL parsing and audit fix
    k8s-ci-robot authored Mar 16, 2023
    Copy the full SHA
    cffd34d View commit details

Commits on Mar 17, 2023

  1. Copy the full SHA
    27180f3 View commit details

Commits on Mar 19, 2023

  1. Merge pull request #1014 from davidgamero/davidgamero/update-fetch-mi…

    …gration
    
    add current status 03/2023
    k8s-ci-robot authored Mar 19, 2023
    Copy the full SHA
    d9626f9 View commit details

Commits on Mar 24, 2023

  1. Copy the full SHA
    b27ce70 View commit details
  2. Copy the full SHA
    fa56f36 View commit details
  3. refactor: remove request from *auth files

    * `azure_auth`
    * `exec_auth`
    * `file_auth`
    * `gcp_auth`
    * `oidc_auth`
    mstruebing committed Mar 24, 2023
    Copy the full SHA
    4f27c61 View commit details

Commits on Mar 26, 2023

  1. Merge pull request #1022 from davidgamero/davidgamero/request-migrati…

    …on-auth
    
    remove request usages from auth & config
    k8s-ci-robot authored Mar 26, 2023
    Copy the full SHA
    6bfed83 View commit details
  2. Merge pull request #1023 from mstruebing/remove-request-from-azure-ex…

    …ec-file-gcp-oidc-auth
    
    refactor: remove request from *auth files
    k8s-ci-robot authored Mar 26, 2023
    Copy the full SHA
    fbe3a3a View commit details

Commits on Mar 31, 2023

  1. Copy the full SHA
    fb88d4c View commit details
  2. Copy the full SHA
    69fa6b8 View commit details
  3. Copy the full SHA
    92ec46c View commit details
Showing 1,572 changed files with 503,350 additions and 187,794 deletions.
35 changes: 7 additions & 28 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -14,10 +14,10 @@ name: "CodeQL"

on:
push:
branches: [ master ]
branches: [ master,release-1.x ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [ master,release-1.x ]
schedule:
- cron: '35 14 * * 3'

@@ -30,39 +30,18 @@ jobs:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)

- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '14.x'
node-version: '20'
# Pre-check to validate that versions match between package.json
# and package-lock.json. Needs to run before npm install
- name: Validate package.json and package-lock.json versions
53 changes: 53 additions & 0 deletions .github/workflows/generate-javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Generate

on:
workflow_dispatch:
inputs:
kubernetesBranch:
type: string
required: true
description: 'The remote kubernetes release branch to fetch openapi spec. .e.g. "release-1.23"'
genCommit:
type: string
required: true
default: 'b461333bb57fa2dc2152f939ed70bac3cef2c1f6'
description: 'The commit to use for the kubernetes-client/gen repo'


jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout Javascript
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Generate Openapi
run: |
echo "export KUBERNETES_BRANCH=${{ github.event.inputs.kubernetesBranch }} >> ./settings"
echo "export GEN_COMMIT="${{ github.event.inputs.genCommit }}" >> ./settings"
./generate-client.sh
- name: Generate Branch Name
run: |
SUFFIX=$(openssl rand -hex 4)
echo "BRANCH=automated-generate-$SUFFIX" >> $GITHUB_ENV
- name: Commit and push
run: |
# Commit and push
git config user.email "k8s.ci.robot@gmail.com"
git config user.name "Kubernetes Prow Robot"
git checkout -b "$BRANCH"
git add .
# we modify the settings file in "Generate Openapi" but do not want to commit this
git reset settings
git commit -s -m 'Automated openapi generation from ${{ github.event.inputs.kubernetesBranch }}'
git push origin "$BRANCH"
- name: Pull Request
uses: repo-sync/pull-request@v2
with:
source_branch: ${{ env.BRANCH }}
destination_branch: ${{ github.ref_name }}
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_title: "Automated Generate from openapi ${{ github.event.inputs.kubernetesBranch }}"
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release

on:
workflow_dispatch:
inputs:
releaseVersion:
type: string
required: true
description: The version of this release. Must be a semantic version of the form X.Y.Z.
dry_run:
type: boolean
required: true
default: false
description: Dry run, will not push branches or upload the artifacts.
skip_tag:
type: boolean
required: true
default: false
description: If true, don't tag this release, just push it.
pre_release:
type: boolean
required: true
default: false
description: If true, mark this as a pre-release

jobs:
release:
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout Javascript
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm install
- name: Package
run: ./build-package.sh
- name: Upload release
if: ${{ github.event.inputs.dry_run != 'true' && github.event.inputs.pre_release != 'true' }}
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Upload pre-release
if: ${{ github.event.inputs.dry_run != 'true' && github.event.inputs.pre_release == 'true' }}
run: npm publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Tag release
if: ${{ github.event.inputs.skip_tag != 'true' }}
run: |
git config --global user.name 'Github Bot'
git config --global user.email '<>'
git tag ${{ github.events.inputs.version }}
- name: Push tag
if: ${{ github.event.inputs.dry_run != 'true' }}
run: |
git push ${{ github.events.inputs.version }}
45 changes: 22 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
name: Kubernetes Javascript Client - Validation

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
push:
branches: [master, release-1.x]
pull_request:
branches: [master, release-1.x]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ '16', '14', '12' ]
name: Node ${{ matrix.node }} validation
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
# Pre-check to validate that versions match between package.json
# and package-lock.json. Needs to run before npm install
- run: node version-check.js
- run: npm ci
- run: npm test
- run: npm run lint
- run: npm audit --audit-level=critical

build:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['23', '22', '20', '18']
name: Node ${{ matrix.node }} validation
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
# Pre-check to validate that versions match between package.json
# and package-lock.json. Needs to run before npm install
- run: node version-check.js
- run: npm ci
- run: npm test
- run: npm run lint
- run: npm audit --audit-level=critical
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pretty-quick --staged
2 changes: 2 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

npm test && npm run lint
10 changes: 10 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"require": "tsx",
"extensions": ["ts"],
"spec": [
"src/**/*_test.ts"
],
"watch-files": [
"src"
]
}
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tabWidth: 4
printWidth: 110
trailingComma: all
singleQuote: true
arrowParens: always
70 changes: 45 additions & 25 deletions FETCH_MIGRATION.md
Original file line number Diff line number Diff line change
@@ -40,34 +40,54 @@ Code will be on the `master` branch.
### Other repositories

- [x] Update [kubernetes-client/gen](https://github.com/kubernetes-client/gen)'s typescript-fetch files to let us pass in the `typescriptThreePlus` config option <sup>[1](https://github.com/OpenAPITools/openapi-generator/issues/9973) [2](https://github.com/OpenAPITools/openapi-generator/issues/3869#issuecomment-584152932)</sub>
- [ ] Update [openapi-generator](https://github.com/OpenAPITools/openapi-generator)'s typescript-fetch flavor to mark parameters as optional if all parameters are optional <sup>[3](https://github.com/OpenAPITools/openapi-generator/issues/6440)</sup>
- [x] Update [openapi-generator](https://github.com/OpenAPITools/openapi-generator)'s typescript-fetch flavor to mark parameters as optional if all parameters are optional <sup>[3](https://github.com/OpenAPITools/openapi-generator/issues/6440)</sup>

### Kubernetes-client repository

- [ ] Increment `OPENAPI_GENERATOR_COMMIT` to be [version 5.3.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.3.0) (with the optional parameters addition)
- [ ] `npm install node-fetch` to install node-fetch
- [ ] Switch generate-client script to use typescript-fetch
- [ ] Import and inject node-fetch in `src/api.ts` with the following

```typescript
import fetch from 'node-fetch';

// inject node-fetch
if (!globalThis.fetch) {
// @ts-ignore
globalThis.fetch = fetch;
globalThis.Headers = Headers;
globalThis.Request = Request;
globalThis.Response = Response;
}
```

- [ ] Generate api with `npm run generate`
- [ ] Match src/gen/api.ts to new generated layout (it changes slightly)
- [ ] Fix errors in /src folder (due to new api)
- [ ] Fix errors in test (due to new api)
- [x] Increment `OPENAPI_GENERATOR_COMMIT` to be [version 5.3.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.3.0) (with the optional parameters addition)
- [x] `npm install node-fetch` to install node-fetch
- [x] Switch generate-client script to use typescript-fetch
- [x] Generate api with `npm run generate`
- [x] Match src/gen/api.ts to new generated layout (it changes slightly)
- [x] Fix errors in /src folder (due to new api)
- [x] migrate src/auth.ts, the dependent implementations (ex: azure_auth, gcp_auth etc) and tests to fetch api from request
- [x] migrate src/log.ts and its tests to fetch api from request
- [x] major remaining work is fixing up async signatures and return piping
- [x] migrate src/watch.ts and its tests to fetch api from request
- [x] remove decprecated requestImpl and RequestInterface
- [x] implement queryParams parameter in watch method by injecting them into the fetch call
- [x] update tests in src/watch_test.ts
- [x] Fix errors in test (due to new api)
- [ ] Test all features
- [ ] Fix examples (due to new api)
- [ ] Fix JavaScript examples and validate their param signatures (due to new api)

- [x] cache-example
- [x] example
- [x] follow-logs
- [ ] in-cluster-create-job-from-cronjob // done but unable to test with media type problems
- [x] in-cluster
- [x] ingress
- [x] namespace
- [ ] patch-example // throws an error `TypeError: Cannot read properties of undefined (reading 'makeRequestContext')`
- [x] raw-example (note: uses request lib directly, will require full fetch migration not just client param swap)
- [x] scale-deployment
- [x] top_pods
- [x] top
- [ ] yaml-example // create works but deletion throws an error `TypeError: Cannot read properties of undefined (reading 'makeRequestContext')`

- [ ] Fix TypeScript examples and validate their param signatures (due to new api)

- [ ] apply-example // KubernetesObjectApi is missing
- [x] attach-example
- [x] cp-example
- [x] exec-example
- [x] informer-with-label-selector
- [x] informer
- [x] port-forward
- [x] example
- [x] watch-example

- [ ] Update docs
- [ ] Update README examples
- [ ] Document breaking changes for users
- [ ] Release initial version (1.0.0)
[ ] Release initial version (1.0.0)
9 changes: 6 additions & 3 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# See the OWNERS docs at https://go.k8s.io/owners
approvers:
- brendandburns
- drubin
- mstruebing
- davidgamero
reviewers:
- brendandburns
- drubin
- itowlson
- mstruebing
- davidgamero
emeritus_approvers:
- mbohlool # 10/22/2020
- drubin # 11/23/2023
- itowlson # 11/23/2023
3 changes: 3 additions & 0 deletions build-package.sh
Original file line number Diff line number Diff line change
@@ -6,6 +6,9 @@ set -e
# validate branches
. ./pre-check.sh

npm run clean
npm install

# pre-requisites
npm run lint
npm test
10 changes: 6 additions & 4 deletions examples/cache-example.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
const k8s = require('@kubernetes/client-node');
import * as k8s from '@kubernetes/client-node';

const kc = new k8s.KubeConfig();
kc.loadFromDefault();

const k8sApi = kc.makeApiClient(k8s.CoreV1Api);

const namespace = 'default';

const path = '/api/v1/pods';
const watch = new k8s.Watch(kc);

const listFn = () => k8sApi.listPodForAllNamespaces()
const listFn = () => k8sApi.listPodForAllNamespaces();

const cache = new k8s.ListWatch(path, watch, listFn);

const looper = () => {
const list = cache.list('default');
const list = cache.list(namespace);
if (list) {
let names = [];
for (let i = 0; i < list.length; i++) {
@@ -22,6 +24,6 @@ const looper = () => {
console.log(names.join(','));
}
setTimeout(looper, 2000);
}
};

looper();
Loading