Add kube config to nodepool servers
This adds connection information for an experimental kubernetes cluster hosted in vexxhost-sjc1 to the nodepool servers. Change-Id: Ie7aad841df1779ddba69315ddd9e0ae96a1c8c53
This commit is contained in:
parent
0626de0b59
commit
6368113ec9
@ -35,6 +35,7 @@
|
||||
roles:
|
||||
- minimal-nodepool
|
||||
- configure-openstacksdk
|
||||
- configure-kubectl
|
||||
|
||||
- hosts: "puppet:!disabled"
|
||||
name: "Base: install and configure puppet on puppet hosts"
|
||||
|
@ -23,4 +23,7 @@ iptables_extra_allowed_hosts:
|
||||
- protocol: tcp
|
||||
port: 2181
|
||||
hostname: zuul01.openstack.org
|
||||
|
||||
kube_config_dir: ~nodepool/.kube
|
||||
kube_config_owner: nodepool
|
||||
kube_config_group: nodepool
|
||||
kube_config_template: clouds/nodepool_kube_config.yaml.j2
|
||||
|
19
playbooks/roles/configure-kubectl/README.rst
Normal file
19
playbooks/roles/configure-kubectl/README.rst
Normal file
@ -0,0 +1,19 @@
|
||||
Configure kube config files
|
||||
|
||||
Configure kubernetes files needed by nodepool.
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: kube_config_dir
|
||||
:default: /root/.kube
|
||||
|
||||
.. zuul:rolevar:: kube_config_owner
|
||||
:default: root
|
||||
|
||||
.. zuul:rolevar:: kube_config_group
|
||||
:default: root
|
||||
|
||||
.. zuul:rolevar:: kube_config_file
|
||||
:default: {{ kube_config_dir }}/config
|
||||
|
||||
.. zuul:rolevar:: kube_config_template
|
4
playbooks/roles/configure-kubectl/defaults/main.yaml
Normal file
4
playbooks/roles/configure-kubectl/defaults/main.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
kube_config_dir: /root/.kube
|
||||
kube_config_owner: root
|
||||
kube_config_group: root
|
||||
kube_config_file: '{{ kube_config_dir }}/config'
|
15
playbooks/roles/configure-kubectl/tasks/main.yaml
Normal file
15
playbooks/roles/configure-kubectl/tasks/main.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
- name: Ensure kube config directory
|
||||
file:
|
||||
group: '{{ kube_config_group }}'
|
||||
owner: '{{ kube_config_owner }}'
|
||||
mode: 0750
|
||||
path: '{{ kube_config_dir }}'
|
||||
state: directory
|
||||
|
||||
- name: Install the kube config file
|
||||
template:
|
||||
src: '{{ kube_config_template }}'
|
||||
dest: '{{ kube_config_file }}'
|
||||
group: '{{ kube_config_group }}'
|
||||
owner: '{{ kube_config_owner }}'
|
||||
mode: 0640
|
19
playbooks/templates/clouds/nodepool_kube_config.yaml.j2
Normal file
19
playbooks/templates/clouds/nodepool_kube_config.yaml.j2
Normal file
@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
clusters:
|
||||
- name: vexxhost-sjc1
|
||||
cluster:
|
||||
server: https://38.108.68.90:6443
|
||||
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMxekNDQWIrZ0F3SUJBZ0lSQU1oQUVLSU96MDlSa3VZSXJjSWtSVjh3RFFZSktvWklodmNOQVFFTEJRQXcKRXpFUk1BOEdBMVVFQXd3SVRtOWtaWEJ2YjJ3d0hoY05NVGd4TVRJM01qSXpPRFV4V2hjTk1qTXhNVEkzTWpJegpPRFV4V2pBVE1SRXdEd1lEVlFRRERBaE9iMlJsY0c5dmJEQ0NBU0l3RFFZSktvWklodmNOQVFFQkJRQURnZ0VQCkFEQ0NBUW9DZ2dFQkFLbXFDcHNkTDlHbTN2WmVGSkRLYXJDeVBiazFkUldraUVMZ2oreWpnalVpejNsUEltUksKZU5Cb24ybzBScDBPMzVPRTZFdTE4Z25JaW1ybk9YWGM2RW1zUEJONHZkbThoRGxsaXFKYjZlSFdIWkcyNGVZSApvWCtWckJ2QjBSYWpBeU9LMW5mRTVscVhlUU8vdUJ0M24yQ0FBbm90bWRkTkpMNFFDN3VpOEV6Vzc3ZkpzUGU5CkZDSVpERktUOGNNL2o0R1BybjdFSEpoQ2tWb2JTaExVbHA4cDN4c05hMmYzam52eGJiUVVBN2lzVCtybXBwY2gKUEx2THFMRytpT01hSDA5aC9SVWN0VE5GeG9uTnZpR21zSVdOdWwxWHBtL2pHa3NNa09xQmhrcXo3V1FNK25wMAo2MDRBcFdHd3Z2bUI2K05TVjVERzNxSk9tZXdyRzg2SW1Xc0NBd0VBQWFNbU1DUXdFZ1lEVlIwVEFRSC9CQWd3CkJnRUIvd0lCQURBT0JnTlZIUThCQWY4RUJBTUNBZ1F3RFFZSktvWklodmNOQVFFTEJRQURnZ0VCQUFramJJKysKTUZXQWJwcXp1T0ppS2FnZlZxY3FZSUs0cFFOSkVpTHdCUnU2RmVJTmFCYXhQUVpIeURsby9NZCsxdlMvQTErTgpQd216T1Rhc0ZTZmlCSHBxdDZVSWdNWm1MenhOMkwyUzFYSFZ4MUg4c2h3aVFmQ0NtaS80eGpDYUhXOS9uUytYCnh5OGNEMXJJTUJkTlRaOERXU2Q0VU9iUWpHQ3ZUdFAvZEdkU21SU1BGNkt6YWIwRjU5dElqc20rVkhvd2NjS1QKaVB1bDUvQnpIRkFlZlV5dXpMeTJlb3ZjSzJzL0l1aWhBMDY5emIyS2JybURvTjBwNnhlRjlZR0o2VHVKZkNBeQpkOU5EejU3RjRBcTh2T2p5SjI2SEZhQ3ovRTdKWUxzZVJ2QWdZS2pRS0J4OVRwdjFNQnFYdm5mYWJQSzNUQVdGClZsV0xxeHRYZGJuYW5iOD0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQ==
|
||||
contexts:
|
||||
- name: vexxhost-sjc1
|
||||
context:
|
||||
cluster: vexxhost-sjc1
|
||||
user: admin
|
||||
current-context: default
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
- name: admin
|
||||
user:
|
||||
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN4VENDQWEyZ0F3SUJBZ0lSQVBxcnlJNkZXa25saHo4dWtqZHJ5elV3RFFZSktvWklodmNOQVFFTEJRQXcKRXpFUk1BOEdBMVVFQXd3SVRtOWt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kMVZQWEhCN1MrV0xBeGUyU2xOM0ZLaHRKQXg2SHNtczc1dwp6N0p0ZEZzdnVPUEtDcUIwYWJQazk4dkxkWXo1MWVWYm9saXV0TVNXMTcwNk5hUDJETnVmc2dNPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0t
|
||||
client-key-data: {{ nodepool_vexxhost_kube_key }}
|
@ -11,6 +11,7 @@ nodepool_internap_project: project
|
||||
nodepool_vexxhost_username: user
|
||||
nodepool_vexxhost_password: password
|
||||
nodepool_vexxhost_project: project
|
||||
nodepool_vexxhost_kube_key: k8s_key
|
||||
nodepool_citycloud_username: user
|
||||
nodepool_citycloud_password: password
|
||||
nodepool_linaro_username: user
|
||||
|
@ -21,3 +21,10 @@ def test_clouds_yaml(host):
|
||||
assert clouds_yaml.exists
|
||||
|
||||
assert b'password' in clouds_yaml.content
|
||||
|
||||
|
||||
def test_kube_config(host):
|
||||
kubeconfig = host.file('/home/nodepool/.kube/config')
|
||||
assert kubeconfig.exists
|
||||
|
||||
assert b'k8s_key' in kubeconfig.content
|
||||
|
Loading…
Reference in New Issue
Block a user