mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
commit
4f7d9863f5
@ -64,7 +64,10 @@ def clone_repository():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
repository = 'https://github.com/GoogleCloudPlatform/kubernetes.git'
|
repository = 'https://github.com/GoogleCloudPlatform/kubernetes.git'
|
||||||
kubernetes_directory = '/opt/kubernetes'
|
kubernetes_directory = path('/opt/kubernetes')
|
||||||
|
# Since we can not clone twice, check for the directory and remove it.
|
||||||
|
if kubernetes_directory.isdir():
|
||||||
|
kubernetes_directory.rmtree_p()
|
||||||
|
|
||||||
command = ['git', 'clone', repository, kubernetes_directory]
|
command = ['git', 'clone', repository, kubernetes_directory]
|
||||||
print(command)
|
print(command)
|
||||||
@ -75,8 +78,8 @@ def clone_repository():
|
|||||||
|
|
||||||
def install_packages():
|
def install_packages():
|
||||||
"""
|
"""
|
||||||
Install required packages to build the k8s source, and syndicate between
|
Install required packages to build the k8s source, and syndicate between
|
||||||
minion nodes. In addition, fetch pip to handle python dependencies
|
minion nodes. In addition, fetch pip to handle python dependencies
|
||||||
"""
|
"""
|
||||||
hookenv.log('Installing Debian packages')
|
hookenv.log('Installing Debian packages')
|
||||||
# Create the list of packages to install.
|
# Create the list of packages to install.
|
||||||
@ -87,8 +90,8 @@ def install_packages():
|
|||||||
|
|
||||||
def update_rc_files(strings):
|
def update_rc_files(strings):
|
||||||
"""
|
"""
|
||||||
Preseed the bash environment for ubuntu and root with K8's env vars to
|
Preseed the bash environment for ubuntu and root with K8's env vars to
|
||||||
make interfacing with the api easier. (see: kubectrl docs)
|
make interfacing with the api easier. (see: kubectrl docs)
|
||||||
"""
|
"""
|
||||||
rc_files = [path('/home/ubuntu/.bashrc'), path('/root/.bashrc')]
|
rc_files = [path('/home/ubuntu/.bashrc'), path('/root/.bashrc')]
|
||||||
for rc_file in rc_files:
|
for rc_file in rc_files:
|
||||||
|
@ -204,8 +204,9 @@ def register_machine(apiserver, retry=False):
|
|||||||
mem = info.strip().split(':')[1].strip().split()[0]
|
mem = info.strip().split(':')[1].strip().split()[0]
|
||||||
cpus = os.sysconf('SC_NPROCESSORS_ONLN')
|
cpus = os.sysconf('SC_NPROCESSORS_ONLN')
|
||||||
|
|
||||||
|
# https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/admin/node.md
|
||||||
registration_request = Registrator()
|
registration_request = Registrator()
|
||||||
registration_request.data['Kind'] = 'Minion'
|
registration_request.data['kind'] = 'Node'
|
||||||
registration_request.data['id'] = private_address
|
registration_request.data['id'] = private_address
|
||||||
registration_request.data['name'] = private_address
|
registration_request.data['name'] = private_address
|
||||||
registration_request.data['metadata']['name'] = private_address
|
registration_request.data['metadata']['name'] = private_address
|
||||||
|
@ -24,7 +24,7 @@ class Registrator:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.ds ={
|
self.ds ={
|
||||||
"creationTimestamp": "",
|
"creationTimestamp": "",
|
||||||
"kind": "Minion",
|
"kind": "Node",
|
||||||
"name": "", # private_address
|
"name": "", # private_address
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "", #private_address,
|
"name": "", #private_address,
|
||||||
|
Loading…
Reference in New Issue
Block a user