mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	Merge pull request #58303 from php-coder/fix_verify-swagger-spec_sript
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Fix update-swagger-spec.sh to always cleanup etcd **What this PR does / why we need it**: This PR fixes `hack/update-swagger-spec.sh` so it always cleanup etcd and to noe leave orphaned process after its execution. This process also doesn't allow to run the script again as it detects existing etcd and won't start. I also made a minor improvement by adding guard against an empty arguments. **Release note**: ```release-note NONE ``` CC @simo5
This commit is contained in:
		@@ -74,12 +74,16 @@ kube::etcd::start() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
kube::etcd::stop() {
 | 
					kube::etcd::stop() {
 | 
				
			||||||
  kill "${ETCD_PID-}" >/dev/null 2>&1 || :
 | 
					  if [[ -n "${ETCD_PID-}" ]]; then
 | 
				
			||||||
  wait "${ETCD_PID-}" >/dev/null 2>&1 || :
 | 
					    kill "${ETCD_PID}" &>/dev/null || :
 | 
				
			||||||
 | 
					    wait "${ETCD_PID}" &>/dev/null || :
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
kube::etcd::clean_etcd_dir() {
 | 
					kube::etcd::clean_etcd_dir() {
 | 
				
			||||||
  rm -rf "${ETCD_DIR-}"
 | 
					  if [[ -n "${ETCD_DIR-}" ]]; then
 | 
				
			||||||
 | 
					    rm -rf "${ETCD_DIR}"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
kube::etcd::cleanup() {
 | 
					kube::etcd::cleanup() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,14 +37,17 @@ make -C "${KUBE_ROOT}" WHAT=cmd/kube-apiserver
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function cleanup()
 | 
					function cleanup()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    [[ -n ${APISERVER_PID-} ]] && kill ${APISERVER_PID} 1>&2 2>/dev/null
 | 
					    if [[ -n "${APISERVER_PID-}" ]]; then
 | 
				
			||||||
 | 
					      kill "${APISERVER_PID}" &>/dev/null || :
 | 
				
			||||||
 | 
					      wait "${APISERVER_PID}" &>/dev/null || :
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    kube::etcd::cleanup
 | 
					    kube::etcd::cleanup
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    kube::log::status "Clean up complete"
 | 
					    kube::log::status "Clean up complete"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
trap cleanup EXIT SIGINT
 | 
					kube::util::trap_add cleanup EXIT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
kube::golang::setup_env
 | 
					kube::golang::setup_env
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user