mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 12:18:16 +00:00 
			
		
		
		
	Make libvirt-coreos cluster use create-kubeconfig
This commit is contained in:
		
				
					committed by
					
						
						Jeff Lowdermilk
					
				
			
			
				
	
			
			
			
						parent
						
							4f6dc99075
						
					
				
				
					commit
					08f17bfa70
				
			@@ -46,7 +46,7 @@ function create-kubeconfig() {
 | 
				
			|||||||
    touch "${KUBECONFIG}"
 | 
					    touch "${KUBECONFIG}"
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
  local cluster_args=(
 | 
					  local cluster_args=(
 | 
				
			||||||
      "--server=https://${KUBE_MASTER_IP}"
 | 
					      "--server=${KUBE_SERVER:-https://${KUBE_MASTER_IP}}"
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
  if [[ -z "${CA_CERT:-}" ]]; then
 | 
					  if [[ -z "${CA_CERT:-}" ]]; then
 | 
				
			||||||
    cluster_args+=("--insecure-skip-tls-verify=true")
 | 
					    cluster_args+=("--insecure-skip-tls-verify=true")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -120,11 +120,6 @@ elif [[ "$KUBERNETES_PROVIDER" == "vagrant" ]]; then
 | 
				
			|||||||
  config=(
 | 
					  config=(
 | 
				
			||||||
    "--kubeconfig=$HOME/.kubernetes_vagrant_kubeconfig"
 | 
					    "--kubeconfig=$HOME/.kubernetes_vagrant_kubeconfig"
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
elif [[ "$KUBERNETES_PROVIDER" == "libvirt-coreos" ]]; then
 | 
					 | 
				
			||||||
  detect-master > /dev/null
 | 
					 | 
				
			||||||
  config=(
 | 
					 | 
				
			||||||
    "--server=http://${KUBE_MASTER_IP}:8080"
 | 
					 | 
				
			||||||
  )
 | 
					 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "current-context: \"$(${kubectl} "${config[@]:+${config[@]}}" config view -o template --template='{{index . "current-context"}}')\"" >&2
 | 
					echo "current-context: \"$(${kubectl} "${config[@]:+${config[@]}}" config view -o template --template='{{index . "current-context"}}')\"" >&2
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
 | 
					KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
 | 
				
			||||||
readonly ROOT=$(dirname "${BASH_SOURCE}")
 | 
					readonly ROOT=$(dirname "${BASH_SOURCE}")
 | 
				
			||||||
source $ROOT/${KUBE_CONFIG_FILE:-"config-default.sh"}
 | 
					source "$ROOT/${KUBE_CONFIG_FILE:-"config-default.sh"}"
 | 
				
			||||||
 | 
					source "$KUBE_ROOT/cluster/common.sh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export LIBVIRT_DEFAULT_URI=qemu:///system
 | 
					export LIBVIRT_DEFAULT_URI=qemu:///system
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -199,6 +200,7 @@ function wait-cluster-readiness {
 | 
				
			|||||||
function kube-up {
 | 
					function kube-up {
 | 
				
			||||||
  detect-master
 | 
					  detect-master
 | 
				
			||||||
  detect-minions
 | 
					  detect-minions
 | 
				
			||||||
 | 
					  get-password
 | 
				
			||||||
  initialize-pool keep_base_image
 | 
					  initialize-pool keep_base_image
 | 
				
			||||||
  initialize-network
 | 
					  initialize-network
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -236,11 +238,9 @@ function kube-up {
 | 
				
			|||||||
  done
 | 
					  done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  export KUBECONFIG="${KUBECONFIG:-${HOME}/.kube/.kubeconfig}"
 | 
					  export KUBECONFIG="${KUBECONFIG:-${HOME}/.kube/.kubeconfig}"
 | 
				
			||||||
  local kubectl="${KUBE_ROOT}/cluster/kubectl.sh"
 | 
					  export KUBE_SERVER="http://192.168.10.1:8080"
 | 
				
			||||||
 | 
					  export CONTEXT="libvirt-coreos"
 | 
				
			||||||
  "${kubectl}" config set-cluster libvirt-coreos --server=http://${KUBE_MASTER_IP-}:8080
 | 
					  create-kubeconfig
 | 
				
			||||||
  "${kubectl}" config set-context libvirt-coreos --cluster=libvirt-coreos
 | 
					 | 
				
			||||||
  "${kubectl}" config use-context libvirt-coreos --cluster=libvirt-coreos
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  wait-cluster-readiness
 | 
					  wait-cluster-readiness
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -331,8 +331,8 @@ function test-teardown {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Set the {KUBE_USER} and {KUBE_PASSWORD} environment values required to interact with provider
 | 
					# Set the {KUBE_USER} and {KUBE_PASSWORD} environment values required to interact with provider
 | 
				
			||||||
function get-password {
 | 
					function get-password {
 | 
				
			||||||
  export KUBE_USER=core
 | 
					  export KUBE_USER=''
 | 
				
			||||||
  echo "TODO get-password"
 | 
					  export KUBE_PASSWORD=''
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# SSH to a node by name or IP ($1) and run a command ($2).
 | 
					# SSH to a node by name or IP ($1) and run a command ($2).
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user