This Go application provides functionality to patch Kubernetes deployments using JSON patches. It utilizes the Kubernetes client library.
Ensure you have the following prerequisites installed:
- Go
- Kubernetes cluster access
- kubectl configured (for obtaining kubeconfig)
Clone the repository:
git clone [email protected]:matthieugusmini/k8s-patch-app.git
cd k8s-patch-app
Build the application:
make build
Run the application with the following command:
./k8s-patch-app -n <deployment-name> -p <json-patch>
For more details:
$ ./k8s-patch-app --help
Usage of ./k8s-patch-app:
-k string
(optional) absolute path to the kubeconfig file
-n string
Deployment name to patch
-p string
JSON patch
Example:
./k8s-patch-app -n=foo -p='[{"op": "replace", "path": "/spec/replicas", "value": 42}]'
The application reads the Kubernetes configuration from the provided kubeconfig file or uses the default location (~/.kube/config
). It then patches the specified deployment with the provided JSON patch.
- Add E2E tests using the Kubernetes E2E framework