From be3f300623c4acb12593ad5a824c1b2400b24624 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Wed, 9 May 2018 22:56:03 -0500 Subject: [PATCH] Gate: place role default vars within the role This PS places the role default vars within the appropriate role, in addition it exposes kubeadm's selfhosted param and deploys the kubeadm binary to master nodes. This PS exposes the selfhosted param, and deploys kubeadm to master nodes. Change-Id: I5ad1b593a711ffe353b012394d54044dede0691d --- playbooks/vars.yaml | 51 +------------------ roles/build-helm-packages/defaults/main.yml | 16 ++++++ roles/build-images/defaults/main.yml | 27 ++++++++++ roles/deploy-docker/defaults/main.yml | 18 +++++++ .../defaults/main.yml | 51 +++++++++++++++++++ .../tasks/clean-node.yaml | 6 +-- .../deploy-kubeadm-aio-common/tasks/main.yaml | 4 +- .../tasks/util-kubeadm-aio-run.yaml | 7 +-- .../deploy-kubeadm-aio-node/defaults/main.yml | 17 +++++++ roles/deploy-package/defaults/main.yml | 18 +++++++ roles/deploy-python-pip/defaults/main.yml | 18 +++++++ tools/gate/devel/local-vars.yaml | 8 +-- .../deploy-kubeadm-master/tasks/main.yaml | 9 ++-- 13 files changed, 182 insertions(+), 68 deletions(-) create mode 100644 roles/build-helm-packages/defaults/main.yml create mode 100644 roles/build-images/defaults/main.yml create mode 100644 roles/deploy-docker/defaults/main.yml create mode 100644 roles/deploy-kubeadm-aio-common/defaults/main.yml create mode 100644 roles/deploy-kubeadm-aio-node/defaults/main.yml create mode 100644 roles/deploy-package/defaults/main.yml create mode 100644 roles/deploy-python-pip/defaults/main.yml diff --git a/playbooks/vars.yaml b/playbooks/vars.yaml index 9f82d9ec3..eb6ffae18 100644 --- a/playbooks/vars.yaml +++ b/playbooks/vars.yaml @@ -12,53 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -version: - kubernetes: v1.10.2 - helm: v2.8.2 - cni: v0.6.0 - -proxy: - http: null - https: null - noproxy: null - -images: - kubernetes: - kubeadm_aio: openstackhelm/kubeadm-aio:dev - - -kubernetes: - network: - default_device: null - cluster: - cni: calico - pod_subnet: 192.168.0.0/16 - domain: cluster.local - -nodes: - labels: - primary: - - name: openstack-helm-node-class - value: primary - nodes: - - name: openstack-helm-node-class - value: general - all: - - name: openstack-control-plane - value: enabled - - name: openstack-compute-node - value: enabled - - name: openvswitch - value: enabled - - name: linuxbridge - value: enabled - - name: ceph-mon - value: enabled - - name: ceph-osd - value: enabled - - name: ceph-mds - value: enabled - - name: ceph-rgw - value: enabled - - name: ceph-mgr - value: enabled +null: null diff --git a/roles/build-helm-packages/defaults/main.yml b/roles/build-helm-packages/defaults/main.yml new file mode 100644 index 000000000..1f31ab13c --- /dev/null +++ b/roles/build-helm-packages/defaults/main.yml @@ -0,0 +1,16 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: + helm: v2.8.2 diff --git a/roles/build-images/defaults/main.yml b/roles/build-images/defaults/main.yml new file mode 100644 index 000000000..6fec74aa2 --- /dev/null +++ b/roles/build-images/defaults/main.yml @@ -0,0 +1,27 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: + kubernetes: v1.10.2 + helm: v2.8.2 + cni: v0.6.0 + +proxy: + http: null + https: null + noproxy: null + +images: + kubernetes: + kubeadm_aio: openstackhelm/kubeadm-aio:dev diff --git a/roles/deploy-docker/defaults/main.yml b/roles/deploy-docker/defaults/main.yml new file mode 100644 index 000000000..fe5dd72b5 --- /dev/null +++ b/roles/deploy-docker/defaults/main.yml @@ -0,0 +1,18 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +proxy: + http: null + https: null + noproxy: null diff --git a/roles/deploy-kubeadm-aio-common/defaults/main.yml b/roles/deploy-kubeadm-aio-common/defaults/main.yml new file mode 100644 index 000000000..f7bb9a585 --- /dev/null +++ b/roles/deploy-kubeadm-aio-common/defaults/main.yml @@ -0,0 +1,51 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +kubernetes_cluster_cni: calico +kubernetes_cluster_pod_subnet: 192.168.0.0/16 +kubernetes_cluster_domain: cluster.local +kubernetes_network_default_device: null +kubernetes_selfhosted: false + +images: + kubernetes: + kubeadm_aio: openstackhelm/kubeadm-aio:dev + +nodes: + labels: + primary: + - name: openstack-helm-node-class + value: primary + nodes: + - name: openstack-helm-node-class + value: general + all: + - name: openstack-control-plane + value: enabled + - name: openstack-compute-node + value: enabled + - name: openvswitch + value: enabled + - name: linuxbridge + value: enabled + - name: ceph-mon + value: enabled + - name: ceph-osd + value: enabled + - name: ceph-mds + value: enabled + - name: ceph-rgw + value: enabled + - name: ceph-mgr + value: enabled diff --git a/roles/deploy-kubeadm-aio-common/tasks/clean-node.yaml b/roles/deploy-kubeadm-aio-common/tasks/clean-node.yaml index afd5d371e..5cbf73ace 100644 --- a/roles/deploy-kubeadm-aio-common/tasks/clean-node.yaml +++ b/roles/deploy-kubeadm-aio-common/tasks/clean-node.yaml @@ -40,12 +40,12 @@ USER_UID="{{ playbook_user_id }}" USER_GID="{{ playbook_group_id }}" USER_HOME="{{ playbook_user_dir }}" - CNI_ENABLED="{{ kubernetes.cluster.cni }}" + CNI_ENABLED="{{ kubernetes_cluster_cni }}" PVC_SUPPORT_CEPH=true PVC_SUPPORT_NFS=true NET_SUPPORT_LINUXBRIDGE=true - KUBE_NET_POD_SUBNET="{{ kubernetes.cluster.pod_subnet }}" - KUBE_NET_DNS_DOMAIN="{{ kubernetes.cluster.domain }}" + KUBE_NET_POD_SUBNET="{{ kubernetes_cluster_pod_subnet }}" + KUBE_NET_DNS_DOMAIN="{{ kubernetes_cluster_domain }}" CONTAINER_RUNTIME=docker register: kubeadm_master_deploy ignore_errors: True diff --git a/roles/deploy-kubeadm-aio-common/tasks/main.yaml b/roles/deploy-kubeadm-aio-common/tasks/main.yaml index 65ac76089..ed9a9d26c 100644 --- a/roles/deploy-kubeadm-aio-common/tasks/main.yaml +++ b/roles/deploy-kubeadm-aio-common/tasks/main.yaml @@ -21,9 +21,9 @@ kubernetes_default_address: null - name: if we have defined a custom interface for kubernetes use that - when: kubernetes.network.default_device is defined and kubernetes.network.default_device + when: kubernetes_network_default_device is defined and kubernetes_network_default_device set_fact: - kubernetes_default_device: "{{ kubernetes.network.default_device }}" + kubernetes_default_device: "{{ kubernetes_network_default_device }}" - name: if we are in openstack infra use the private IP for kubernetes when: (nodepool is defined) and (nodepool.private_ipv4 is defined) diff --git a/roles/deploy-kubeadm-aio-common/tasks/util-kubeadm-aio-run.yaml b/roles/deploy-kubeadm-aio-common/tasks/util-kubeadm-aio-run.yaml index a634cd45f..6f43cb5e6 100644 --- a/roles/deploy-kubeadm-aio-common/tasks/util-kubeadm-aio-run.yaml +++ b/roles/deploy-kubeadm-aio-common/tasks/util-kubeadm-aio-run.yaml @@ -42,14 +42,15 @@ USER_UID="{{ playbook_user_id }}" USER_GID="{{ playbook_group_id }}" USER_HOME="{{ playbook_user_dir }}" - CNI_ENABLED="{{ kubernetes.cluster.cni }}" + CNI_ENABLED="{{ kubernetes_cluster_cni }}" PVC_SUPPORT_CEPH=true PVC_SUPPORT_NFS=true NET_SUPPORT_LINUXBRIDGE=true - KUBE_NET_POD_SUBNET="{{ kubernetes.cluster.pod_subnet }}" - KUBE_NET_DNS_DOMAIN="{{ kubernetes.cluster.domain }}" + KUBE_NET_POD_SUBNET="{{ kubernetes_cluster_pod_subnet }}" + KUBE_NET_DNS_DOMAIN="{{ kubernetes_cluster_domain }}" CONTAINER_RUNTIME=docker KUBELET_NODE_LABELS="{{ kubeadm_kubelet_labels }}" + KUBE_SELF_HOSTED="{{ kubernetes_selfhosted }}" register: kubeadm_master_deploy rescue: - name: "getting logs for {{ kubeadm_aio_action }} action" diff --git a/roles/deploy-kubeadm-aio-node/defaults/main.yml b/roles/deploy-kubeadm-aio-node/defaults/main.yml new file mode 100644 index 000000000..fd469c57b --- /dev/null +++ b/roles/deploy-kubeadm-aio-node/defaults/main.yml @@ -0,0 +1,17 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +images: + kubernetes: + kubeadm_aio: openstackhelm/kubeadm-aio:dev diff --git a/roles/deploy-package/defaults/main.yml b/roles/deploy-package/defaults/main.yml new file mode 100644 index 000000000..fe5dd72b5 --- /dev/null +++ b/roles/deploy-package/defaults/main.yml @@ -0,0 +1,18 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +proxy: + http: null + https: null + noproxy: null diff --git a/roles/deploy-python-pip/defaults/main.yml b/roles/deploy-python-pip/defaults/main.yml new file mode 100644 index 000000000..fe5dd72b5 --- /dev/null +++ b/roles/deploy-python-pip/defaults/main.yml @@ -0,0 +1,18 @@ +# Copyright 2017 The Openstack-Helm Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +proxy: + http: null + https: null + noproxy: null diff --git a/tools/gate/devel/local-vars.yaml b/tools/gate/devel/local-vars.yaml index 540462c3b..efdbfaeeb 100644 --- a/tools/gate/devel/local-vars.yaml +++ b/tools/gate/devel/local-vars.yaml @@ -12,10 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -kubernetes: - network: - default_device: docker0 - cluster: - cni: calico - pod_subnet: 192.168.0.0/16 - domain: cluster.local +kubernetes_network_default_device: docker0 diff --git a/tools/images/kubeadm-aio/assets/opt/playbooks/roles/deploy-kubeadm-master/tasks/main.yaml b/tools/images/kubeadm-aio/assets/opt/playbooks/roles/deploy-kubeadm-master/tasks/main.yaml index f5df5b575..d06e2c70c 100644 --- a/tools/images/kubeadm-aio/assets/opt/playbooks/roles/deploy-kubeadm-master/tasks/main.yaml +++ b/tools/images/kubeadm-aio/assets/opt/playbooks/roles/deploy-kubeadm-master/tasks/main.yaml @@ -215,15 +215,18 @@ delegate_to: 127.0.0.1 command: kubeadm alpha phase selfhosting convert-from-staticpods --kubeconfig /mnt/rootfs/etc/kubernetes/admin.conf --config /mnt/rootfs/etc/kubernetes/kubeadm-conf.yaml -- name: setting up kubectl client on host +- name: setting up kubectl client and kubeadm on host block: - name: kubectl | copying kubectl binary to host copy: - src: /usr/bin/kubectl - dest: /usr/bin/kubectl + src: "/usr/bin/{{ item }}" + dest: "/usr/bin/{{ item }}" owner: root group: root mode: 0555 + with_items: + - kubectl + - kubeadm - name: kubectl | master | ensure kube config directory exists for user file: path: "{{ item }}"