Skip to content

fix(cleaner): update Kubernetes client calls to @kubernetes/client-node v1.x object parameter convention - #1406

Merged
commjoen merged 1 commit into
OWASP:mainfrom
youknowme19:fix/cleaner-k8s-client-v1-compatibility
Oct 27, 2026
Merged

commjoen merged 1 commit into
OWASP:mainfrom
youknowme19:fix/cleaner-k8s-client-v1-compatibility

Conversation

@youknowme19

Copy link
Copy Markdown

Thank you for submitting a pull request to the WrongSecrets Party!

What kind of changes does this PR include?

  • Fixes or refactors
  • Platform support
  • A new feature
  • Additional documentation
  • Something else

Checklist:

  • All the contributions made are solely the work of me and my co-authors
  • I tested the changes in this PR (if applicable)
  • I added tests to ensure my change works (if applicable)
  • The PR passes pre-commit hooks and automated tests

Summary of changes

  • Updated cleaner/src/kubernetes.js methods (getTeamInstances, getTeamJuiceShopInstances, getNamespaces, deleteNamespaceForTeam) to pass named parameter objects required by @kubernetes/client-node v1.x (^1.2.0).
  • Updated cleaner/src/main.js to safely resolve deployment and namespace collections (res?.items || res?.body?.items || []) supporting both v1.x response format and mock structures.
  • Replaced the dummy test in cleaner/src/kubernetes.test.js with comprehensive unit tests validating parameter object structures and error handling for all Kubernetes client calls.

Fixes #1405

…de v1.x object parameter convention

Update cleaner API methods to pass named parameter objects required by @kubernetes/client-node v1.x, safely parse response items, and add comprehensive unit tests.

Fixes OWASP#1405
@github-actions

Copy link
Copy Markdown

🚀 Preview Build Complete!

Your pull request has been built successfully. However, since this is from a fork, preview images cannot be pushed to the organization's container registry.

Testing Your Changes

To test your changes, you can build and deploy locally:

# Clone this PR
git fetch origin pull/1406/head:pr-1406
git checkout pr-1406

# Build and deploy locally
./build-and-deploy.sh

# Or for minikube
./build-and-deploy-minikube.sh

# Port forward to access locally
kubectl port-forward service/wrongsecrets-balancer 3000:3000

Alternative: Manual Build

# Build images locally
cd wrongsecrets-balancer
docker build -t my-wrongsecrets-balancer:test .
cd ../cleaner
docker build -t my-cleaner:test .

# Deploy with custom images using Helm
helm repo add wrongsecrets https://owasp.org/wrongsecrets-ctf-party
helm repo update

helm install my-preview wrongsecrets/wrongsecrets-ctf-party \
  --set balancer.repository=my-wrongsecrets-balancer \
  --set balancer.tag=test \
  --set wrongsecretsCleanup.repository=my-cleaner \
  --set wrongsecretsCleanup.tag=test \
  --set balancer.imagePullPolicy=Never \
  --set wrongsecretsCleanup.imagePullPolicy=Never

Why Can't Images Be Pushed?

External contributors don't have write permissions to the organization's GitHub Container Registry. This is a security measure to protect the organization's packages.


This preview was automatically generated for PR #1406

@commjoen commjoen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @youknowme19 !

@commjoen
commjoen merged commit 21e1a5b into OWASP:main Oct 27, 2026
19 checks passed
@youknowme19
youknowme19 deleted the fix/cleaner-k8s-client-v1-compatibility branch October 27, 2026 14:07
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 this pull request may close these issues.

fix(cleaner): update Kubernetes client calls to @kubernetes/client-node v1.x object parameter convention

2 participants