Skip to content

Commit 7da1b85

Browse files
committed
Add cli parameter for kubeconfig and node name
This is to add support for out-cluster development and testing. Also removed Titlefile and deployment manifest as this can be tested outside the cluster
1 parent ad399b4 commit 7da1b85

File tree

6 files changed

+177
-253
lines changed

6 files changed

+177
-253
lines changed

images/taint-manager/README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# In Cluster Taint Manager
22

3-
To add or remove taint of a node from a in-cluster pod.
3+
To add or remove taint within a pod. The default mode is to run as a pod in a Kubernetes cluster. It will try to
4+
authenticate to K8S API server with in-cluster config (the service account token mounted inside pod). It also uses
5+
downward API to retrieve the node name where the pod is running on in order to change the taint.
46

57
## Compile
68

@@ -10,9 +12,16 @@ GOOS=linux GOARCH=amd64 go build -o taintmanager taintmanager.go
1012

1113
## Development and Debug
1214

13-
The dev/debug environment is setup by `tilt`. To start, run `tilt up`.
15+
To test outside a cluster, commandline parameter `-kubeconfig` and `-node` can be specified. If `-kubeconfig` is not
16+
specified, taintmanager will try to load the kubeconfig from default path `HOME/.kube/config`
1417

15-
## Test
18+
Using default kubeconfig:
19+
20+
```
21+
taintmanager -node f6.workers.ctlt.ubc.ca -remove hub.jupyter.org/imagepulling:NoExecute
22+
```
23+
24+
## Test in Cluster
1625

1726
The `test` directory contains YAML files for deploy a pod with required permissions to run taintmanager.
1827
Please change `namespace` field in `clusterrolebinding.yaml` before deploying to a cluster.

images/taint-manager/Tiltfile

Lines changed: 0 additions & 105 deletions
This file was deleted.

images/taint-manager/deployment.yaml

Lines changed: 0 additions & 30 deletions
This file was deleted.

images/taint-manager/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ require (
2020
github.com/google/gnostic v0.6.9 // indirect
2121
github.com/google/go-cmp v0.5.9 // indirect
2222
github.com/google/gofuzz v1.2.0 // indirect
23+
github.com/imdario/mergo v0.3.6 // indirect
2324
github.com/josharian/intern v1.0.0 // indirect
2425
github.com/json-iterator/go v1.1.12 // indirect
2526
github.com/mailru/easyjson v0.7.7 // indirect
2627
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
2728
github.com/modern-go/reflect2 v1.0.2 // indirect
2829
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
30+
github.com/spf13/pflag v1.0.5 // indirect
2931
golang.org/x/net v0.2.0 // indirect
3032
golang.org/x/oauth2 v0.2.0 // indirect
3133
golang.org/x/sys v0.2.0 // indirect

images/taint-manager/go.sum

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
6969
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
7070
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
7171
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
72+
github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
73+
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
7274
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
7375
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
7476
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
@@ -100,6 +102,7 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:
100102
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
101103
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
102104
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
105+
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
103106
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
104107
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
105108
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=

0 commit comments

Comments
 (0)