Browse Source

Merge "Install kubectl on bridge"

Zuul 2 months ago
parent
commit
c820963613

+ 1
- 0
playbooks/base.yaml View File

@@ -26,6 +26,7 @@
26 26
 - hosts: bridge.openstack.org:!disabled
27 27
   name: "Base: configure cloud credentials on bridge"
28 28
   roles:
29
+    - install-kubectl
29 30
     - configure-kubectl
30 31
   tasks:
31 32
     - include_role:

+ 0
- 1
playbooks/roles/base-server/tasks/Debian.yaml View File

@@ -3,7 +3,6 @@
3 3
     name:
4 4
       - whoopsie
5 5
       - popularity-contest
6
-      - snapd
7 6
       - lxd
8 7
       - lxd-client
9 8
     state: absent

+ 0
- 1
playbooks/roles/base-server/tasks/Ubuntu.xenial.aarch64.yaml View File

@@ -15,7 +15,6 @@
15 15
     name:
16 16
       - whoopsie
17 17
       - popularity-contest
18
-      - snapd
19 18
       - lxd
20 19
       - lxd-client
21 20
     state: absent

+ 5
- 0
playbooks/roles/install-kubectl/README.rst View File

@@ -0,0 +1,5 @@
1
+Install kubectl
2
+
3
+**Role Variables**
4
+
5
+* None

+ 16
- 0
playbooks/roles/install-kubectl/tasks/main.yaml View File

@@ -0,0 +1,16 @@
1
+- name: Install snapd
2
+  package:
3
+    name: snapd
4
+    state: present
5
+
6
+- name: Install kubectl
7
+  command: snap install kubectl --classic
8
+
9
+# /snap/bin is often in the path, but not in a non-login shell, which
10
+# makes it difficult to use via ansible.  Add an extra symlink so we
11
+# can always find it.
12
+- name: Symlink snapd into /usr/local/bin
13
+  file:
14
+    src: /snap/bin/kubectl
15
+    dest: /usr/local/bin/kubectl
16
+    state: link

+ 1
- 1
playbooks/zuul/templates/host_vars/bridge.openstack.org.yaml.j2 View File

@@ -58,4 +58,4 @@ clouds:
58 58
   openstackzuul_arm64ci_username: user
59 59
   openstackzuul_arm64ci_password: password
60 60
   openstackzuul_arm64ci_project_name: project
61
-gitea_kube_key: gitea_k8s_key
61
+gitea_kube_key: Z2l0ZWFfazhzX2tleQ==

+ 6
- 1
testinfra/test_bridge.py View File

@@ -71,4 +71,9 @@ def test_kube_config(host):
71 71
     kubeconfig = host.file('/root/.kube/config')
72 72
     assert kubeconfig.exists
73 73
 
74
-    assert b'gitea_k8s_key' in kubeconfig.content
74
+    assert b'Z2l0ZWFfazhzX2tleQ==' in kubeconfig.content
75
+
76
+
77
+def test_kubectl(host):
78
+    kube = host.run('kubectl help')
79
+    assert kube.rc == 0

Loading…
Cancel
Save