mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +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()
|
config = hookenv.config()
|
||||||
# Get the version of kubernetes to install.
|
# Get the version of kubernetes to install.
|
||||||
version = config['version']
|
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).
|
# Get the package architecture, rather than the from the kernel (uname -m).
|
||||||
arch = subprocess.check_output(['dpkg', '--print-architecture']).strip()
|
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']:
|
if not branch:
|
||||||
branch = 'master'
|
output_path = charm_dir / 'files/output'
|
||||||
|
installer = KubernetesInstaller(arch, version, output_path)
|
||||||
else:
|
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.
|
# Construct the path to the binaries using the arch.
|
||||||
output_path = kubernetes_dir / '_output/local/bin/linux' / arch
|
output_path = kubernetes_dir / '_output/local/bin/linux' / arch
|
||||||
installer = KubernetesInstaller(arch, version, output_path)
|
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).
|
# Change to the kubernetes directory (git repository).
|
||||||
with kubernetes_dir:
|
with kubernetes_dir:
|
||||||
|
|
||||||
# Create a command to get the current branch.
|
# Create a command to get the current branch.
|
||||||
git_branch = 'git branch | grep "\*" | cut -d" " -f2'
|
git_branch = 'git branch | grep "\*" | cut -d" " -f2'
|
||||||
current_branch = subprocess.check_output(git_branch, shell=True).strip()
|
current_branch = subprocess.check_output(git_branch, shell=True).strip()
|
||||||
|
Loading…
Reference in New Issue
Block a user