diff --git a/Dockerfiles/Makefile b/Dockerfiles/Makefile deleted file mode 100644 index a8c19fb4..00000000 --- a/Dockerfiles/Makefile +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright 2019 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 -# -# https://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. - -# It's necessary to set this because some environments don't link sh -> bash. -SHELL := /bin/bash - -# APP INFO -DOCKER_REGISTRY ?= quay.io -IMAGE_PREFIX ?= airshipit -IMAGE_NAME ?= -IMAGE_TAG ?= latest -PROXY ?= http://proxy.foo.com:8000 -NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local -USE_PROXY ?= false -PUSH_IMAGE ?= false -# use this variable for image labels added in internal build process -LABEL ?= org.airshipit.build=community -COMMIT ?= $(shell git rev-parse HEAD) -DISTRO_SUFFIX ?= $(DISTRO) -IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO_SUFFIX} -BASE_IMAGE ?= - -# VERSION INFO -GIT_COMMIT = ${COMMIT} -GIT_SHA = $(shell git rev-parse --short HEAD) -GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null) -GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean") - -ifdef VERSION - DOCKER_VERSION = $(VERSION) -endif - -ifeq "$(DISTRO_SUFFIX)" "" - # We expect that container is named 'porthole-xxxxx', and - # subdirectory is named 'xxxxx'; so we cut 'porthole-' from - # directory names here below and in next statement - DOCKERFILE = "$(subst porthole-,,$(IMAGE_NAME))/Dockerfile" -else - DOCKERFILE = "$(subst porthole-,,$(IMAGE_NAME))/Dockerfile.$(DISTRO_SUFFIX)" -endif - -info: - @echo "Version: ${VERSION}" - @echo "Git Tag: ${GIT_TAG}" - @echo "Git Commit: ${GIT_COMMIT}" - @echo "Git Tree State: ${GIT_DIRTY}" - @echo "Docker Version: ${DOCKER_VERSION}" - @echo "Registry: ${DOCKER_REGISTRY}" - -all: - @echo "And what is there's nothing in there? You die, and there's" \ - "nothing beyond that. Nothing. Nothing remains. Someone might" \ - "remember you for a little while after but not for long.">&2; exit 2 - -check-docker: - @if [ -z $$(which docker) ]; then \ - echo "Missing \`docker\` client which is required for development"; \ - exit 2; \ - fi - -_BASE_IMAGE_ARG := $(if $(BASE_IMAGE),--build-arg FROM="${BASE_IMAGE}" ,) - -build-image-$(IMAGE_NAME): check-docker -ifeq "$(IMAGE_NAME)" "" - @echo "Missing \`IMAGE_NAME\` variable." >&2; exit 2 -endif -ifeq ($(USE_PROXY), true) - docker build --network host -t $(IMAGE) --label $(LABEL) \ - --label "org.opencontainers.image.revision=$(COMMIT)" \ - --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ - --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ - -f $(DOCKERFILE) \ - $(_BASE_IMAGE_ARG) \ - --build-arg http_proxy=$(PROXY) \ - --build-arg https_proxy=$(PROXY) \ - --build-arg HTTP_PROXY=$(PROXY) \ - --build-arg HTTPS_PROXY=$(PROXY) \ - --build-arg no_proxy=$(NO_PROXY) \ - --build-arg NO_PROXY=$(NO_PROXY) . -else - docker build --network host -t $(IMAGE) --label $(LABEL) \ - --label "org.opencontainers.image.revision=$(COMMIT)" \ - --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ - --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ - -f $(DOCKERFILE) \ - $(_BASE_IMAGE_ARG) . -endif -ifeq ($(PUSH_IMAGE), true) - docker push $(IMAGE) -endif - -.PHONY: all build-image-$(IMAGE_NAME) build-image-% check-docker info diff --git a/Makefile b/Makefile index 1594bdc6..fe810ba0 100644 --- a/Makefile +++ b/Makefile @@ -15,48 +15,157 @@ # It's necessary to set this because some environments don't link sh -> bash. SHELL := /bin/bash -HELM := helm -TASK := build +# APP INFO +DOCKER_REGISTRY ?= quay.io +IMAGE_PREFIX ?= airshipit +IMAGE_NAME ?= +IMAGE_TAG ?= latest +BUILD_DIR := $(shell mktemp -d) +HELM ?= $(BUILD_DIR)/helm +CHARTS := $(patsubst charts/%/.,%,$(wildcard charts/*/.)) +IMAGES := $(patsubst images/%/.,%,$(wildcard images/*/.)) +PROXY ?= http://proxy.foo.com:8000 +NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local +USE_PROXY ?= false +PUSH_IMAGE ?= false +# use this variable for image labels added in internal build process +LABEL ?= org.airshipit.build=community +COMMIT ?= $(shell git rev-parse HEAD) +DISTRO_SUFFIX ?= $(DISTRO) +IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO_SUFFIX} +BASE_IMAGE ?= -EXCLUDES := helm-toolkit docs tools logs tmp Dockerfiles zuul.d jmphost -CHARTS := helm-toolkit $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) +# VERSION INFO +GIT_COMMIT = ${COMMIT} +GIT_SHA = $(shell git rev-parse --short HEAD) +GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null) +GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean") -.PHONY: $(EXCLUDES) $(CHARTS) +HELM_PIDFILE ?= $(abspath ./.helm-pid) -all: $(CHARTS) +ifdef VERSION + DOCKER_VERSION = $(VERSION) +endif -$(CHARTS): - @echo - @echo "===== Processing [$@] chart =====" - @make $(TASK)-$@ +ifeq "$(DISTRO_SUFFIX)" "" + # We expect that container is named 'porthole-xxxxx', and + # subdirectory is named 'xxxxx'; so we cut 'porthole-' from + # directory names here below and in next statement + DOCKERFILE = "images/$(subst porthole-,,$(IMAGE_NAME))/Dockerfile" +else + DOCKERFILE = "images/$(subst porthole-,,$(IMAGE_NAME))/Dockerfile.$(DISTRO_SUFFIX)" +endif -init-%: - if [ -f $*/Makefile ]; then make -C $*; fi - if [ -f $*/requirements.yaml ]; then helm dep up $*; fi +info: + @echo "Version: ${VERSION}" + @echo "Git Tag: ${GIT_TAG}" + @echo "Git Commit: ${GIT_COMMIT}" + @echo "Git Tree State: ${GIT_DIRTY}" + @echo "Docker Version: ${DOCKER_VERSION}" + @echo "Registry: ${DOCKER_REGISTRY}" -lint-%: init-% - if [ -d $* ]; then $(HELM) lint $*; fi +all: lint charts images + @echo "And what is there's nothing in there? You die, and there's" \ + "nothing beyond that. Nothing. Nothing remains. Someone might" \ + "remember you for a little while after but not for long." -build-%: lint-% - if [ -d $* ]; then $(HELM) package $*; fi +check-docker: + @if [ -z $$(which docker) ]; then \ + echo "Missing \`docker\` client which is required for development"; \ + exit 2; \ + fi + +dry-run: clean $(addprefix dry-run-,$(CHARTS)) + +dry-run-%: helm-lint-% + echo Running Dry-Run on chart $* + cd charts; $(HELM) template --set pod.resources.enabled=true $* + +charts: $(CHARTS) + @echo "Done building charts." + +$(CHARTS): $(addprefix dry-run-,$(CHARTS)) chartbanner + $(HELM) package -d charts charts/$@ + +chartbanner: + @echo "Building charts: $(CHARTS)" + +lint: helm_lint + +helm-lint: $(addprefix helm-lint-,$(CHARTS)) + +helm-lint-%: helm-init-% + @echo "Linting chart $*" + cd charts;$(HELM) lint $* + +helm-init-%: helm-serve + @echo "Initializing chart $*" + cd charts;if [ -s $*/requirements.yaml ]; then echo "Initializing $*";$(HELM) dep up $*; fi + +helm-serve: helm-install + ./tools/helm_tk.sh $(HELM) $(HELM_PIDFILE) + +# Install helm binary +helm-install: + ./tools/helm_install.sh $(HELM) + +dry-run: + +docs: + @echo "Not implemented." >&2; exit 2 clean: - @echo "Removed .b64, _partials.tpl, and _globals.tpl files" - rm -f helm-toolkit/secrets/*.b64 - rm -f */templates/_partials.tpl - rm -f */templates/_globals.tpl - rm -f *tgz */charts/*tgz - rm -f */requirements.lock - -rm -rf */charts */tmpcharts + rm -rf build + rm -f charts/*.tgz + rm -f charts/*/requirements.lock + rm -rf charts/*/charts -pull-all-images: - @./tools/pull-images.sh +run_images: + @echo "Not implemented." >&2; exit 2 -pull-images: - @./tools/pull-images.sh $(filter-out $@,$(MAKECMDGOALS)) +run_$(IMAGE_NAME): + @echo "Not implemented." >&2; exit 2 -dev-deploy: - @./tools/gate/devel/start.sh $(filter-out $@,$(MAKECMDGOALS)) +tests: + @echo "Not implemented." >&2; exit 2 -%: - @: +format: + @echo "Not implemented." >&2; exit 2 + +images: $(addprefix build-image-,$(IMAGES)) + @echo "Done building images." + +_BASE_IMAGE_ARG := $(if $(BASE_IMAGE),--build-arg FROM="${BASE_IMAGE}" ,) + +build-image-%: IMAGE_NAME = $* +build-image-%: + @echo "Building $(IMAGE_NAME)..." +ifeq ($(USE_PROXY), true) + @echo docker build --network host -t $(IMAGE) --label $(LABEL) \ + --label "org.opencontainers.image.revision=$(COMMIT)" \ + --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ + --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ + -f $(DOCKERFILE) \ + $(_BASE_IMAGE_ARG) \ + --build-arg http_proxy=$(PROXY) \ + --build-arg https_proxy=$(PROXY) \ + --build-arg HTTP_PROXY=$(PROXY) \ + --build-arg HTTPS_PROXY=$(PROXY) \ + --build-arg no_proxy=$(NO_PROXY) \ + --build-arg NO_PROXY=$(NO_PROXY) . +else + @echo docker build --network host -t $(IMAGE) --label $(LABEL) \ + --label "org.opencontainers.image.revision=$(COMMIT)" \ + --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ + --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ + -f $(DOCKERFILE) \ + $(_BASE_IMAGE_ARG) . +endif +ifeq ($(PUSH_IMAGE), true) + @echo docker push $(IMAGE) +endif + +.PHONY: $(CHARTS) all build-image-% chartbanner charts check-docker clean \ + docs dry-run-% dry-run format helm-init-% helm-install helm-lint-% \ + helm-lint helm-serve images info lint run_$(IMAGE_NAME) run_images \ + tests diff --git a/calicoctl-utility/Chart.yaml b/charts/calicoctl-utility/Chart.yaml similarity index 100% rename from calicoctl-utility/Chart.yaml rename to charts/calicoctl-utility/Chart.yaml diff --git a/calicoctl-utility/requirements.yaml b/charts/calicoctl-utility/requirements.yaml similarity index 100% rename from calicoctl-utility/requirements.yaml rename to charts/calicoctl-utility/requirements.yaml diff --git a/calicoctl-utility/templates/bin/_bootstrap.sh.tpl b/charts/calicoctl-utility/templates/bin/_bootstrap.sh.tpl similarity index 100% rename from calicoctl-utility/templates/bin/_bootstrap.sh.tpl rename to charts/calicoctl-utility/templates/bin/_bootstrap.sh.tpl diff --git a/calicoctl-utility/templates/bin/_calicoctl-utility-rootwrap.tpl b/charts/calicoctl-utility/templates/bin/_calicoctl-utility-rootwrap.tpl similarity index 100% rename from calicoctl-utility/templates/bin/_calicoctl-utility-rootwrap.tpl rename to charts/calicoctl-utility/templates/bin/_calicoctl-utility-rootwrap.tpl diff --git a/calicoctl-utility/templates/bin/_override-oslo-rootwrap-logging.sh.tpl b/charts/calicoctl-utility/templates/bin/_override-oslo-rootwrap-logging.sh.tpl similarity index 100% rename from calicoctl-utility/templates/bin/_override-oslo-rootwrap-logging.sh.tpl rename to charts/calicoctl-utility/templates/bin/_override-oslo-rootwrap-logging.sh.tpl diff --git a/calicoctl-utility/templates/bin/_utilscli-sudo.tpl b/charts/calicoctl-utility/templates/bin/_utilscli-sudo.tpl similarity index 100% rename from calicoctl-utility/templates/bin/_utilscli-sudo.tpl rename to charts/calicoctl-utility/templates/bin/_utilscli-sudo.tpl diff --git a/calicoctl-utility/templates/bin/_utilscli.tpl b/charts/calicoctl-utility/templates/bin/_utilscli.tpl similarity index 100% rename from calicoctl-utility/templates/bin/_utilscli.tpl rename to charts/calicoctl-utility/templates/bin/_utilscli.tpl diff --git a/calicoctl-utility/templates/bin/_version_check.sh.tpl b/charts/calicoctl-utility/templates/bin/_version_check.sh.tpl similarity index 100% rename from calicoctl-utility/templates/bin/_version_check.sh.tpl rename to charts/calicoctl-utility/templates/bin/_version_check.sh.tpl diff --git a/calicoctl-utility/templates/configmap-bin.yaml b/charts/calicoctl-utility/templates/configmap-bin.yaml similarity index 100% rename from calicoctl-utility/templates/configmap-bin.yaml rename to charts/calicoctl-utility/templates/configmap-bin.yaml diff --git a/calicoctl-utility/templates/configmap-etc.yaml b/charts/calicoctl-utility/templates/configmap-etc.yaml similarity index 100% rename from calicoctl-utility/templates/configmap-etc.yaml rename to charts/calicoctl-utility/templates/configmap-etc.yaml diff --git a/calicoctl-utility/templates/deployment-calicoctl-utility.yaml b/charts/calicoctl-utility/templates/deployment-calicoctl-utility.yaml similarity index 100% rename from calicoctl-utility/templates/deployment-calicoctl-utility.yaml rename to charts/calicoctl-utility/templates/deployment-calicoctl-utility.yaml diff --git a/calicoctl-utility/templates/job-image-repo-sync.yaml b/charts/calicoctl-utility/templates/job-image-repo-sync.yaml similarity index 100% rename from calicoctl-utility/templates/job-image-repo-sync.yaml rename to charts/calicoctl-utility/templates/job-image-repo-sync.yaml diff --git a/calicoctl-utility/templates/secret-etcd-certificates.yaml b/charts/calicoctl-utility/templates/secret-etcd-certificates.yaml similarity index 100% rename from calicoctl-utility/templates/secret-etcd-certificates.yaml rename to charts/calicoctl-utility/templates/secret-etcd-certificates.yaml diff --git a/calicoctl-utility/values.yaml b/charts/calicoctl-utility/values.yaml similarity index 100% rename from calicoctl-utility/values.yaml rename to charts/calicoctl-utility/values.yaml diff --git a/ceph-utility/Chart.yaml b/charts/ceph-utility/Chart.yaml similarity index 100% rename from ceph-utility/Chart.yaml rename to charts/ceph-utility/Chart.yaml diff --git a/ceph-utility/requirements.yaml b/charts/ceph-utility/requirements.yaml similarity index 100% rename from ceph-utility/requirements.yaml rename to charts/ceph-utility/requirements.yaml diff --git a/ceph-utility/templates/bin/_bootstrap.sh.tpl b/charts/ceph-utility/templates/bin/_bootstrap.sh.tpl similarity index 100% rename from ceph-utility/templates/bin/_bootstrap.sh.tpl rename to charts/ceph-utility/templates/bin/_bootstrap.sh.tpl diff --git a/ceph-utility/templates/bin/_managekey.sh.tpl b/charts/ceph-utility/templates/bin/_managekey.sh.tpl similarity index 100% rename from ceph-utility/templates/bin/_managekey.sh.tpl rename to charts/ceph-utility/templates/bin/_managekey.sh.tpl diff --git a/ceph-utility/templates/bin/_utilscli-sudo.tpl b/charts/ceph-utility/templates/bin/_utilscli-sudo.tpl similarity index 100% rename from ceph-utility/templates/bin/_utilscli-sudo.tpl rename to charts/ceph-utility/templates/bin/_utilscli-sudo.tpl diff --git a/ceph-utility/templates/bin/utility/_ceph-utility-rootwrap.tpl b/charts/ceph-utility/templates/bin/utility/_ceph-utility-rootwrap.tpl similarity index 100% rename from ceph-utility/templates/bin/utility/_ceph-utility-rootwrap.tpl rename to charts/ceph-utility/templates/bin/utility/_ceph-utility-rootwrap.tpl diff --git a/ceph-utility/templates/bin/utility/_help.tpl b/charts/ceph-utility/templates/bin/utility/_help.tpl similarity index 100% rename from ceph-utility/templates/bin/utility/_help.tpl rename to charts/ceph-utility/templates/bin/utility/_help.tpl diff --git a/ceph-utility/templates/bin/utility/_osd-maintenance.tpl b/charts/ceph-utility/templates/bin/utility/_osd-maintenance.tpl similarity index 100% rename from ceph-utility/templates/bin/utility/_osd-maintenance.tpl rename to charts/ceph-utility/templates/bin/utility/_osd-maintenance.tpl diff --git a/ceph-utility/templates/bin/utility/_rbd_pv.tpl b/charts/ceph-utility/templates/bin/utility/_rbd_pv.tpl similarity index 100% rename from ceph-utility/templates/bin/utility/_rbd_pv.tpl rename to charts/ceph-utility/templates/bin/utility/_rbd_pv.tpl diff --git a/ceph-utility/templates/bin/utility/_utilscli.tpl b/charts/ceph-utility/templates/bin/utility/_utilscli.tpl similarity index 100% rename from ceph-utility/templates/bin/utility/_utilscli.tpl rename to charts/ceph-utility/templates/bin/utility/_utilscli.tpl diff --git a/ceph-utility/templates/configmap-bin.yaml b/charts/ceph-utility/templates/configmap-bin.yaml similarity index 100% rename from ceph-utility/templates/configmap-bin.yaml rename to charts/ceph-utility/templates/configmap-bin.yaml diff --git a/ceph-utility/templates/configmap-etc-client.yaml b/charts/ceph-utility/templates/configmap-etc-client.yaml similarity index 100% rename from ceph-utility/templates/configmap-etc-client.yaml rename to charts/ceph-utility/templates/configmap-etc-client.yaml diff --git a/ceph-utility/templates/configmap-etc-sudoers.yaml b/charts/ceph-utility/templates/configmap-etc-sudoers.yaml similarity index 100% rename from ceph-utility/templates/configmap-etc-sudoers.yaml rename to charts/ceph-utility/templates/configmap-etc-sudoers.yaml diff --git a/ceph-utility/templates/deployment-utility.yaml b/charts/ceph-utility/templates/deployment-utility.yaml similarity index 100% rename from ceph-utility/templates/deployment-utility.yaml rename to charts/ceph-utility/templates/deployment-utility.yaml diff --git a/ceph-utility/templates/network_policy.yaml b/charts/ceph-utility/templates/network_policy.yaml similarity index 100% rename from ceph-utility/templates/network_policy.yaml rename to charts/ceph-utility/templates/network_policy.yaml diff --git a/ceph-utility/values.yaml b/charts/ceph-utility/values.yaml similarity index 100% rename from ceph-utility/values.yaml rename to charts/ceph-utility/values.yaml diff --git a/compute-utility/Chart.yaml b/charts/compute-utility/Chart.yaml similarity index 100% rename from compute-utility/Chart.yaml rename to charts/compute-utility/Chart.yaml diff --git a/compute-utility/requirements.yaml b/charts/compute-utility/requirements.yaml similarity index 100% rename from compute-utility/requirements.yaml rename to charts/compute-utility/requirements.yaml diff --git a/compute-utility/templates/bin/_bootstrap.sh.tpl b/charts/compute-utility/templates/bin/_bootstrap.sh.tpl similarity index 100% rename from compute-utility/templates/bin/_bootstrap.sh.tpl rename to charts/compute-utility/templates/bin/_bootstrap.sh.tpl diff --git a/compute-utility/templates/bin/_start.sh.tpl b/charts/compute-utility/templates/bin/_start.sh.tpl similarity index 100% rename from compute-utility/templates/bin/_start.sh.tpl rename to charts/compute-utility/templates/bin/_start.sh.tpl diff --git a/compute-utility/templates/bin/_utilscli-sudo.tpl b/charts/compute-utility/templates/bin/_utilscli-sudo.tpl similarity index 100% rename from compute-utility/templates/bin/_utilscli-sudo.tpl rename to charts/compute-utility/templates/bin/_utilscli-sudo.tpl diff --git a/compute-utility/templates/bin/utility/_compute-utility-rootwrap.tpl b/charts/compute-utility/templates/bin/utility/_compute-utility-rootwrap.tpl similarity index 100% rename from compute-utility/templates/bin/utility/_compute-utility-rootwrap.tpl rename to charts/compute-utility/templates/bin/utility/_compute-utility-rootwrap.tpl diff --git a/compute-utility/templates/bin/utility/_compute.tpl b/charts/compute-utility/templates/bin/utility/_compute.tpl similarity index 100% rename from compute-utility/templates/bin/utility/_compute.tpl rename to charts/compute-utility/templates/bin/utility/_compute.tpl diff --git a/compute-utility/templates/bin/utility/_utilscli.tpl b/charts/compute-utility/templates/bin/utility/_utilscli.tpl similarity index 100% rename from compute-utility/templates/bin/utility/_utilscli.tpl rename to charts/compute-utility/templates/bin/utility/_utilscli.tpl diff --git a/compute-utility/templates/configmap-bin.yaml b/charts/compute-utility/templates/configmap-bin.yaml similarity index 100% rename from compute-utility/templates/configmap-bin.yaml rename to charts/compute-utility/templates/configmap-bin.yaml diff --git a/compute-utility/templates/configmap-etc-client.yaml b/charts/compute-utility/templates/configmap-etc-client.yaml similarity index 100% rename from compute-utility/templates/configmap-etc-client.yaml rename to charts/compute-utility/templates/configmap-etc-client.yaml diff --git a/compute-utility/templates/configmap-etc-sudoers.yaml b/charts/compute-utility/templates/configmap-etc-sudoers.yaml similarity index 100% rename from compute-utility/templates/configmap-etc-sudoers.yaml rename to charts/compute-utility/templates/configmap-etc-sudoers.yaml diff --git a/compute-utility/templates/deployment-utility.yaml b/charts/compute-utility/templates/deployment-utility.yaml similarity index 100% rename from compute-utility/templates/deployment-utility.yaml rename to charts/compute-utility/templates/deployment-utility.yaml diff --git a/compute-utility/values.yaml b/charts/compute-utility/values.yaml similarity index 100% rename from compute-utility/values.yaml rename to charts/compute-utility/values.yaml diff --git a/mysqlclient-utility/Chart.yaml b/charts/mysqlclient-utility/Chart.yaml similarity index 100% rename from mysqlclient-utility/Chart.yaml rename to charts/mysqlclient-utility/Chart.yaml diff --git a/mysqlclient-utility/README.md b/charts/mysqlclient-utility/README.md similarity index 100% rename from mysqlclient-utility/README.md rename to charts/mysqlclient-utility/README.md diff --git a/mysqlclient-utility/requirements.yaml b/charts/mysqlclient-utility/requirements.yaml similarity index 100% rename from mysqlclient-utility/requirements.yaml rename to charts/mysqlclient-utility/requirements.yaml diff --git a/mysqlclient-utility/templates/bin/_bootstrap.sh.tpl b/charts/mysqlclient-utility/templates/bin/_bootstrap.sh.tpl similarity index 100% rename from mysqlclient-utility/templates/bin/_bootstrap.sh.tpl rename to charts/mysqlclient-utility/templates/bin/_bootstrap.sh.tpl diff --git a/mysqlclient-utility/templates/bin/_start.sh.tpl b/charts/mysqlclient-utility/templates/bin/_start.sh.tpl similarity index 100% rename from mysqlclient-utility/templates/bin/_start.sh.tpl rename to charts/mysqlclient-utility/templates/bin/_start.sh.tpl diff --git a/mysqlclient-utility/templates/bin/_utilscli-sudo.tpl b/charts/mysqlclient-utility/templates/bin/_utilscli-sudo.tpl similarity index 100% rename from mysqlclient-utility/templates/bin/_utilscli-sudo.tpl rename to charts/mysqlclient-utility/templates/bin/_utilscli-sudo.tpl diff --git a/mysqlclient-utility/templates/bin/utility/_mysqlclient-utility-rootwrap.tpl b/charts/mysqlclient-utility/templates/bin/utility/_mysqlclient-utility-rootwrap.tpl similarity index 100% rename from mysqlclient-utility/templates/bin/utility/_mysqlclient-utility-rootwrap.tpl rename to charts/mysqlclient-utility/templates/bin/utility/_mysqlclient-utility-rootwrap.tpl diff --git a/mysqlclient-utility/templates/bin/utility/_utilscli.tpl b/charts/mysqlclient-utility/templates/bin/utility/_utilscli.tpl similarity index 100% rename from mysqlclient-utility/templates/bin/utility/_utilscli.tpl rename to charts/mysqlclient-utility/templates/bin/utility/_utilscli.tpl diff --git a/mysqlclient-utility/templates/configmap-bin.yaml b/charts/mysqlclient-utility/templates/configmap-bin.yaml similarity index 100% rename from mysqlclient-utility/templates/configmap-bin.yaml rename to charts/mysqlclient-utility/templates/configmap-bin.yaml diff --git a/mysqlclient-utility/templates/configmap-etc-client.yaml b/charts/mysqlclient-utility/templates/configmap-etc-client.yaml similarity index 100% rename from mysqlclient-utility/templates/configmap-etc-client.yaml rename to charts/mysqlclient-utility/templates/configmap-etc-client.yaml diff --git a/mysqlclient-utility/templates/configmap-etc-sudoers.yaml b/charts/mysqlclient-utility/templates/configmap-etc-sudoers.yaml similarity index 100% rename from mysqlclient-utility/templates/configmap-etc-sudoers.yaml rename to charts/mysqlclient-utility/templates/configmap-etc-sudoers.yaml diff --git a/mysqlclient-utility/templates/deployment-utility.yaml b/charts/mysqlclient-utility/templates/deployment-utility.yaml similarity index 100% rename from mysqlclient-utility/templates/deployment-utility.yaml rename to charts/mysqlclient-utility/templates/deployment-utility.yaml diff --git a/mysqlclient-utility/templates/tests/check-mysql-client.yaml b/charts/mysqlclient-utility/templates/tests/check-mysql-client.yaml similarity index 100% rename from mysqlclient-utility/templates/tests/check-mysql-client.yaml rename to charts/mysqlclient-utility/templates/tests/check-mysql-client.yaml diff --git a/mysqlclient-utility/values.yaml b/charts/mysqlclient-utility/values.yaml similarity index 100% rename from mysqlclient-utility/values.yaml rename to charts/mysqlclient-utility/values.yaml diff --git a/ncct-utility/Chart.yaml b/charts/ncct-utility/Chart.yaml similarity index 100% rename from ncct-utility/Chart.yaml rename to charts/ncct-utility/Chart.yaml diff --git a/ncct-utility/requirements.yaml b/charts/ncct-utility/requirements.yaml similarity index 100% rename from ncct-utility/requirements.yaml rename to charts/ncct-utility/requirements.yaml diff --git a/ncct-utility/templates/bin/_bootstrap.sh.tpl b/charts/ncct-utility/templates/bin/_bootstrap.sh.tpl similarity index 100% rename from ncct-utility/templates/bin/_bootstrap.sh.tpl rename to charts/ncct-utility/templates/bin/_bootstrap.sh.tpl diff --git a/ncct-utility/templates/bin/_ncct-utility-rootwrap.tpl b/charts/ncct-utility/templates/bin/_ncct-utility-rootwrap.tpl similarity index 100% rename from ncct-utility/templates/bin/_ncct-utility-rootwrap.tpl rename to charts/ncct-utility/templates/bin/_ncct-utility-rootwrap.tpl diff --git a/ncct-utility/templates/bin/_override-oslo-rootwrap-logging.sh.tpl b/charts/ncct-utility/templates/bin/_override-oslo-rootwrap-logging.sh.tpl similarity index 100% rename from ncct-utility/templates/bin/_override-oslo-rootwrap-logging.sh.tpl rename to charts/ncct-utility/templates/bin/_override-oslo-rootwrap-logging.sh.tpl diff --git a/ncct-utility/templates/bin/_utilscli-sudo.tpl b/charts/ncct-utility/templates/bin/_utilscli-sudo.tpl similarity index 100% rename from ncct-utility/templates/bin/_utilscli-sudo.tpl rename to charts/ncct-utility/templates/bin/_utilscli-sudo.tpl diff --git a/ncct-utility/templates/bin/_utilscli.tpl b/charts/ncct-utility/templates/bin/_utilscli.tpl similarity index 100% rename from ncct-utility/templates/bin/_utilscli.tpl rename to charts/ncct-utility/templates/bin/_utilscli.tpl diff --git a/ncct-utility/templates/configmap-bin.yaml b/charts/ncct-utility/templates/configmap-bin.yaml similarity index 100% rename from ncct-utility/templates/configmap-bin.yaml rename to charts/ncct-utility/templates/configmap-bin.yaml diff --git a/ncct-utility/templates/configmap-etc.yaml b/charts/ncct-utility/templates/configmap-etc.yaml similarity index 100% rename from ncct-utility/templates/configmap-etc.yaml rename to charts/ncct-utility/templates/configmap-etc.yaml diff --git a/ncct-utility/templates/deployment-ncct-utility.yaml b/charts/ncct-utility/templates/deployment-ncct-utility.yaml similarity index 100% rename from ncct-utility/templates/deployment-ncct-utility.yaml rename to charts/ncct-utility/templates/deployment-ncct-utility.yaml diff --git a/ncct-utility/templates/job-image-repo-sync.yaml b/charts/ncct-utility/templates/job-image-repo-sync.yaml similarity index 100% rename from ncct-utility/templates/job-image-repo-sync.yaml rename to charts/ncct-utility/templates/job-image-repo-sync.yaml diff --git a/ncct-utility/values.yaml b/charts/ncct-utility/values.yaml similarity index 100% rename from ncct-utility/values.yaml rename to charts/ncct-utility/values.yaml diff --git a/openstack-utility/Chart.yaml b/charts/openstack-utility/Chart.yaml similarity index 100% rename from openstack-utility/Chart.yaml rename to charts/openstack-utility/Chart.yaml diff --git a/openstack-utility/requirements.yaml b/charts/openstack-utility/requirements.yaml similarity index 100% rename from openstack-utility/requirements.yaml rename to charts/openstack-utility/requirements.yaml diff --git a/openstack-utility/templates/bin/_bootstrap.sh.tpl b/charts/openstack-utility/templates/bin/_bootstrap.sh.tpl similarity index 100% rename from openstack-utility/templates/bin/_bootstrap.sh.tpl rename to charts/openstack-utility/templates/bin/_bootstrap.sh.tpl diff --git a/openstack-utility/templates/bin/_start.sh.tpl b/charts/openstack-utility/templates/bin/_start.sh.tpl similarity index 100% rename from openstack-utility/templates/bin/_start.sh.tpl rename to charts/openstack-utility/templates/bin/_start.sh.tpl diff --git a/openstack-utility/templates/bin/_utilscli-sudo.tpl b/charts/openstack-utility/templates/bin/_utilscli-sudo.tpl similarity index 100% rename from openstack-utility/templates/bin/_utilscli-sudo.tpl rename to charts/openstack-utility/templates/bin/_utilscli-sudo.tpl diff --git a/openstack-utility/templates/bin/utility/_openstack-utility-rootwrap.tpl b/charts/openstack-utility/templates/bin/utility/_openstack-utility-rootwrap.tpl similarity index 100% rename from openstack-utility/templates/bin/utility/_openstack-utility-rootwrap.tpl rename to charts/openstack-utility/templates/bin/utility/_openstack-utility-rootwrap.tpl diff --git a/openstack-utility/templates/bin/utility/_utilscli.tpl b/charts/openstack-utility/templates/bin/utility/_utilscli.tpl similarity index 100% rename from openstack-utility/templates/bin/utility/_utilscli.tpl rename to charts/openstack-utility/templates/bin/utility/_utilscli.tpl diff --git a/openstack-utility/templates/configmap-bin.yaml b/charts/openstack-utility/templates/configmap-bin.yaml similarity index 100% rename from openstack-utility/templates/configmap-bin.yaml rename to charts/openstack-utility/templates/configmap-bin.yaml diff --git a/openstack-utility/templates/configmap-etc-client.yaml b/charts/openstack-utility/templates/configmap-etc-client.yaml similarity index 100% rename from openstack-utility/templates/configmap-etc-client.yaml rename to charts/openstack-utility/templates/configmap-etc-client.yaml diff --git a/openstack-utility/templates/configmap-etc-sudoers.yaml b/charts/openstack-utility/templates/configmap-etc-sudoers.yaml similarity index 100% rename from openstack-utility/templates/configmap-etc-sudoers.yaml rename to charts/openstack-utility/templates/configmap-etc-sudoers.yaml diff --git a/openstack-utility/templates/deployment-utility.yaml b/charts/openstack-utility/templates/deployment-utility.yaml similarity index 100% rename from openstack-utility/templates/deployment-utility.yaml rename to charts/openstack-utility/templates/deployment-utility.yaml diff --git a/openstack-utility/values.yaml b/charts/openstack-utility/values.yaml similarity index 100% rename from openstack-utility/values.yaml rename to charts/openstack-utility/values.yaml diff --git a/Dockerfiles/calicoctl-utility/Dockerfile_calicoctl_only.alpine b/images/calicoctl-utility/Dockerfile_calicoctl_only.alpine similarity index 100% rename from Dockerfiles/calicoctl-utility/Dockerfile_calicoctl_only.alpine rename to images/calicoctl-utility/Dockerfile_calicoctl_only.alpine diff --git a/Dockerfiles/calicoctl-utility/Dockerfile_calicoq_calicoctl.alpine b/images/calicoctl-utility/Dockerfile_calicoq_calicoctl.alpine similarity index 100% rename from Dockerfiles/calicoctl-utility/Dockerfile_calicoq_calicoctl.alpine rename to images/calicoctl-utility/Dockerfile_calicoq_calicoctl.alpine diff --git a/Dockerfiles/calicoctl-utility/Makefile b/images/calicoctl-utility/Makefile similarity index 100% rename from Dockerfiles/calicoctl-utility/Makefile rename to images/calicoctl-utility/Makefile diff --git a/Dockerfiles/calicoctl-utility/README b/images/calicoctl-utility/README similarity index 100% rename from Dockerfiles/calicoctl-utility/README rename to images/calicoctl-utility/README diff --git a/Dockerfiles/ceph-utility/Dockerfile.ubuntu b/images/ceph-utility/Dockerfile.ubuntu similarity index 100% rename from Dockerfiles/ceph-utility/Dockerfile.ubuntu rename to images/ceph-utility/Dockerfile.ubuntu diff --git a/Dockerfiles/ceph-utility/Makefile b/images/ceph-utility/Makefile similarity index 100% rename from Dockerfiles/ceph-utility/Makefile rename to images/ceph-utility/Makefile diff --git a/Dockerfiles/ceph-utility/README b/images/ceph-utility/README similarity index 100% rename from Dockerfiles/ceph-utility/README rename to images/ceph-utility/README diff --git a/Dockerfiles/compute-utility/Dockerfile.ubuntu_xenial b/images/compute-utility/Dockerfile.ubuntu_xenial similarity index 100% rename from Dockerfiles/compute-utility/Dockerfile.ubuntu_xenial rename to images/compute-utility/Dockerfile.ubuntu_xenial diff --git a/Dockerfiles/compute-utility/Makefile b/images/compute-utility/Makefile similarity index 100% rename from Dockerfiles/compute-utility/Makefile rename to images/compute-utility/Makefile diff --git a/Dockerfiles/compute-utility/build.sh b/images/compute-utility/build.sh similarity index 100% rename from Dockerfiles/compute-utility/build.sh rename to images/compute-utility/build.sh diff --git a/Dockerfiles/mysqlclient-utility/Dockerfile.ubuntu_xenial b/images/mysqlclient-utility/Dockerfile.ubuntu_xenial similarity index 100% rename from Dockerfiles/mysqlclient-utility/Dockerfile.ubuntu_xenial rename to images/mysqlclient-utility/Dockerfile.ubuntu_xenial diff --git a/Dockerfiles/ncct-utility/Dockerfile.alpine b/images/ncct-utility/Dockerfile.alpine similarity index 100% rename from Dockerfiles/ncct-utility/Dockerfile.alpine rename to images/ncct-utility/Dockerfile.alpine diff --git a/Dockerfiles/ncct-utility/Makefile b/images/ncct-utility/Makefile similarity index 100% rename from Dockerfiles/ncct-utility/Makefile rename to images/ncct-utility/Makefile diff --git a/Dockerfiles/openstack-utility/Dockerfile.ubuntu_xenial b/images/openstack-utility/Dockerfile.ubuntu_xenial similarity index 100% rename from Dockerfiles/openstack-utility/Dockerfile.ubuntu_xenial rename to images/openstack-utility/Dockerfile.ubuntu_xenial diff --git a/Dockerfiles/openstack-utility/build.sh b/images/openstack-utility/build.sh similarity index 100% rename from Dockerfiles/openstack-utility/build.sh rename to images/openstack-utility/build.sh diff --git a/tools/helm_install.sh b/tools/helm_install.sh new file mode 100755 index 00000000..7af4ca5f --- /dev/null +++ b/tools/helm_install.sh @@ -0,0 +1,43 @@ +#!/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. +# + +set -x + +HELM=$1 +HELM_ARTIFACT_URL=${HELM_ARTIFACT_URL:-"https://storage.googleapis.com/kubernetes-helm/helm-v2.13.1-linux-amd64.tar.gz"} + + +function install_helm_binary { + if [[ -z "${HELM}" ]] + then + echo "No Helm binary target location." + exit -1 + fi + + if [[ -w "$(dirname ${HELM})" ]] + then + TMP_DIR=${BUILD_DIR:-$(mktemp -d)} + curl -o "${TMP_DIR}/helm.tar.gz" "${HELM_ARTIFACT_URL}" + cd ${TMP_DIR} + tar -xvzf helm.tar.gz + cp "${TMP_DIR}/linux-amd64/helm" "${HELM}" + else + echo "Cannot write to ${HELM}" + exit -1 + fi +} + +install_helm_binary diff --git a/tools/helm_tk.sh b/tools/helm_tk.sh new file mode 100755 index 00000000..21ba4e4b --- /dev/null +++ b/tools/helm_tk.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# Copyright 2017 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 armada chart +# + +set -eux + +HELM=${1} +HELM_PIDFILE=${2} +SERVE_DIR=$(mktemp -d) + +HTK_STABLE_COMMIT=${HTK_COMMIT:-"200b5e902b3a176fbfbe669b6a10a254c9b50f5d"} + +${HELM} init --client-only + +if [[ -s ${HELM_PIDFILE} ]]; then + HELM_PID=$(cat "${HELM_PIDFILE}") + if ps "${HELM_PID}"; then + kill "${HELM_PID}" + sleep 0.5 + if ps "${HELM_PID}"; then + echo Failed to terminate Helm, PID = "${HELM_PID}" + exit 1 + fi + fi +fi + +${HELM} serve & > /dev/null +HELM_PID=${!} +echo Started Helm, PID = "${HELM_PID}" +echo "${HELM_PID}" > "${HELM_PIDFILE}" + +set +x +if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then + 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 +set -x + +if ${HELM} repo list | grep -q "^stable" ; then + ${HELM} repo remove stable +fi + +${HELM} repo add local http://localhost:8879/charts + + +#OSH Makefile is bugged, so ensure helm is in the path +if [[ ${HELM} != "helm" ]] +then + export PATH=${PATH}:$(dirname ${HELM}) +fi + +{ + cd "${SERVE_DIR}" + git clone https://git.openstack.org/openstack/openstack-helm-infra.git || true + cd openstack-helm-infra + git reset --hard "${HTK_STABLE_COMMIT}" + + make helm-toolkit +} + +rm -rf "${SERVE_DIR}"