feat(armada): adding makefile

- adding makefile

Change-Id: I064d2c95ebaa9fb16656ce36c9ea36c618f9bfad
This commit is contained in:
Alexis Rivera DeLa Torre 2017-10-30 23:10:24 -05:00 committed by gardlt
parent 8b1db2b002
commit aeeeb23b64
8 changed files with 323 additions and 17 deletions

View File

@ -63,7 +63,7 @@ Enforcement
-----------
Instances of abusive, harassing, or otherwise unacceptable behavior may
be reported by contacting the project team at garivera89@gmail.com. The
be reported by contacting the project team. The
project team will review and investigate all complaints, and will
respond in a way that it deems appropriate to the circumstances. The
project team is obligated to maintain confidentiality with regard to the

116
Makefile Normal file
View File

@ -0,0 +1,116 @@
# APP INFO
DOCKER_REGISTRY ?= quay.io
IMAGE_PREFIX ?= attcomdev
SHORT_NAME ?= armada
HELM ?= helm
PYTHON = python3
APP = armada
CHART = charts/armada
# VERSION INFO
GIT_COMMIT = $(shell git rev-parse HEAD)
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
DOCKER_VERSION ?= git-${GIT_SHA}
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${SHORT_NAME}:${DOCKER_VERSION}
SHELL = /bin/bash
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}"
.PHONY: all
all: lint charts images
.PHONY: build
build: bootstrap
$(PYTHON) setup.py install
.PHONY: bootstrap
bootstrap:
pip install -r requirements.txt
.PHONY: bootstrap-all
bootstrap-all: bootstrap
pip install -r test-requirements.txt
.PHONY: check-docker
check-docker:
@if [ -z $$(which docker) ]; then \
echo "Missing \`docker\` client which is required for development"; \
exit 2; \
fi
.PHONY: check-tox
check-tox:
@if [ -z $$(which tox) ]; then \
echo "Missing \`tox\` client which is required for development"; \
exit 2; \
fi
.PHONY: docker-build
images: check-docker
docker build --rm -t ${IMAGE} .
.PHONY: dry-run
dry-run: clean
tools/helm_tk.sh $(HELM)
$(HELM) template $(CHART)
# make tools
.PHONY: protoc
protoc:
@tools/helm-hapi.sh
.PHONY: clean
clean:
rm -rf build
# testing checks
.PHONY: test-all
test-all: check-tox helm_lint
tox
.PHONY: test-unit
test-unit: check-tox
tox -e py35
.PHONY: test-coverage
test-coverage: check-tox
tox -e coverage
.PHONY: test-bandit
test-bandit: check-tox
tox -e bandit
# style checks
.PHONY: lint
lint: test-pep8 helm_lint
.PHONY: test-pep8
test-pep8: check-tox
tox -e pep8
.PHONY: helm-lint
helm_lint:
@tools/helm_tk.sh $(HELM)
$(HELM) lint $(CHART)
.PHONY: charts
charts: clean
$(HELM) dep up $(CHART)
$(HELM) package $(CHART)

View File

@ -22,8 +22,15 @@ To use the docker containter to develop:
docker build . -t armada/latest
make images
.. code-block:: bash
# Run Docker Image
docker run -d --name armada -v ~/.kube/:/armada/.kube/ -v $(pwd)/etc:/etc armada:local
.. note::
The first build will take a little while. Afterwords, it will build much
@ -47,19 +54,44 @@ From the directory of the forked repository:
virtualenv -p python3 venv
.. code-block:: bash
pip install -r requirements.txt -r test-requirements.txt
pip install .
make bootstrap # install only requirements lib
make bootstrap-all # install all requirements and tests lib
.. code-block:: bash
pip install .
make build
.. code-block:: bash
# Testing your armada code
# The tox command will execute lint, bandit, cover
pip install tox
tox
# For targeted test
pip install tox
tox
make test-all
# Linting
tox -e pep8
make test-pep8
make lint
# Bandit
tox -e bandit
tox -e cover
make test-bandit
# Coverage
tox -e coverage
make test-coverage
# build charts
make charts
# policy and config are used in order to use and configure Armada API
tox -e genconfig

View File

@ -36,7 +36,9 @@ Usage
git clone https://github.com/att-comdev/armada && cd armada/
docker build . -t quay.io/attcomdev/armada:latest
2. Run Armada docker container
2. Running Armada
a. docker container
.. note::
@ -54,6 +56,20 @@ Usage
docker run -d --net host -p 8000:8000 --name armada -v $(pwd)/etc/:/etc/ -v ~/.kube/:/armada/.kube/ -v $(pwd)/examples/:/examples quay.io/attcomdev/armada:latest
docker exec armada armada --help
b. Helm Install
.. note::
To install Armada via the Helm chart please make sure to provide an Keysonte
endpoint
.. code:: bash
make charts
helm install <registry>/armada --name armada --namespace armada
3. Check that tiller is Available
.. code:: bash

View File

@ -19,7 +19,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
name='hapi/chart/metadata.proto',
package='hapi.chart',
syntax='proto3',
serialized_pb=_b('\n\x19hapi/chart/metadata.proto\x12\nhapi.chart\")\n\nMaintainer\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05\x65mail\x18\x02 \x01(\t\"\xd0\x02\n\x08Metadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04home\x18\x02 \x01(\t\x12\x0f\n\x07sources\x18\x03 \x03(\t\x12\x0f\n\x07version\x18\x04 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x05 \x01(\t\x12\x10\n\x08keywords\x18\x06 \x03(\t\x12+\n\x0bmaintainers\x18\x07 \x03(\x0b\x32\x16.hapi.chart.Maintainer\x12\x0e\n\x06\x65ngine\x18\x08 \x01(\t\x12\x0c\n\x04icon\x18\t \x01(\t\x12\x12\n\napiVersion\x18\n \x01(\t\x12\x11\n\tcondition\x18\x0b \x01(\t\x12\x0c\n\x04tags\x18\x0c \x01(\t\x12\x12\n\nappVersion\x18\r \x01(\t\x12\x12\n\ndeprecated\x18\x0e \x01(\x08\x12\x15\n\rtillerVersion\x18\x0f \x01(\t\" \n\x06\x45ngine\x12\x0b\n\x07UNKNOWN\x10\x00\x12\t\n\x05GOTPL\x10\x01\x42\x07Z\x05\x63hartb\x06proto3')
serialized_pb=_b('\n\x19hapi/chart/metadata.proto\x12\nhapi.chart\")\n\nMaintainer\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05\x65mail\x18\x02 \x01(\t\"\xc0\x03\n\x08Metadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04home\x18\x02 \x01(\t\x12\x0f\n\x07sources\x18\x03 \x03(\t\x12\x0f\n\x07version\x18\x04 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x05 \x01(\t\x12\x10\n\x08keywords\x18\x06 \x03(\t\x12+\n\x0bmaintainers\x18\x07 \x03(\x0b\x32\x16.hapi.chart.Maintainer\x12\x0e\n\x06\x65ngine\x18\x08 \x01(\t\x12\x0c\n\x04icon\x18\t \x01(\t\x12\x12\n\napiVersion\x18\n \x01(\t\x12\x11\n\tcondition\x18\x0b \x01(\t\x12\x0c\n\x04tags\x18\x0c \x01(\t\x12\x12\n\nappVersion\x18\r \x01(\t\x12\x12\n\ndeprecated\x18\x0e \x01(\x08\x12\x15\n\rtillerVersion\x18\x0f \x01(\t\x12:\n\x0b\x61nnotations\x18\x10 \x03(\x0b\x32%.hapi.chart.Metadata.AnnotationsEntry\x1a\x32\n\x10\x41nnotationsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\" \n\x06\x45ngine\x12\x0b\n\x07UNKNOWN\x10\x00\x12\t\n\x05GOTPL\x10\x01\x42\x07Z\x05\x63hartb\x06proto3')
)
@ -41,8 +41,8 @@ _METADATA_ENGINE = _descriptor.EnumDescriptor(
],
containing_type=None,
options=None,
serialized_start=389,
serialized_end=421,
serialized_start=501,
serialized_end=533,
)
_sym_db.RegisterEnumDescriptor(_METADATA_ENGINE)
@ -85,6 +85,43 @@ _MAINTAINER = _descriptor.Descriptor(
)
_METADATA_ANNOTATIONSENTRY = _descriptor.Descriptor(
name='AnnotationsEntry',
full_name='hapi.chart.Metadata.AnnotationsEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='hapi.chart.Metadata.AnnotationsEntry.key', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='value', full_name='hapi.chart.Metadata.AnnotationsEntry.value', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=_descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001')),
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=449,
serialized_end=499,
)
_METADATA = _descriptor.Descriptor(
name='Metadata',
full_name='hapi.chart.Metadata',
@ -197,10 +234,17 @@ _METADATA = _descriptor.Descriptor(
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='annotations', full_name='hapi.chart.Metadata.annotations', index=15,
number=16, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
nested_types=[_METADATA_ANNOTATIONSENTRY, ],
enum_types=[
_METADATA_ENGINE,
],
@ -211,10 +255,12 @@ _METADATA = _descriptor.Descriptor(
oneofs=[
],
serialized_start=85,
serialized_end=421,
serialized_end=533,
)
_METADATA_ANNOTATIONSENTRY.containing_type = _METADATA
_METADATA.fields_by_name['maintainers'].message_type = _MAINTAINER
_METADATA.fields_by_name['annotations'].message_type = _METADATA_ANNOTATIONSENTRY
_METADATA_ENGINE.containing_type = _METADATA
DESCRIPTOR.message_types_by_name['Maintainer'] = _MAINTAINER
DESCRIPTOR.message_types_by_name['Metadata'] = _METADATA
@ -228,15 +274,25 @@ Maintainer = _reflection.GeneratedProtocolMessageType('Maintainer', (_message.Me
_sym_db.RegisterMessage(Maintainer)
Metadata = _reflection.GeneratedProtocolMessageType('Metadata', (_message.Message,), dict(
AnnotationsEntry = _reflection.GeneratedProtocolMessageType('AnnotationsEntry', (_message.Message,), dict(
DESCRIPTOR = _METADATA_ANNOTATIONSENTRY,
__module__ = 'hapi.chart.metadata_pb2'
# @@protoc_insertion_point(class_scope:hapi.chart.Metadata.AnnotationsEntry)
))
,
DESCRIPTOR = _METADATA,
__module__ = 'hapi.chart.metadata_pb2'
# @@protoc_insertion_point(class_scope:hapi.chart.Metadata)
))
_sym_db.RegisterMessage(Metadata)
_sym_db.RegisterMessage(Metadata.AnnotationsEntry)
DESCRIPTOR.has_options = True
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('Z\005chart'))
_METADATA_ANNOTATIONSENTRY.has_options = True
_METADATA_ANNOTATIONSENTRY._options = _descriptor._ParseOptions(descriptor_pb2.MessageOptions(), _b('8\001'))
try:
# THESE ELEMENTS WILL BE DEPRECATED.
# Please use the generated *_pb2_grpc.py files instead.

View File

@ -20,7 +20,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
name='hapi/release/hook.proto',
package='hapi.release',
syntax='proto3',
serialized_pb=_b('\n\x17hapi/release/hook.proto\x12\x0chapi.release\x1a\x1fgoogle/protobuf/timestamp.proto\"\x81\x03\n\x04Hook\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\x12\x0c\n\x04path\x18\x03 \x01(\t\x12\x10\n\x08manifest\x18\x04 \x01(\t\x12(\n\x06\x65vents\x18\x05 \x03(\x0e\x32\x18.hapi.release.Hook.Event\x12,\n\x08last_run\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0e\n\x06weight\x18\x07 \x01(\x05\"\xd4\x01\n\x05\x45vent\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0f\n\x0bPRE_INSTALL\x10\x01\x12\x10\n\x0cPOST_INSTALL\x10\x02\x12\x0e\n\nPRE_DELETE\x10\x03\x12\x0f\n\x0bPOST_DELETE\x10\x04\x12\x0f\n\x0bPRE_UPGRADE\x10\x05\x12\x10\n\x0cPOST_UPGRADE\x10\x06\x12\x10\n\x0cPRE_ROLLBACK\x10\x07\x12\x11\n\rPOST_ROLLBACK\x10\x08\x12\x18\n\x14RELEASE_TEST_SUCCESS\x10\t\x12\x18\n\x14RELEASE_TEST_FAILURE\x10\nB\tZ\x07releaseb\x06proto3')
serialized_pb=_b('\n\x17hapi/release/hook.proto\x12\x0chapi.release\x1a\x1fgoogle/protobuf/timestamp.proto\"\xe6\x03\n\x04Hook\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\x12\x0c\n\x04path\x18\x03 \x01(\t\x12\x10\n\x08manifest\x18\x04 \x01(\t\x12(\n\x06\x65vents\x18\x05 \x03(\x0e\x32\x18.hapi.release.Hook.Event\x12,\n\x08last_run\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0e\n\x06weight\x18\x07 \x01(\x05\x12\x38\n\x0f\x64\x65lete_policies\x18\x08 \x03(\x0e\x32\x1f.hapi.release.Hook.DeletePolicy\"\xd4\x01\n\x05\x45vent\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0f\n\x0bPRE_INSTALL\x10\x01\x12\x10\n\x0cPOST_INSTALL\x10\x02\x12\x0e\n\nPRE_DELETE\x10\x03\x12\x0f\n\x0bPOST_DELETE\x10\x04\x12\x0f\n\x0bPRE_UPGRADE\x10\x05\x12\x10\n\x0cPOST_UPGRADE\x10\x06\x12\x10\n\x0cPRE_ROLLBACK\x10\x07\x12\x11\n\rPOST_ROLLBACK\x10\x08\x12\x18\n\x14RELEASE_TEST_SUCCESS\x10\t\x12\x18\n\x14RELEASE_TEST_FAILURE\x10\n\")\n\x0c\x44\x65letePolicy\x12\r\n\tSUCCEEDED\x10\x00\x12\n\n\x06\x46\x41ILED\x10\x01\x42\tZ\x07releaseb\x06proto3')
,
dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,])
@ -79,11 +79,33 @@ _HOOK_EVENT = _descriptor.EnumDescriptor(
],
containing_type=None,
options=None,
serialized_start=248,
serialized_end=460,
serialized_start=306,
serialized_end=518,
)
_sym_db.RegisterEnumDescriptor(_HOOK_EVENT)
_HOOK_DELETEPOLICY = _descriptor.EnumDescriptor(
name='DeletePolicy',
full_name='hapi.release.Hook.DeletePolicy',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SUCCEEDED', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FAILED', index=1, number=1,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=520,
serialized_end=561,
)
_sym_db.RegisterEnumDescriptor(_HOOK_DELETEPOLICY)
_HOOK = _descriptor.Descriptor(
name='Hook',
@ -141,12 +163,20 @@ _HOOK = _descriptor.Descriptor(
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='delete_policies', full_name='hapi.release.Hook.delete_policies', index=7,
number=8, type=14, cpp_type=8, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_HOOK_EVENT,
_HOOK_DELETEPOLICY,
],
options=None,
is_extendable=False,
@ -155,12 +185,14 @@ _HOOK = _descriptor.Descriptor(
oneofs=[
],
serialized_start=75,
serialized_end=460,
serialized_end=561,
)
_HOOK.fields_by_name['events'].enum_type = _HOOK_EVENT
_HOOK.fields_by_name['last_run'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
_HOOK.fields_by_name['delete_policies'].enum_type = _HOOK_DELETEPOLICY
_HOOK_EVENT.containing_type = _HOOK
_HOOK_DELETEPOLICY.containing_type = _HOOK
DESCRIPTOR.message_types_by_name['Hook'] = _HOOK
_sym_db.RegisterFileDescriptor(DESCRIPTOR)

View File

@ -1,6 +1,8 @@
#!/usr/bin/env bash
git clone https://github.com/kubernetes/helm ./helm -b $1
HELM_BRANCH='release-2.7'
git clone https://github.com/kubernetes/helm ./helm -b $HELM_BRANCH
python -m grpc_tools.protoc -I helm/_proto --python_out=. --grpc_python_out=. helm/_proto/hapi/chart/*
python -m grpc_tools.protoc -I helm/_proto --python_out=. --grpc_python_out=. helm/_proto/hapi/services/*

52
tools/helm_tk.sh Executable file
View File

@ -0,0 +1,52 @@
#!/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 shipyard chart
#
HELM=$1
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
cd build
git clone --depth 1 https://git.openstack.org/openstack/openstack-helm.git || true
cd openstack-helm
git pull
helm_serve
make charts
${HELM} dep up ../../charts/armada