diff --git a/Makefile b/Makefile index be00a53..089a50c 100644 --- a/Makefile +++ b/Makefile @@ -26,13 +26,15 @@ $(CHARTS): @echo "===== Processing [$@] chart =====" @make $(TASK)-$@ -init-%: - if [ -f $*/Makefile ]; then make -C $*; fi - if [ -f $*/requirements.yaml ]; then helm dep up $*; fi +init-%: clean + DEP_UP_LIST=$* tools/helm_tk.sh $(HELM) lint-%: init-% if [ -d $* ]; then $(HELM) lint $*; fi +dryrun-%: init-% + $(HELM) template $* + build-%: lint-% if [ -d $* ]; then $(HELM) package $*; fi @@ -45,6 +47,4 @@ clean: .PHONY: $(EXCLUDES) $(CHARTS) .PHONY: charts -charts: clean - $(HELM) dep up $(CHART) - $(HELM) package $(CHART) +charts: clean build-$(CHART) diff --git a/divingbell/templates/daemonset-ethtool.yaml b/divingbell/templates/daemonset-ethtool.yaml index 903a919..8490cbf 100644 --- a/divingbell/templates/daemonset-ethtool.yaml +++ b/divingbell/templates/daemonset-ethtool.yaml @@ -25,6 +25,7 @@ kind: DaemonSet metadata: name: {{ $daemonset }} spec: +{{ tuple $envAll $daemonset | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }} template: metadata: labels: diff --git a/divingbell/templates/daemonset-mounts.yaml b/divingbell/templates/daemonset-mounts.yaml index ce09d8d..5d22d89 100644 --- a/divingbell/templates/daemonset-mounts.yaml +++ b/divingbell/templates/daemonset-mounts.yaml @@ -25,6 +25,7 @@ kind: DaemonSet metadata: name: {{ $daemonset }} spec: +{{ tuple $envAll $daemonset | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }} template: metadata: labels: diff --git a/divingbell/templates/daemonset-sysctl.yaml b/divingbell/templates/daemonset-sysctl.yaml index 7fba82f..217fa60 100644 --- a/divingbell/templates/daemonset-sysctl.yaml +++ b/divingbell/templates/daemonset-sysctl.yaml @@ -25,6 +25,7 @@ kind: DaemonSet metadata: name: {{ $daemonset }} spec: +{{ tuple $envAll $daemonset | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }} template: metadata: labels: diff --git a/divingbell/templates/daemonset-uamlite.yaml b/divingbell/templates/daemonset-uamlite.yaml index 453e636..7baa706 100644 --- a/divingbell/templates/daemonset-uamlite.yaml +++ b/divingbell/templates/daemonset-uamlite.yaml @@ -25,6 +25,7 @@ kind: DaemonSet metadata: name: {{ $daemonset }} spec: +{{ tuple $envAll $daemonset | include "helm-toolkit.snippets.kubernetes_upgrades_daemonset" | indent 2 }} template: metadata: labels: diff --git a/divingbell/values.yaml b/divingbell/values.yaml index cbb28dc..e070554 100644 --- a/divingbell/values.yaml +++ b/divingbell/values.yaml @@ -24,3 +24,25 @@ images: conf: chroot_mnt_path: '/mnt' log_colors: False + +pod: + lifecycle: + upgrades: + daemonsets: + pod_replacement_strategy: RollingUpdate + ethtool: + enabled: true + min_ready_seconds: 0 + max_unavailable: 100% + mounts: + enabled: true + min_ready_seconds: 0 + max_unavailable: 100% + uamlite: + enabled: true + min_ready_seconds: 0 + max_unavailable: 100% + sysctl: + enabled: true + min_ready_seconds: 0 + max_unavailable: 100% diff --git a/tools/helm_tk.sh b/tools/helm_tk.sh new file mode 100755 index 0000000..9ed74a0 --- /dev/null +++ b/tools/helm_tk.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# Copyright 2018 AT&T Intellectual Property. All other rights reserved. +# +# 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. +# +# Script to setup helm-toolkit and helm dep up the shipyard chart +# +HELM=$1 +HTK_REPO=${HTK_REPO:-"https://github.com/openstack/openstack-helm"} +HTK_PATH=${HTK_PATH:-""} +DEP_UP_LIST=${DEP_UP_LIST:-"divingbell"} + +if [[ ! -z $(echo $http_proxy) ]] +then + export no_proxy=$no_proxy,127.0.0.1 +fi + +set -x + +function helm_serve { + if [[ -d "$HOME/.helm" ]]; then + echo ".helm directory found" + else + ${HELM} init --client-only + fi + if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then + ${HELM} serve & > /dev/null + while [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; do + sleep 1 + echo "Waiting for Helm Repository" + done + else + echo "Helm serve already running" + fi + + if ${HELM} repo list | grep -q "^stable" ; then + ${HELM} repo remove stable + fi + + ${HELM} repo add local http://localhost:8879/charts +} + +mkdir -p build +pushd build +git clone --depth 1 $HTK_REPO || true +pushd openstack-helm/$HTK_PATH + +git pull +helm_serve +make helm-toolkit +popd && popd +for c in $DEP_UP_LIST +do + ${HELM} dep up $c +done