mirror of
				https://github.com/honestbee/drone-kubernetes.git
				synced 2025-11-04 14:48:04 +00:00 
			
		
		
		
	First version
This commit is contained in:
		
							parent
							
								
									4fb115dcd7
								
							
						
					
					
						commit
						4490e740d3
					
				
					 3 changed files with 49 additions and 2 deletions
				
			
		
							
								
								
									
										8
									
								
								Dockerfile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Dockerfile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,8 @@
 | 
				
			||||||
 | 
					FROM alpine
 | 
				
			||||||
 | 
					RUN apk -Uuv add curl ca-certificates
 | 
				
			||||||
 | 
					RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
 | 
				
			||||||
 | 
					RUN chmod +x ./kubectl
 | 
				
			||||||
 | 
					RUN mv ./kubectl /usr/local/bin/kubectl
 | 
				
			||||||
 | 
					ADD update.sh /bin/
 | 
				
			||||||
 | 
					RUN chmod +x /bin/update.sh
 | 
				
			||||||
 | 
					CMD /bin/update.sh
 | 
				
			||||||
							
								
								
									
										34
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										34
									
								
								README.md
									
										
									
									
									
								
							| 
						 | 
					@ -1,2 +1,32 @@
 | 
				
			||||||
# drone-kubernetes
 | 
					# Kubernetes plugin for drone.io
 | 
				
			||||||
A drone plugin to update a deployment on a kubernetes cluster
 | 
					
 | 
				
			||||||
 | 
					This plugin allows to update a Kubernetes deployment.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Usage  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This pipeline will update the `my-deployment` deployment with the image tagged `DRONE_COMMIT_SHA:8`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pipeline:
 | 
				
			||||||
 | 
					        deploy:
 | 
				
			||||||
 | 
					            image: quay.io/honestbee/drone-kubernetes
 | 
				
			||||||
 | 
					            deployment: my-deployment
 | 
				
			||||||
 | 
					            repo: myorg/myrepo
 | 
				
			||||||
 | 
					            name: my-container
 | 
				
			||||||
 | 
					            tag: ${DRONE_COMMIT_SHA:8}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Required secrets
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    drone secret add --image=honestbee/drone-kubernetes \
 | 
				
			||||||
 | 
					        your-user/your-repo KUBERNETES_SERVER https://mykubernetesapiserver
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    drone secret add --image=honestbee/drone-kubernetes \
 | 
				
			||||||
 | 
					        your-user/your-repo KUBERNETES_TOKEN eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJ...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## To do 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Replace the current kubectl bash script with a go implementation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Special thanks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Inspired by [drone-helm](https://github.com/ipedrazas/drone-helm).
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										9
									
								
								update.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								update.sh
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,9 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					kubectl config set-credentials default --token=${KUBERNETES_TOKEN}
 | 
				
			||||||
 | 
					kubectl config set-cluster default --server=${KUBERNETES_SERVER} --insecure-skip-tls-verify=true
 | 
				
			||||||
 | 
					kubectl config set-context default --cluster=default --user=default
 | 
				
			||||||
 | 
					kubectl config use-context default
 | 
				
			||||||
 | 
					kubectl set image deployment/${PLUGIN_DEPLOYMENT} ${PLUGIN_NAME}=${PLUGIN_REPO}:${PLUGIN_TAG}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#TODO : Identify a good way to identify IMAGE_NAME and PLUGIN_DEPLOY_IMAGE
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue