Skip to content

crixo/pinning-k8s-subcomponents-with-gomod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Pinning k8s subcomponents with go mod

  • bootstrap go mod
go mod init
  • get the main dependencies you need for you project
go get k8s.io/client-go@v0.16.4
  • manually make fake null version for each component to the latest version within the require section skip the one already pinned by go mod such as k8s.io/{SUBCOMPONENT} v0.0.0-20200327001022-6496210b90e8 // indirect
k8s.io/{SUBCOMPONENT} => k8s.io/{SUBCOMPONENT} v0.0.0
  • manually set the replace section as following
k8s.io/{SUBCOMPONENT} => k8s.io/{SUBCOMPONENT} v0.16.4
  • run the pod killer
go run main.go
  • test the killer
# deploy a pod
k run nginx --image=nginx --restart=Never

# add a label not managed
k label pods nginx app=crixo 

# add the killer label
k label pods delete-pod=

Releases

No releases published

Packages

No packages published

Languages