mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 23:37:01 +00:00
Adding the 'local' option to install binaries from local filesystem.
This commit is contained in:
parent
e013541573
commit
08733d9362
@ -59,26 +59,40 @@ def config_changed():
|
||||
config = hookenv.config()
|
||||
# Get the version of kubernetes to install.
|
||||
version = config['version']
|
||||
|
||||
if version == 'master':
|
||||
# The 'master' branch of kuberentes is used when master is configured.
|
||||
branch = 'master'
|
||||
elif version == 'local':
|
||||
# Check for kubernetes binaries in the local files/output directory.
|
||||
branch = None
|
||||
else:
|
||||
# Create a branch to a tag to get the release version.
|
||||
branch = 'tags/{0}'.format(version)
|
||||
|
||||
# Get the package architecture, rather than the from the kernel (uname -m).
|
||||
arch = subprocess.check_output(['dpkg', '--print-architecture']).strip()
|
||||
kubernetes_dir = path('/opt/kubernetes')
|
||||
if not kubernetes_dir.exists():
|
||||
print('The source directory {0} does not exist'.format(kubernetes_dir))
|
||||
print('Was the kubernetes code cloned during install?')
|
||||
exit(1)
|
||||
|
||||
if version in ['source', 'head', 'master']:
|
||||
branch = 'master'
|
||||
if not branch:
|
||||
output_path = charm_dir / 'files/output'
|
||||
installer = KubernetesInstaller(arch, version, output_path)
|
||||
else:
|
||||
# Create a branch to a tag.
|
||||
branch = 'tags/{0}'.format(version)
|
||||
|
||||
# Build the kuberentes binaries from source on the units.
|
||||
kubernetes_dir = path('/opt/kubernetes')
|
||||
|
||||
# Construct the path to the binaries using the arch.
|
||||
output_path = kubernetes_dir / '_output/local/bin/linux' / arch
|
||||
installer = KubernetesInstaller(arch, version, output_path)
|
||||
|
||||
if not kubernetes_dir.exists():
|
||||
print('The source directory {0} does not exist'.format(kubernetes_dir))
|
||||
print('Was the kubernetes code cloned during install?')
|
||||
exit(1)
|
||||
|
||||
# Change to the kubernetes directory (git repository).
|
||||
with kubernetes_dir:
|
||||
|
||||
# Create a command to get the current branch.
|
||||
git_branch = 'git branch | grep "\*" | cut -d" " -f2'
|
||||
current_branch = subprocess.check_output(git_branch, shell=True).strip()
|
||||
|
Loading…
Reference in New Issue
Block a user