Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud foundation - phase 3 merge to master #343

Merged
merged 33 commits into from Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
109d358
Added `VCP Peering` template
sourced-praveenc Oct 19, 2018
6b6d160
Updated `Project` template documentation
sourced-vince Oct 20, 2018
bc39c37
Added `Cloud Build and Build Trigger` template
sourced-praveenc Oct 20, 2018
cf925a3
Added `Managed Instance Group` template
sourced-pavel Oct 20, 2018
9fc95cd
Updated `Health check` template documentation
alexander-levitski Oct 21, 2018
8dee01d
Add Internal Load Balancer template (#298)
sourced-pavel Oct 22, 2018
73e1ef4
Added `Dataproc` template
sourced-pavel Oct 28, 2018
df320d4
Updated `BigQuery` template documentation
alexander-levitski Oct 28, 2018
04f0a30
Updated `GCS Bucket` template documentation
alexander-levitski Oct 28, 2018
3ccb4b7
Add Cloud Key Management Service (KMS) Template (#266)
sourced-praveenc Oct 29, 2018
90fdc28
Normalizing output variables across templates
sourced-vince Oct 30, 2018
89085a1
CFT deployment tool (#289)
tiadobatima1 Nov 3, 2018
3f7d942
Add bastion host template (#308)
sourced-pavel Nov 3, 2018
95a7bee
Add Cloud SQL template (#317)
sourced-pavel Nov 5, 2018
865d549
Add logsink support for org/billing account/project/folder (#315)
sourced-vince Nov 6, 2018
9e38d8d
GCS_bucket merge issue fix
ocsig Nov 6, 2018
59f16ee
Fix PR#333 Logsink destination is storage, not bucket (#336)
sourced-vince Nov 9, 2018
ff0cbc7
Interconnect Attachment Template (#305)
jlittle-sourced Nov 9, 2018
e9aa7c5
Interconnect Template (#312)
jlittle-sourced Nov 9, 2018
ac8417f
Add external load balancer template (#307)
sourced-pavel Nov 12, 2018
ef6af4e
Added `Spanner` template
sourced-vince Nov 12, 2018
92be76e
Add Forseti template (#328)
sourced-pavel Nov 12, 2018
b9dea56
Added `Cloud Runtime Configurator` template
sourced-praveenc Nov 12, 2018
9b88a0e
hotfix
ocsig Nov 13, 2018
e291263
Added `Stackdriver Metric Descriptor` template
sourced-praveenc Nov 13, 2018
fbbecec
Added `Cloud Tasks` template
sourced-praveenc Nov 13, 2018
522762d
CFT test - GKE version hotfix
ocsig Nov 14, 2018
4592531
GKE version update to latest for tests
ocsig Nov 15, 2018
cceb321
Hotfix networkURL > selfLink test
ocsig Nov 15, 2018
9d75474
CFT - GKE - cluster version assert remove
ocsig Nov 15, 2018
4a70f75
NAT Gateway Template (#310)
sourced-vince Nov 15, 2018
cd4f4a0
CFT - Test - gcloud beta install removal
ocsig Nov 15, 2018
b9f82cf
Fix PR#334/330/329 (#342)
sourced-vince Nov 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions community/cloud-foundation/.coveragerc
@@ -0,0 +1,6 @@
[report]
precision=1
fail_under=60
show_missing = True
exclude_lines =
if __name__ == .__main__.:
5 changes: 3 additions & 2 deletions community/cloud-foundation/.style.yapf
@@ -1,6 +1,7 @@
[style]
based_on_style = google
allow_split_before_dict_value = False
dedent_closing_brackets = True
indent_dictionary_value = True
split_before_expression_after_opening_paren=True
split_all_comma_separated_values=True
split_before_expression_after_opening_paren = True
split_all_comma_separated_values = True
1 change: 1 addition & 0 deletions community/cloud-foundation/MANIFEST.in
@@ -0,0 +1 @@
include VERSION requirements/install.txt requirements/development.txt
108 changes: 34 additions & 74 deletions community/cloud-foundation/Makefile
@@ -1,91 +1,51 @@
#
# The correct way to setup a dev environment:
#
# $ sudo make virtualenv-requirements
# $ make virtualenv
# $ source virtualenv/bin/activate
# $ make development
#

# And the correct way of deleting the dev environment:
#
# $ deactivate
# $ make clean-venv (or make clean-all)
#

PACKAGE := cloud_foundation
TESTDIR := tests
PYTHON := python2.7
PYTHON ?= python
SHELL := /bin/bash
PACKAGE = cloud_foundation_toolkit

help:
@echo "virtualenv Create a virtualenv"
@echo "development Install dependencies and install package in editable mode"
@echo "style Run style checks and coverage: "
@echo "test Run tests"
@echo "clean clean-all Clean up and clean up removing virtualenv"

.ONESHELL:
.PHONY: clean clean-all clean-virtualenv development development-requirements virtualenv
#.PHONY: check check-style check-coverage test dist develop install clean-all clean clean-venv ci-build ci-test ci-upload ci-cleanup install-test-requirements clean-pip-dependencies

@echo "cft-prerequisites Installs prerequisites for CFT python utility development"
@echo "cft-venv Creates the virtual environment called 'venv' for development"
@echo "cft-clean-venv Deletes the development environment"
@echo "cft-test Runs all unit tests from outside of the venv (for CI tools)"
@echo "cft-test-venv Runs all unit tests from withing the venv (for active development)"
@echo "template-prerequisites Install prerequisites for template development"
@echo "build Builds the package"
@echo "install Installs the package system wide"
@echo "uninstall Uninstalls the package"
@echo "clean Cleanup build/test/cache files"

virtualenv-requirements:
${PYTHON} -m pip install --upgrade pip
${PYTHON} -m pip install --upgrade virtualenv

development-requirements:
${PYTHON} -m pip install --upgrade pip
${PYTHON} -m pip install -r requirements/development.txt

#
# Configure virtual + dev environment
#

# install virtual environment
# IMPORTANT: activate venv after running this
virtualenv:
${PYTHON} -m virtualenv $@
@echo "===> IMPORTANT: Activate your virtual environment if you're developing locally:"
@echo "========># source $@/bin/activate"
@touch $@
.ONESHELL:
.PHONY: cft-prerequisites cft-venv cft-clean-venv cft-test cft-test-venv template-prerequisites

# install package in develoment mode (for local dev only!)
development:
# ${PYTHON} -m pip install -e .
${PYTHON} -m pip install -r requirements/development.txt
${PYTHON} -m pip install -r requirements/install.txt
git clone https://github.com/sstephenson/bats.git && cd bats && ./install.sh ../virtualenv
prerequisites:
${PYTHON} -m pip install -r requirements/prerequisites.txt

cft-venv:
${PYTHON} -m tox -e venv

cft-clean-venv:
rm -rf venv

cft-test:
${PYTHON} -m tox

#
# style, coverage and tests
#
cft-test-venv:
${PYTHON} -m pytest -v

# checks code style
style:
${PYTHON} -m yapf -r templates -i
# ${PYTHON} -m pylint
template-prerequisites:
rm -rf bats && git clone https://github.com/sstephenson/bats.git && ./bats/install.sh venv && rm -rf bats

# tests the tool
#test:
# ${PYTHON} -m pytest
build:
${PYTHON} setup.py sdist bdist_wheel

install:
${PYTHON} -m pip install dist/${PACKAGE}-$$(cat VERSION)-py2.py3-none-any.whl

#
# cleanup
#
clean-all: clean-virtualenv clean
uninstall:
${PYTHON} -m pip uninstall ${PACKAGE} -y

# cleans up python compiled files, built packages, tests results, caches, etc
clean:
find . \( -path '*__pycache__/*' -o -name __pycache__ \) -delete
find src/${PACKAGE} \( -path '*__pycache__/*' -o -name __pycache__ \) -delete
find tests \( -path '*__pycache__/*' -o -name __pycache__ \) -delete
rm -rf build dist *.egg-info .cache .eggs .coverage

# cleans up a python virtual environment.
# IMPORTANT: deactivate virtualenv prior to running this!
clean-virtualenv:
rm -rf virtualenv

84 changes: 14 additions & 70 deletions community/cloud-foundation/README.md
@@ -1,78 +1,22 @@
# Cloud Foundation Toolkit Project

This project aims to provide a number of high-quality, production-ready GCP
Deployment Manager templates, tools, example usage and documentation to help
enterprises to create their foundational infrastructure in Google Cloud.
## Overview

The Cloud Foundation toolkit (henceforth, CFT) includes the following parts:

## Usage

The DM templates developed by this project can be used either (1) individually
via the `gloud` utility, or (2) via the Cloud Foundation tool that will be able to link
multiple unrelated templates together in order to deploy the foundation as a whole

### Deploying infrastructure with individual templates via gcloud

Each individual template has it's own usage documentation in their respective folders.
For example, `templates/cloud_router/README.md`

The specific configuration for each template is different, but in general
deployments via `gcloud` should be done by creating a *DM config file*
referencing the template(s), then invoking `gcloud`:

```
gcloud deployment-manager deployments create <YOUR_DEPLOYMENT_NAME> \
--config <YOUR_DEPLOYMENT_CONFIG>.yaml
```

As an example, to create a simple network with the `network.py` template, create
a deployment config file:

```
# This is my_network.yaml file
imports:
- path: templates/network.py

resources:
- name: my-network
type: templates/network.py
properties:
name: my-network
autoCreateSubnetworks: true
```

The properties, required and optional, defined by the `network.py` template can
be found in the schema file associated with the template: `network.py.schema`.
These properties can be tweaked to implement infrastructure that are specific
to a particular enterprise.

Once the deployment config is ready, think of a name for your deployment, say,
`my-network-deployment` and execute `gcloud`, giving the name and config file
as arguments:

```
gcloud deployment-manager deployments create my-network-deployment \
--config my_network.yaml
```


### Deploying infrastructure with the Cloud Foundation tool

**TO BE IMPLEMENTED**


## Contributing

Detailed information on contributing and developing can be found
[here](docs/development.md)


## Testing

Detailed information on testing can be found [here](docs/testing.md)
- A comprehensive set of production-ready resource templates that follow
Google's best practices, which can be used with the CFT or the gcloud
utility (part of the Google Cloud SDK) - see
[the template directory](templates/README.md)
- A command-line interface (henceforth, CLI) that deploys resources defined in
single or multiple CFT-compliant config files - see:
- The CFT source Python files (the `src/` directory)
- The [CFT User Guide](docs/userguide.md)

In addition, the CFT repository includes a sample pipeline that enables running
CFT deployment operations from Jenkins - see the
[pipeline directory](pipeline/README.md).

## License

Apache 2.0 - See [LICENSE](LICENSE) for more information.

Apache 2.0 - See [LICENSE](LICENSE) for more information.
1 change: 1 addition & 0 deletions community/cloud-foundation/VERSION
@@ -0,0 +1 @@
0.0.2
60 changes: 0 additions & 60 deletions community/cloud-foundation/docs/development.md

This file was deleted.