diff --git a/.zuul.yaml b/.zuul.yaml index acc4abb675..a79ef6040f 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -18,6 +18,8 @@ jobs: - openstack-helm-linter: voting: true + - openstack-helm-dev-deploy: + voting: true - openstack-helm-legacy-ubuntu-vm-ovs-radosgw: voting: false irrelevant-files: @@ -39,6 +41,17 @@ run: tools/gate/playbooks/zuul-linter.yaml nodeset: openstack-helm-single-node +- job: + timeout: 7200 + name: openstack-helm-dev-deploy + vars: + zuul_osh_infra_relative_path: ../openstack-helm-infra/ + run: tools/gate/playbooks/dev-deploy.yaml + post-run: tools/gate/playbooks/legacy-gate-post.yaml + required-projects: + - openstack/openstack-helm-infra + nodeset: openstack-helm-single-node + - job: timeout: 7200 vars: diff --git a/Makefile b/Makefile index 5296ca6b9c..8871ed1307 100644 --- a/Makefile +++ b/Makefile @@ -12,12 +12,17 @@ # See the License for the specific language governing permissions and # limitations under the License. +# It's necessary to set this because some environments don't link sh -> bash. +SHELL := /bin/bash + HELM := helm TASK := build EXCLUDES := helm-toolkit doc tests tools logs CHARTS := helm-toolkit $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) +.PHONY: $(EXCLUDES) $(CHARTS) + all: $(CHARTS) $(CHARTS): @@ -47,4 +52,5 @@ clean: pull-all-images: @./tools/pull-images.sh -.PHONY: $(EXCLUDES) $(CHARTS) +pull-images: + @./tools/pull-images.sh $(filter-out $@,$(MAKECMDGOALS)) diff --git a/doc/source/install/developer/all-in-one.rst b/doc/source/install/developer/all-in-one.rst index 8b53a1938e..3e923466b3 100644 --- a/doc/source/install/developer/all-in-one.rst +++ b/doc/source/install/developer/all-in-one.rst @@ -7,7 +7,6 @@ Overview Below are some instructions and suggestions to help you get started with a Kubeadm All-in-One environment on Ubuntu 16.04. -*Also tested on Centos and Fedora.* Requirements ============ @@ -15,195 +14,73 @@ Requirements System Requirements ------------------- -The minimum requirements for using the Kubeadm-AIO environment depend on the -desired backend for persistent volume claims. - -For NFS, the minimum system requirements are: - -- 8GB of RAM -- 4 Cores -- 48GB HDD - -For Ceph, the minimum system requirements are: +The recommended minimum system requirements for a full deployment are: - 16GB of RAM - 8 Cores - 48GB HDD -This guide covers the minimum number of requirements to get started. For most -users, the main prerequisites are to install the most recent versions of Kubectl -and Helm. +For a deployment without cinder and horizon the system requirements are: -Setup etc/hosts ---------------- +- 8GB of RAM +- 4 Cores +- 48GB HDD -:: +This guide covers the minimum number of requirements to get started. - HOST_IFACE=$(ip route | grep "^default" | head -1 | awk '{ print $5 }') - LOCAL_IP=$(ip addr | awk "/inet/ && /${HOST_IFACE}/{sub(/\/.*$/,\"\",\$2); print \$2}") - cat << EOF | sudo tee -a /etc/hosts - ${LOCAL_IP} $(hostname) - EOF +Host Configuration +------------------ + +OpenStack-Helm uses the hosts networking namespace for many pods including, +Ceph, Neutron and Nova components. For this, to function, as expected pods need +to be able to resolve DNS requests correctly. Ubuntu Desktop and some other +distributions make use of ``mdns4_minimal`` which does not operate as Kubernetes +expects with its default TLD of ``.local``. To operate at expected either +change the ``hosts`` line in the ``/etc/nsswitch.conf``, or confirm that it +matches: + +.. code-block:: ini + + hosts: files dns Packages -------- -Install the latest versions of Docker, Network File System, Git, Make & Curl if -necessary +Install the latest versions of Git, CA Certs & Make if necessary -:: +.. literalinclude:: ../../../../tools/deployment/developer/00-install-packages.sh + :language: shell + :lines: 1,17- - sudo apt-get update - sudo apt-get install --no-install-recommends -qq \ - curl \ - docker.io \ - nfs-common \ - git \ - make +Clone the OpenStack-Helm Repos +------------------------------ -Kubectl -------- +Once the host has been configured the repos containing the OpenStack-Helm charts +should be cloned: -Download and install kubectl, the command line interface for running commands -against your Kubernetes cluster. +.. code-block:: shell -:: + #!/bin/bash + set -xe - export KUBE_VERSION=v1.7.5 - export HELM_VERSION=v2.6.1 - export TMP_DIR=$(mktemp -d) - - curl -sSL https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/linux/amd64/kubectl -o ${TMP_DIR}/kubectl - chmod +x ${TMP_DIR}/kubectl - sudo mv ${TMP_DIR}/kubectl /usr/local/bin/kubectl - -Helm ----- - -Download and install Helm, the package manager for Kubernetes - -:: - - curl -sSL https://storage.googleapis.com/kubernetes-helm/helm-${HELM_VERSION}-linux-amd64.tar.gz | tar -zxv --strip-components=1 -C ${TMP_DIR} - sudo mv ${TMP_DIR}/helm /usr/local/bin/helm - rm -rf ${TMP_DIR} - -OpenStack-Helm -============== - -Using git, clone the repository that holds all of the OpenStack service charts. - -:: - - git clone https://git.openstack.org/openstack/openstack-helm.git - cd openstack-helm - -Setup Helm client ------------------ - -Initialize the helm client and start listening on localhost:8879. Once the helm -client is available, add the local repository to the helm client. Use -``helm [command] --help`` for more information about the Helm commands. - -:: - - helm init --client-only - helm serve & - helm repo add local http://localhost:8879/charts - helm repo remove stable - -Make ----- - -The provided Makefile in OpenStack-Helm will perform the following: - -* **Lint:** Validate that your helm charts have no basic syntax errors -* **Package:** Each chart will be compiled into a helm package that will contain - all of the resource definitions necessary to run an application,tool, or service - inside of a Kubernetes cluster. -* **Push:** Push the Helm packages to your local Helm repository - -Run ``make`` from the root of the openstack-helm repository: - -:: - - make - -Kubeadm-AIO Container -===================== - -Pull ----- - -It is recommended to pull the kubeadm-aio container as it is stable -at the time it was built - -:: - - export KUBEADM_IMAGE=openstackhelm/kubeadm-aio:v1.7.5 - sudo docker pull ${KUBEADM_IMAGE} + git clone https://git.openstack.org/openstack/openstack-helm-infra.git + git clone https://git.openstack.org/openstack/openstack-helm.git +Deploy Kubernetes & Helm +------------------------ -Build ------ +You may now deploy kubernetes, and helm onto your machine, first move into the +``openstack-helm`` directory and then run the following: -Optionally, using the Dockerfile defined in tools/kubeadm-aio directory, build the -'openstackhelm/kubeadm-aio:v1.7.5' image. Warning - this may pull packages that -have not been tested. +.. literalinclude:: ../../../../tools/deployment/developer/01-deploy-k8s.sh + :language: shell + :lines: 1,17- -:: - - export KUBEADM_IMAGE=openstackhelm/kubeadm-aio:v1.7.5 - sudo docker build --pull -t ${KUBEADM_IMAGE} tools/kubeadm-aio - -CNI Configuration ------------------ - -Before deploying AIO, you may optionally set additional parameters which -control aspects of the CNI used: - -:: - - export KUBE_CNI=calico # or "canal" "weave" "flannel" - export CNI_POD_CIDR=192.168.0.0/16 - -Deploy ------- - -After the image is built, execute the kubeadm-aio-launcher script which creates -a single node Kubernetes environment by default with Helm, Calico, an NFS PVC -provisioner with appropriate RBAC rules and node labels to start developing. The -following deploys the Kubeadm-AIO environment. It should be noted these -commands may take a few minutes to execute. The output of these commands is -displayed during execution. - -:: - - export KUBE_VERSION=v1.7.5 - ./tools/kubeadm-aio/kubeadm-aio-launcher.sh - export KUBECONFIG=${HOME}/.kubeadm-aio/admin.conf - mkdir -p ${HOME}/.kube - cat ${KUBECONFIG} > ${HOME}/.kube/config - -Dummy Neutron Networks ----------------------- - -If you wish to create dummy network devices for Neutron to manage there is a -helper script that can set them up for you: - -:: - - sudo docker exec kubelet /usr/bin/openstack-helm-aio-network-prep - -Logs ----- - -You can get the logs from your kubeadm-aio container by running: - -:: - - sudo docker logs -f kubeadm-aio +This command will deploy a single node KubeADM administered cluster. This will +use the parameters in ``${OSH_INFRA_PATH}/tools/gate/playbooks/vars.yaml`` to control the +deployment, which can be over-ridden by adding entries to +``${OSH_INFRA_PATH}/tools/gate/devel/local-vars.yaml``. Helm Chart Installation ======================= @@ -214,75 +91,258 @@ During installation, the helm client will print useful information about resources created, the state of the Helm releases, and whether any additional configuration steps are necessary. -Helm Install Examples ---------------------- +Install OpenStack-Helm +---------------------- -To install a helm chart, use the general command: +.. note:: The following commands all assume that they are run from the + ``openstack-helm`` directory and the repos have been cloned as above. + +Setup Clients on the host and assemble the charts +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The OpenStack clients and Kubernetes RBAC rules, along with assembly of the +charts can be performed by running the following commands: + +.. literalinclude:: ../../../../tools/deployment/developer/02-setup-client.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: .. code-block:: shell - helm install --name=${NAME} ${PATH_TO_CHART}/${NAME} --namespace=${NAMESPACE} + ./tools/deployment/developer/02-setup-client.sh -The below snippet will install the given chart name from the local repository -using the default values. These services must be installed first, as the -OpenStack services depend upon them. + +Deploy the ingress controller +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. literalinclude:: ../../../../tools/deployment/developer/03-ingress.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: .. code-block:: shell - helm install --name=mariadb ./mariadb --namespace=openstack - helm install --name=memcached ./memcached --namespace=openstack - helm install --name=etcd-rabbitmq ./etcd --namespace=openstack - helm install --name=rabbitmq ./rabbitmq --namespace=openstack - helm install --name=ingress ./ingress --namespace=openstack - helm install --name=openvswitch ./openvswitch --namespace=openstack + ./tools/deployment/developer/03-ingress.sh -Libvirt backs persistent volume claims with Ceph by default. To run libvirt -in an all-in-one environment without Ceph, ceph for libvirt must be disabled. +Deploy Ceph +^^^^^^^^^^^ + +.. literalinclude:: ../../../../tools/deployment/developer/04-ceph.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: .. code-block:: shell - helm install --name=libvirt ./libvirt --namespace=openstack \ - --set ceph.enabled=false + ./tools/deployment/developer/04-ceph.sh -If Ceph is included as part of an all-in-one deployment, libvirt can be -installed as normal. +Activate the openstack namespace to be able to use Ceph +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. literalinclude:: ../../../../tools/deployment/developer/05-ceph-ns-activate.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: .. code-block:: shell - helm install --name=libvirt ./libvirt --namespace=openstack + ./tools/deployment/developer/05-ceph-ns-activate.sh -Once the OpenStack infrastructure components are installed and running, the -OpenStack services can be installed. In the below examples the default values -that would be used in a production-like environment have been overridden with -more sensible values for the All-in-One environment using the ``--values`` and -``--set`` options. +Deploy MariaDB +^^^^^^^^^^^^^^ + +.. literalinclude:: ../../../../tools/deployment/developer/06-mariadb.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: .. code-block:: shell - helm install --name=keystone ./keystone --namespace=openstack - helm install --name=glance ./glance --namespace=openstack \ - --set storage=pvc - helm install --name=nova ./nova --namespace=openstack \ - --values=./tools/overrides/mvp/nova.yaml \ - --set conf.nova.libvirt.virt_type=qemu - helm install --name=neutron ./neutron \ - --namespace=openstack --values=./tools/overrides/mvp/neutron-ovs.yaml - helm install --name=horizon ./horizon --namespace=openstack \ - --set network.enable_node_port=true + ./tools/deployment/developer/06-mariadb.sh -Once the install commands have been issued, executing the following will provide -insight into the services' deployment status. +Deploy RabbitMQ +^^^^^^^^^^^^^^^ -:: +.. literalinclude:: ../../../../tools/deployment/developer/07-rabbitmq.sh + :language: shell + :lines: 1,17- - watch kubectl get pods --namespace=openstack +Alternatively, this step can be performed by running the script directly: +.. code-block:: shell -Once the pods all register as Ready, the OpenStack services should be ready to -receive requests. + ./tools/deployment/developer/07-rabbitmq.sh + +Deploy Memcached +^^^^^^^^^^^^^^^^ + +.. literalinclude:: ../../../../tools/deployment/developer/08-memcached.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: + +.. code-block:: shell + + ./tools/deployment/developer/08-memcached.sh + +Deploy Keystone +^^^^^^^^^^^^^^^ + +.. literalinclude:: ../../../../tools/deployment/developer/09-keystone.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: + +.. code-block:: shell + + ./tools/deployment/developer/09-keystone.sh + +Create Ceph endpoints and service account for use with keystone +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. literalinclude:: ../../../../tools/deployment/developer/10-ceph-radosgateway.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: + +.. code-block:: shell + + ./tools/deployment/developer/10-ceph-radosgateway.sh + +Deploy Horizon +^^^^^^^^^^^^^^ + +.. warning:: Horizon deployment is not tested in the OSH development environment + community gates + +.. literalinclude:: ../../../../tools/deployment/developer/11-horizon.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: + +.. code-block:: shell + + ./tools/deployment/developer/11-horizon.sh + +Deploy Glance +^^^^^^^^^^^^^ + +.. literalinclude:: ../../../../tools/deployment/developer/12-glance.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: + +.. code-block:: shell + + ./tools/deployment/developer/12-glance.sh + +Deploy OpenvSwitch +^^^^^^^^^^^^^^^^^^ + +.. literalinclude:: ../../../../tools/deployment/developer/13-openvswitch.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: + +.. code-block:: shell + + ./tools/deployment/developer/13-openvswitch.sh + +Deploy Libvirt +^^^^^^^^^^^^^^ + +.. literalinclude:: ../../../../tools/deployment/developer/14-libvirt.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: + +.. code-block:: shell + + ./tools/deployment/developer/14-libvirt.sh + +Deploy Compute Kit (Nova and Neutron) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. literalinclude:: ../../../../tools/deployment/developer/15-compute-kit.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: + +.. code-block:: shell + + ./tools/deployment/developer/15-compute-kit.sh + +Setup the gateway to the public network +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. literalinclude:: ../../../../tools/deployment/developer/16-setup-gateway.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: + +.. code-block:: shell + + ./tools/deployment/developer/16-setup-gateway.sh + +Deploy Cinder +^^^^^^^^^^^^^ + +.. warning:: Cinder deployment is not tested in the OSH development environment + community gates + +.. literalinclude:: ../../../../tools/deployment/developer/17-cinder.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: + +.. code-block:: shell + + ./tools/deployment/developer/17-cinder.sh + +Deploy Heat +^^^^^^^^^^^ + +.. literalinclude:: ../../../../tools/deployment/developer/18-heat.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: + +.. code-block:: shell + + ./tools/deployment/developer/18-heat.sh + +Exercise the cloud +^^^^^^^^^^^^^^^^^^^ + +.. literalinclude:: ../../../../tools/deployment/developer/19-use-it.sh + :language: shell + :lines: 1,17- + +Alternatively, this step can be performed by running the script directly: + +.. code-block:: shell + + ./tools/deployment/developer/19-use-it.sh Removing Helm Charts -======================= +==================== To delete an installed helm chart, use the following command: @@ -291,14 +351,33 @@ To delete an installed helm chart, use the following command: helm delete ${RELEASE_NAME} --purge This will delete all Kubernetes resources generated when the chart was -instantiated. However for Openstack charts, by default, this will not delete +instantiated. However for OpenStack charts, by default, this will not delete the database and database users that were created when the chart was installed. All OpenStack projects can be configured such that upon deletion, their database -will also be removed. To delete the database when the chart is deleted the database -drop job must be enabled before installing the chart. There are two ways to enable -the job, set the job_db_drop value to true in the chart's values.yaml file, or override -the value using the helm install command as follows: +will also be removed. To delete the database when the chart is deleted the +database drop job must be enabled before installing the chart. There are two +ways to enable the job, set the job_db_drop value to true in the chart's +values.yaml file, or override the value using the helm install command as +follows: .. code-block:: shell helm install ${RELEASE_NAME} --set manifests.job_db_drop=true + + +Environment tear-down +===================== + +To tear-down, the development environment charts should be removed firstly from +the 'openstack' namespace and then the 'ceph' namespace using the commands from +the `Removing Helm Charts`_ section. Once this has been done the namespaces +themselves can be cleaned by running: + +.. code-block:: shell + + kubectl delete namespace + +Final cleanup of the development environment is then performed by removing the +``/var/lib/openstack-helm`` directory from the host. This will restore the +environment back to a clean Kubernetes deployment, that can either be manually +removed or over-written by restarting the deployment process. diff --git a/tools/deployment/developer/00-install-packages.sh b/tools/deployment/developer/00-install-packages.sh new file mode 100755 index 0000000000..4a74acdd4e --- /dev/null +++ b/tools/deployment/developer/00-install-packages.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# 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. + +set -xe + +sudo apt-get update +sudo apt-get install --no-install-recommends -y \ + ca-certificates \ + git \ + make \ + jq \ + nmap \ + curl diff --git a/tools/deployment/developer/01-deploy-k8s.sh b/tools/deployment/developer/01-deploy-k8s.sh new file mode 100755 index 0000000000..6d7e41db6e --- /dev/null +++ b/tools/deployment/developer/01-deploy-k8s.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# 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. + +set -xe + +: ${OSH_INFRA_PATH:="../openstack-helm-infra"} +cd ${OSH_INFRA_PATH} +make dev-deploy setup-host +make dev-deploy k8s diff --git a/tools/deployment/developer/02-setup-client.sh b/tools/deployment/developer/02-setup-client.sh new file mode 100755 index 0000000000..81075d1198 --- /dev/null +++ b/tools/deployment/developer/02-setup-client.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# 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. + +set -xe + +sudo -H pip install python-openstackclient python-heatclient + +sudo -H mkdir -p /etc/openstack +cat << EOF | sudo -H tee -a /etc/openstack/clouds.yaml +clouds: + openstack_helm: + region_name: RegionOne + identity_api_version: 3 + auth: + username: 'admin' + password: 'password' + project_name: 'admin' + project_domain_name: 'default' + user_domain_name: 'default' + auth_url: 'http://keystone.openstack.svc.cluster.local/v3' +EOF +sudo -H chown -R $(id -un): /etc/openstack + +#NOTE: Relax RBAC +kubectl replace -f ./tools/kubeadm-aio/assets/opt/rbac/dev.yaml + +#NOTE: Build charts +make all diff --git a/tools/deployment/developer/03-ingress.sh b/tools/deployment/developer/03-ingress.sh new file mode 100755 index 0000000000..73c3d7b2f3 --- /dev/null +++ b/tools/deployment/developer/03-ingress.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# 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. + +set -xe + +#NOTE: Pull images and lint chart +make pull-images ingress + +#NOTE: Deploy command +helm install ./ingress \ + --namespace=openstack \ + --name=ingress + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh openstack + +#NOTE: Display info +helm status ingress diff --git a/tools/deployment/developer/04-ceph.sh b/tools/deployment/developer/04-ceph.sh new file mode 100755 index 0000000000..4e86733864 --- /dev/null +++ b/tools/deployment/developer/04-ceph.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# 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. + +set -xe + +#NOTE: Pull images and lint chart +make pull-images ceph + +#NOTE: Deploy command +WORK_DIR=$(pwd) +helm install --namespace=ceph ${WORK_DIR}/ceph --name=ceph \ + --set endpoints.identity.namespace=openstack \ + --set endpoints.object_store.namespace=ceph \ + --set endpoints.ceph_mon.namespace=ceph \ + --set ceph.rgw_keystone_auth=true \ + --set network.public=172.17.0.1/16 \ + --set network.cluster=172.17.0.1/16 \ + --set deployment.storage_secrets=true \ + --set deployment.ceph=true \ + --set deployment.rbd_provisioner=true \ + --set deployment.client_secrets=false \ + --set deployment.rgw_keystone_user_and_endpoints=false \ + --set bootstrap.enabled=true \ + --values=${WORK_DIR}/tools/overrides/mvp/ceph.yaml + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh ceph + +#NOTE: Validate deploy +MON_POD=$(kubectl get pods \ + --namespace=ceph \ + --selector="application=ceph" \ + --selector="component=mon" \ + --no-headers | awk '{ print $1; exit }') +kubectl exec -n ceph ${MON_POD} -- ceph -s diff --git a/tools/deployment/developer/05-ceph-ns-activate.sh b/tools/deployment/developer/05-ceph-ns-activate.sh new file mode 100755 index 0000000000..7028bb9f6c --- /dev/null +++ b/tools/deployment/developer/05-ceph-ns-activate.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# 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. + +set -xe + +#NOTE: Pull images and lint chart +make pull-images ceph + +#NOTE: Deploy command +WORK_DIR=$(pwd) +helm install --namespace=openstack ${WORK_DIR}/ceph --name=ceph-openstack-config \ + --set endpoints.identity.namespace=openstack \ + --set endpoints.object_store.namespace=ceph \ + --set endpoints.ceph_mon.namespace=ceph \ + --set ceph.rgw_keystone_auth=true \ + --set network.public=172.17.0.1/16 \ + --set network.cluster=172.17.0.1/16 \ + --set deployment.storage_secrets=false \ + --set deployment.ceph=false \ + --set deployment.rbd_provisioner=false \ + --set deployment.client_secrets=true \ + --set deployment.rgw_keystone_user_and_endpoints=false \ + --values=${WORK_DIR}/tools/overrides/mvp/ceph.yaml + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +kubectl get -n openstack jobs --show-all +kubectl get -n openstack secrets +kubectl get -n openstack configmaps diff --git a/tools/deployment/developer/06-mariadb.sh b/tools/deployment/developer/06-mariadb.sh new file mode 100755 index 0000000000..b3ae2f43da --- /dev/null +++ b/tools/deployment/developer/06-mariadb.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# 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. + +set -xe + +#NOTE: Pull images and lint chart +make pull-images mariadb + +#NOTE: Deploy command +helm install ./mariadb \ + --namespace=openstack \ + --name=mariadb \ + --set pod.replicas.server=1 + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +helm status mariadb diff --git a/tools/deployment/developer/07-rabbitmq.sh b/tools/deployment/developer/07-rabbitmq.sh new file mode 100755 index 0000000000..cf862c003d --- /dev/null +++ b/tools/deployment/developer/07-rabbitmq.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# 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. + +set -xe + +#NOTE: Pull images and lint chart +make pull-images etcd +make pull-images rabbitmq + +#NOTE: Deploy command +helm install ./etcd \ + --namespace=openstack \ + --name=etcd-rabbitmq +helm install ./rabbitmq \ + --namespace=openstack \ + --name=rabbitmq \ + --set pod.replicas.server=1 + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +helm status etcd-rabbitmq +helm status rabbitmq diff --git a/tools/deployment/developer/08-memcached.sh b/tools/deployment/developer/08-memcached.sh new file mode 100755 index 0000000000..13677fcbd4 --- /dev/null +++ b/tools/deployment/developer/08-memcached.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# 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. + +set -xe + +#NOTE: Pull images and lint chart +make pull-images memcached + +#NOTE: Deploy command +helm install ./memcached \ + --namespace=openstack \ + --name=memcached + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +helm status memcached diff --git a/tools/deployment/developer/09-keystone.sh b/tools/deployment/developer/09-keystone.sh new file mode 100755 index 0000000000..3e961cbac0 --- /dev/null +++ b/tools/deployment/developer/09-keystone.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# 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. + +set -xe + +#NOTE: Pull images and lint chart +make pull-images keystone + +#NOTE: Deploy command +helm install ./keystone \ + --namespace=openstack \ + --name=keystone + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +helm status keystone +export OS_CLOUD=openstack_helm +openstack endpoint list diff --git a/tools/deployment/developer/10-ceph-radosgateway.sh b/tools/deployment/developer/10-ceph-radosgateway.sh new file mode 100755 index 0000000000..723186a3b1 --- /dev/null +++ b/tools/deployment/developer/10-ceph-radosgateway.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# 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. + +set -xe + +#NOTE: Pull images and lint chart +make pull-images ceph + +#NOTE: Deploy command +WORK_DIR=$(pwd) +helm install --namespace=openstack ${WORK_DIR}/ceph --name=radosgw-openstack \ + --set endpoints.identity.namespace=openstack \ + --set endpoints.object_store.namespace=ceph \ + --set endpoints.ceph_mon.namespace=ceph \ + --set ceph.rgw_keystone_auth=true \ + --set network.public=172.17.0.1/16 \ + --set network.cluster=172.17.0.1/16 \ + --set deployment.storage_secrets=false \ + --set deployment.ceph=false \ + --set deployment.rbd_provisioner=false \ + --set deployment.client_secrets=false \ + --set deployment.rgw_keystone_user_and_endpoints=true \ + --values=${WORK_DIR}/tools/overrides/mvp/ceph.yaml + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +helm status radosgw-openstack +export OS_CLOUD=openstack_helm +openstack service list +openstack container create 'mygreatcontainer' +curl -L -o /tmp/important-file.jpg https://imgflip.com/s/meme/Cute-Cat.jpg +openstack object create --name 'superimportantfile.jpg' 'mygreatcontainer' /tmp/important-file.jpg diff --git a/tools/deployment/developer/11-horizon.sh b/tools/deployment/developer/11-horizon.sh new file mode 100755 index 0000000000..b38dde26e1 --- /dev/null +++ b/tools/deployment/developer/11-horizon.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# 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. + +set -xe + +#NOTE: Pull images and lint chart +make pull-images horizon + +#NOTE: Deploy command +helm install ./horizon \ + --namespace=openstack \ + --name=horizon \ + --set network.node_port.enabled=true \ + --set network.node_port.port=31000 + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +helm status horizon diff --git a/tools/deployment/developer/12-glance.sh b/tools/deployment/developer/12-glance.sh new file mode 100755 index 0000000000..5d15d45684 --- /dev/null +++ b/tools/deployment/developer/12-glance.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# 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. + +set -xe + +#NOTE: Pull images and lint chart +make pull-images glance + +#NOTE: Deploy command +GLANCE_BACKEND="radosgw" # NOTE(portdirect), this could be: radosgw, rbd, swift or pvc +helm install ./glance \ + --namespace=openstack \ + --name=glance \ + --set storage=${GLANCE_BACKEND} + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +helm status glance +export OS_CLOUD=openstack_helm +openstack service list +sleep 15 +openstack image list +openstack image show 'Cirros 0.3.5 64-bit' diff --git a/tools/deployment/developer/13-openvswitch.sh b/tools/deployment/developer/13-openvswitch.sh new file mode 100755 index 0000000000..2f98a94607 --- /dev/null +++ b/tools/deployment/developer/13-openvswitch.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# 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. +set -xe + +#NOTE: Pull images and lint chart +make pull-images openvswitch + +#NOTE: Deploy command +helm install ./openvswitch \ + --namespace=openstack \ + --name=openvswitch + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +helm status openvswitch diff --git a/tools/deployment/developer/14-libvirt.sh b/tools/deployment/developer/14-libvirt.sh new file mode 100755 index 0000000000..811a0b7cab --- /dev/null +++ b/tools/deployment/developer/14-libvirt.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# 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. +set -xe + +#NOTE: Pull images and lint chart +make pull-images libvirt + +#NOTE: Deploy command +helm install ./libvirt \ + --namespace=openstack \ + --name=libvirt + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +helm status libvirt diff --git a/tools/deployment/developer/15-compute-kit.sh b/tools/deployment/developer/15-compute-kit.sh new file mode 100755 index 0000000000..6608976ebc --- /dev/null +++ b/tools/deployment/developer/15-compute-kit.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# 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. +set -xe + +#NOTE: Pull images and lint chart +make pull-images nova +make pull-images neutron + +#NOTE: Deploy command +helm install ./nova \ + --namespace=openstack \ + --name=nova \ + --set conf.nova.libvirt.virt_type=qemu +helm install ./neutron \ + --namespace=openstack \ + --name=neutron \ + --values=./tools/overrides/mvp/neutron-ovs.yaml + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +export OS_CLOUD=openstack_helm +openstack service list +sleep 15 +openstack hypervisor list +openstack network agent list diff --git a/tools/deployment/developer/16-setup-gateway.sh b/tools/deployment/developer/16-setup-gateway.sh new file mode 100755 index 0000000000..44cb66ac60 --- /dev/null +++ b/tools/deployment/developer/16-setup-gateway.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# 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. +set -xe + +# Assign IP address to br-ex +OSH_BR_EX_ADDR="172.24.4.1/24" +OSH_EXT_SUBNET="172.24.4.0/24" +sudo ip addr add ${OSH_BR_EX_ADDR} dev br-ex +sudo ip link set br-ex up + +# Setup masquerading on default route dev to public subnet +DEFAULT_ROUTE_DEV="ens3" +sudo iptables -t nat -A POSTROUTING -o ${DEFAULT_ROUTE_DEV} -s ${OSH_EXT_SUBNET} -j MASQUERADE diff --git a/tools/deployment/developer/17-cinder.sh b/tools/deployment/developer/17-cinder.sh new file mode 100755 index 0000000000..4d8ccfd7e4 --- /dev/null +++ b/tools/deployment/developer/17-cinder.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# 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. +set -xe + +#NOTE: Pull images and lint chart +make pull-images cinder + +#NOTE: Deploy command +helm install ./cinder \ + --namespace=openstack \ + --name=cinder + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +export OS_CLOUD=openstack_helm +openstack service list +sleep 15 +openstack volume type list diff --git a/tools/deployment/developer/18-heat.sh b/tools/deployment/developer/18-heat.sh new file mode 100755 index 0000000000..e5ef2b85ba --- /dev/null +++ b/tools/deployment/developer/18-heat.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# 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. +set -xe + +#NOTE: Pull images and lint chart +make pull-images heat + +#NOTE: Deploy command +helm install ./heat \ + --namespace=openstack \ + --name=heat + +#NOTE: Wait for deploy +./tools/deployment/developer/wait-for-pods.sh openstack + +#NOTE: Validate Deployment info +export OS_CLOUD=openstack_helm +openstack service list +sleep 15 +openstack orchestration service list diff --git a/tools/deployment/developer/19-use-it.sh b/tools/deployment/developer/19-use-it.sh new file mode 100755 index 0000000000..5cee3c4eaa --- /dev/null +++ b/tools/deployment/developer/19-use-it.sh @@ -0,0 +1,99 @@ +#!/bin/bash + +# 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. +set -xe + +export OS_CLOUD=openstack_helm + +export OSH_EXT_NET_NAME="public" +export OSH_EXT_SUBNET_NAME="public-subnet" +export OSH_EXT_SUBNET="172.24.4.0/24" +export OSH_BR_EX_ADDR="172.24.4.1/24" +openstack stack create --wait \ + --parameter network_name=${OSH_EXT_NET_NAME} \ + --parameter physical_network_name=public \ + --parameter subnet_name=${OSH_EXT_SUBNET_NAME} \ + --parameter subnet_cidr=${OSH_EXT_SUBNET} \ + --parameter subnet_gateway=${OSH_BR_EX_ADDR%/*} \ + -t ./tools/gate/files/heat-public-net-deployment.yaml \ + heat-public-net-deployment + +export OSH_PRIVATE_SUBNET_POOL="10.0.0.0/8" +export OSH_PRIVATE_SUBNET_POOL_NAME="shared-default-subnetpool" +export OSH_PRIVATE_SUBNET_POOL_DEF_PREFIX="24" +openstack stack create --wait \ + --parameter subnet_pool_name=${OSH_PRIVATE_SUBNET_POOL_NAME} \ + --parameter subnet_pool_prefixes=${OSH_PRIVATE_SUBNET_POOL} \ + --parameter subnet_pool_default_prefix_length=${OSH_PRIVATE_SUBNET_POOL_DEF_PREFIX} \ + -t ./tools/gate/files/heat-subnet-pool-deployment.yaml \ + heat-subnet-pool-deployment + + +export OSH_EXT_NET_NAME="public" +export OSH_VM_FLAVOR="m1.tiny" +export OSH_VM_KEY_STACK="heat-vm-key" +export OSH_PRIVATE_SUBNET="10.0.0.0/24" + +# NOTE(portdirect): We do this fancy, and seemingly pointless, footwork to get +# the full image name for the cirros Image without having to be explicit. +export IMAGE_NAME=$(openstack image show -f value -c name \ + $(openstack image list -f csv | awk -F ',' '{ print $2 "," $1 }' | \ + grep "^\"Cirros" | head -1 | awk -F ',' '{ print $2 }' | tr -d '"')) + +# Setup SSH Keypair in Nova +mkdir -p ${HOME}/.ssh +openstack keypair create --private-key ${HOME}/.ssh/osh_key ${OSH_VM_KEY_STACK} +chmod 600 ${HOME}/.ssh/osh_key + +openstack stack create --wait \ + --parameter public_net=${OSH_EXT_NET_NAME} \ + --parameter image="${IMAGE_NAME}" \ + --parameter flavor=${OSH_VM_FLAVOR} \ + --parameter ssh_key=${OSH_VM_KEY_STACK} \ + --parameter cidr=${OSH_PRIVATE_SUBNET} \ + -t ./tools/gate/files/heat-basic-vm-deployment.yaml \ + heat-basic-vm-deployment + +FLOATING_IP=$(openstack floating ip show \ + $(openstack stack resource show \ + heat-basic-vm-deployment \ + server_floating_ip \ + -f value -c physical_resource_id) \ + -f value -c floating_ip_address) + +function wait_for_ssh_port { + # Default wait timeout is 180 seconds + set +x + end=$(date +%s) + if ! [ -z $2 ]; then + end=$((end + $2)) + else + end=$((end + 180)) + fi + while true; do + # Use Nmap as its the same on Ubuntu and RHEL family distros + nmap -Pn -p22 $1 | awk '$1 ~ /22/ {print $2}' | grep -q 'open' && \ + break || true + sleep 1 + now=$(date +%s) + [ $now -gt $end ] && echo "Could not connect to $1 port 22 in time" && exit -1 + done + set -x +} +wait_for_ssh_port $FLOATING_IP + +# SSH into the VM and check it can reach the outside world +ssh-keyscan "$FLOATING_IP" >> ~/.ssh/known_hosts +ssh -i ${HOME}/.ssh/osh_key cirros@${FLOATING_IP} ping -q -c 1 -W 2 ${OSH_BR_EX_ADDR%/*} diff --git a/tools/deployment/developer/wait-for-pods.sh b/tools/deployment/developer/wait-for-pods.sh new file mode 100755 index 0000000000..cf5d489267 --- /dev/null +++ b/tools/deployment/developer/wait-for-pods.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# 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. +set -e + +# From Kolla-Kubernetes, orginal authors Kevin Fox & Serguei Bezverkhi +# Default wait timeout is 300 seconds +end=$(date +%s) +if ! [ -z $2 ]; then + end=$((end + $2)) +else + end=$((end + 300)) +fi +while true; do + kubectl get pods --namespace=$1 -o json | jq -r \ + '.items[].status.phase' | grep Pending > /dev/null && \ + PENDING=True || PENDING=False + query='.items[]|select(.status.phase=="Running")' + query="$query|.status.containerStatuses[].ready" + kubectl get pods --namespace=$1 -o json | jq -r "$query" | \ + grep false > /dev/null && READY="False" || READY="True" + kubectl get jobs -o json --namespace=$1 | jq -r \ + '.items[] | .spec.completions == .status.succeeded' | \ + grep false > /dev/null && JOBR="False" || JOBR="True" + [ $PENDING == "False" -a $READY == "True" -a $JOBR == "True" ] && \ + break || true + sleep 1 + now=$(date +%s) + [ $now -gt $end ] && echo containers failed to start. && \ + kubectl get pods --namespace $1 -o wide && exit -1 +done diff --git a/tools/gate/playbooks/dev-deploy.yaml b/tools/gate/playbooks/dev-deploy.yaml new file mode 100644 index 0000000000..cb89d7da27 --- /dev/null +++ b/tools/gate/playbooks/dev-deploy.yaml @@ -0,0 +1,138 @@ +# 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. + +- hosts: primary + tasks: + - name: Deploy Required packages + shell: | + set -xe; + ./tools/deployment/developer/00-install-packages.sh + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Deploy Required packages + shell: | + set -xe; + ./tools/deployment/developer/01-deploy-k8s.sh + vars: + OSH_INFRA_PATH: "{{ zuul_osh_infra_relative_path | default('') }}" + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Setup OS and K8s Clients + shell: | + set -xe; + ./tools/deployment/developer/02-setup-client.sh + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Deploy Ingress + shell: | + set -xe; + ./tools/deployment/developer/03-ingress.sh + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Deploy Ceph + shell: | + set -xe; + ./tools/deployment/developer/04-ceph.sh + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Deploy Ceph NS Activate + shell: | + set -xe; + ./tools/deployment/developer/05-ceph-ns-activate.sh + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Deploy Mariadb + shell: | + set -xe; + ./tools/deployment/developer/06-mariadb.sh + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Deploy RabbitMQ + shell: | + set -xe; + ./tools/deployment/developer/07-rabbitmq.sh + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Deploy Memcached + shell: | + set -xe; + ./tools/deployment/developer/08-memcached.sh + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Deploy Keystone + shell: | + set -xe; + ./tools/deployment/developer/09-keystone.sh + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Deploy Ceph Keystone RadosGW + shell: | + set -xe; + ./tools/deployment/developer/10-ceph-radosgateway.sh + args: + chdir: "{{ zuul.project.src_dir }}" + # - name: Deploy Horizon + # shell: | + # set -xe; + # ./tools/deployment/developer/11-horizon.sh + # args: + # chdir: "{{ zuul.project.src_dir }}" + - name: Deploy Glance + shell: | + set -xe; + ./tools/deployment/developer/12-glance.sh + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Deploy openvswitch + shell: | + set -xe; + ./tools/deployment/developer/13-openvswitch.sh + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Deploy libvirt + shell: | + set -xe; + ./tools/deployment/developer/14-libvirt.sh + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Deploy compute kit + shell: | + set -xe; + ./tools/deployment/developer/15-compute-kit.sh + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Deploy setup gateway + shell: | + set -xe; + ./tools/deployment/developer/16-setup-gateway.sh + args: + chdir: "{{ zuul.project.src_dir }}" + # - name: Deploy cinder + # shell: | + # set -xe; + # ./tools/deployment/developer/17-cinder.sh + # args: + # chdir: "{{ zuul.project.src_dir }}" + - name: Deploy heat + shell: | + set -xe; + ./tools/deployment/developer/18-heat.sh + args: + chdir: "{{ zuul.project.src_dir }}" + - name: Deploy use the cloud + shell: | + set -xe; + ./tools/deployment/developer/19-use-it.sh + args: + chdir: "{{ zuul.project.src_dir }}" diff --git a/tools/pull-images.sh b/tools/pull-images.sh index 65253ebadc..4abfda823e 100755 --- a/tools/pull-images.sh +++ b/tools/pull-images.sh @@ -1,6 +1,13 @@ #!/bin/bash set -x -for CHART_DIR in ./*/ ; do + +if [ "x$1" == "x" ]; then + CHART_DIRS="$(echo ./*/)" +else + CHART_DIRS="$(echo ./$1/)" +fi + +for CHART_DIR in ${CHART_DIRS} ; do if [ -e ${CHART_DIR}values.yaml ]; then for IMAGE in $(cat ${CHART_DIR}values.yaml | yq '.images.tags | map(.) | join(" ")' | tr -d '"'); do sudo docker inspect $IMAGE >/dev/null|| sudo docker pull $IMAGE