Gate: Remove unused helm chart deployment role and playbook

This PS removes the unused helm chart deployment role and playbook.

Change-Id: I01c58a628589ec35af2557c8cc93ea47fe084089
Signed-off-by: Pete Birley <pete@port.direct>
This commit is contained in:
Pete Birley 2018-10-04 12:09:31 -05:00 committed by Chris Wedgwood
parent 16a6f7af8f
commit feeeed4d5d
9 changed files with 1 additions and 362 deletions

View File

@ -1,36 +0,0 @@
# 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
vars_files:
- vars.yaml
vars:
work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}"
gather_facts: True
roles:
- build-helm-packages
tags:
- build-helm-packages
- hosts: primary
vars_files:
- vars.yaml
- ../tools/gate/chart-deploys/default.yaml
vars:
work_dir: "{{ zuul.project.src_dir }}/{{ zuul_osh_infra_relative_path | default('') }}"
logs_dir: "/tmp/logs"
roles:
- deploy-helm-packages
tags:
- deploy-helm-packages

View File

@ -1,19 +0,0 @@
# 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.
# This set of tasks creates over-rides that need to be generated dyamicly and
# injected at runtime.
- name: setup directorys on host
file:
path: "{{ work_dir }}/tools/gate/local-overrides/"
state: directory

View File

@ -1,39 +0,0 @@
# 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.
- block:
- name: installing OS-H dev tools
include_role:
name: deploy-package
tasks_from: dist
vars:
packages:
deb:
- git
- make
- curl
- ca-certificates
rpm:
- git
- make
- curl
- name: installing jq
include_role:
name: deploy-jq
tasks_from: main
- name: assemble charts
make:
chdir: "{{ work_dir }}"
register: out
- include: util-setup-dev-environment.yaml

View File

@ -1,27 +0,0 @@
# 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.
- include: generate-dynamic-over-rides.yaml
- name: "creating directory for helm test logs"
file:
path: "{{ logs_dir }}/helm-tests"
state: directory
- name: "iterating through Helm chart groups"
vars:
chart_group_name: "{{ helm_chart_group.name }}"
chart_group_items: "{{ helm_chart_group.charts }}"
include: util-chart-group.yaml
loop_control:
loop_var: helm_chart_group
with_items: "{{ chart_groups }}"

View File

@ -1,29 +0,0 @@
# 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.
- name: "{{ helm_chart_group.name }}"
vars:
chart_def: "{{ charts[helm_chart] }}"
loop_control:
loop_var: helm_chart
include: util-common-helm-chart.yaml
with_items: "{{ helm_chart_group.charts }}"
- name: "Running wait for pods for the charts in the {{ helm_chart_group.name }} group"
when: ('timeout' in helm_chart_group)
include: util-common-wait-for-pods.yaml
vars:
namespace: "{{ charts[helm_chart].namespace }}"
timeout: "{{ helm_chart_group.timeout }}"
loop_control:
loop_var: helm_chart
with_items: "{{ helm_chart_group.charts }}"

View File

@ -1,92 +0,0 @@
# 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.
- name: Helm management common block
vars:
check_deployed_result: null
chart_values_file: null
upgrade:
pre:
delete: null
block:
- name: "create temporary file for {{ chart_def['release'] }}'s values .yaml"
tempfile:
state: file
suffix: .yaml
register: chart_values_file
- name: "write out values.yaml for {{ chart_def['release'] }}"
copy:
dest: "{{ chart_values_file.path }}"
content: "{% if 'values' in chart_def %}{{ chart_def['values'] | to_nice_yaml }}{% else %}{% endif %}"
- name: "check if {{ chart_def['release'] }} is deployed"
command: helm status "{{ chart_def['release'] }}"
register: check_deployed_result
ignore_errors: True
- name: "check if local overrides are present in {{ work_dir }}/tools/gate/local-overrides/{{ chart_def['release'] }}.yaml"
stat:
path: "{{ work_dir }}/tools/gate/local-overrides/{{ chart_def['release'] }}.yaml"
register: local_overrides
- name: "try to deploy release {{ chart_def['release'] }} in {{ chart_def['namespace'] }} namespace with {{ chart_def['chart_name'] }} chart"
when: check_deployed_result is failed
command: "helm install {{ work_dir }}/{{ chart_def['chart_name'] }} --namespace {{ chart_def['namespace'] }} --name {{ chart_def['release'] }} --values={{ chart_values_file.path }}{% if local_overrides.stat.exists %} --values {{ work_dir }}/tools/gate/local-overrides/{{ chart_def['release'] }}.yaml{% endif %}"
register: out
- name: "display info for the helm {{ chart_def['release'] }} release deploy"
when: check_deployed_result is failed
debug:
var: out.stdout_lines
- name: "pre-upgrade, delete jobs for {{ chart_def['release'] }} release"
when:
- check_deployed_result is succeeded
- "'upgrade' in chart_def"
- "'pre' in chart_def['upgrade']"
- "'delete' in chart_def['upgrade']['pre']"
- "chart_def.upgrade.pre.delete is not none"
with_items: "{{ chart_def.upgrade.pre.delete }}"
loop_control:
loop_var: helm_upgrade_delete_job
command: "kubectl delete --namespace {{ chart_def['namespace'] }} job -l application={{ helm_upgrade_delete_job.labels.application }},component={{ helm_upgrade_delete_job.labels.component }} --ignore-not-found=true"
- name: "try to upgrade release {{ chart_def['release'] }} in {{ chart_def['namespace'] }} namespace with {{ chart_def['chart_name'] }} chart"
when: check_deployed_result is succeeded
command: "helm upgrade {{ chart_def['release'] }} {{ work_dir }}/{{ chart_def['chart_name'] }} --values={{ chart_values_file.path }}{% if local_overrides.stat.exists %} --values {{ work_dir }}/tools/gate/local-overrides/{{ chart_def['release'] }}.yaml{% endif %}"
register: out
- name: "display info for the helm {{ chart_def['release'] }} release upgrade"
when: check_deployed_result is succeeded
debug:
var: out.stdout_lines
- include: util-common-wait-for-pods.yaml
when: ('timeout' in chart_def)
vars:
namespace: "{{ chart_def['namespace'] }}"
timeout: "{{ chart_def['timeout'] }}"
- include: util-common-helm-test.yaml
when:
- "'test' in chart_def"
- "chart_def.test is not none"
- "'enabled' in chart_def['test']"
- "chart_def.test.enabled|bool == true"
vars:
release: "{{ chart_def['release'] }}"
namespace: "{{ chart_def['namespace'] }}"
test_settings: "{{ chart_def.test }}"
always:
- name: "remove values.yaml for {{ chart_def['release'] }}"
file:
path: "{{ chart_values_file.path }}"
state: absent

View File

@ -1,67 +0,0 @@
# 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.
- name: Helm test common block
vars:
release: null
namespace: null
test_settings: null
block:
- name: "remove any expired helm test pods for {{ release }}"
command: "kubectl delete pod {{ release }}-test -n {{ namespace }}"
ignore_errors: True
- name: "run helm tests for the {{ release }} release"
when:
- "'timeout' in test_settings"
- "'timeout' is none"
command: "helm test {{ release }}"
register: test_result
- name: "run helm tests for the {{ release }} release with timeout"
when:
- "'timeout' in test_settings"
- "'timeout' is not none"
command: " helm test --timeout {{ test_settings.timeout }} {{ release }}"
register: test_result
- name: "display status for {{ release }} helm tests"
debug:
var: test_result.stdout_lines
- name: "gathering logs for helm tests for {{ release }}"
when:
- test_result is succeeded
shell: |-
set -e
kubectl logs {{ release }}-test -n {{ namespace }} >> {{ logs_dir }}/helm-tests/{{ release }}.txt
args:
executable: /bin/bash
register: test_logs
- name: "displaying logs for successful helm tests for {{ release }}"
when:
- test_result is succeeded
- "'output' in test_settings"
- "test_settings.output|bool == true"
debug:
var: test_logs.stdout_lines
rescue:
- name: "gathering logs for failed helm tests for {{ release }}"
command: "kubectl logs {{ release }}-test -n {{ namespace }}"
register: out
- name: "displaying logs for failed helm tests for {{ release }}"
debug:
var: out.stdout_lines
- name: "helm tests for {{ release }} failed, stopping execution"
command: exit 1

View File

@ -1,50 +0,0 @@
# 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.
- name: wait for pods in namespace
vars:
namespace: null
timeout: 600
wait_return_code:
rc: 1
block:
- name: "wait for pods in {{ namespace }} namespace to be ready"
shell: |-
set -e
kubectl get pods --namespace="{{ namespace }}" -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="{{ namespace }}" -o json | jq -r "$query" | \
grep false > /dev/null && READY="False" || READY="True"
kubectl get jobs -o json --namespace="{{ namespace }}" | jq -r \
'.items[] | .spec.completions == .status.succeeded' | \
grep false > /dev/null && JOBR="False" || JOBR="True"
[ $PENDING == "False" -a $READY == "True" -a $JOBR == "True" ] && \
exit 0 || exit 1
args:
executable: /bin/bash
register: wait_return_code
until: wait_return_code.rc == 0
retries: "{{ timeout }}"
delay: 1
rescue:
- name: "pods failed to come up in time, getting kubernetes objects status"
command: kubectl get --all-namespaces all -o wide --show-all
register: out
- name: "pods failed to come up in time, displaying kubernetes objects status"
debug: var=out.stdout_lines
- name: "pods failed to come up in time, stopping execution"
command: exit 1

View File

@ -75,13 +75,11 @@ if [ "x${DEPLOY}" == "xsetup-host" ]; then
PLAYBOOKS="osh-infra-deploy-docker"
elif [ "x${DEPLOY}" == "xk8s" ]; then
PLAYBOOKS="osh-infra-build osh-infra-deploy-k8s"
elif [ "x${DEPLOY}" == "xcharts" ]; then
PLAYBOOKS="osh-infra-deploy-charts"
elif [ "x${DEPLOY}" == "xlogs" ]; then
PLAYBOOKS="osh-infra-collect-logs"
elif [ "x${DEPLOY}" == "xfull" ]; then
ansible_install
PLAYBOOKS="osh-infra-deploy-docker osh-infra-build osh-infra-deploy-k8s osh-infra-deploy-charts osh-infra-collect-logs"
PLAYBOOKS="osh-infra-deploy-docker osh-infra-build osh-infra-deploy-k8s osh-infra-collect-logs"
else
echo "Unknown Deploy Option Selected"
exit 1