fix: make pulumi stack sync work again, update docs

This commit is contained in:
Stefan Reimer 2022-06-29 10:30:25 +02:00
parent 7dd648ceff
commit f204d80e7f
3 changed files with 29 additions and 29 deletions

View File

@ -10,18 +10,19 @@ First class support for:
# Install # Install
## Container ## Containerized
This most likely only works on a recent Linux box/VM, which is capable of running rootless containers within containers. The command below tests the ability to run containers within containers on your local setup.
Requires kernel >= 5.10, cgroupsV2 support, podman, ... ( This most likely only works on a recent Linux box/VM, which is capable of running rootless containers within containers.
Requires kernel >= 5.12, Cgroups V2, podman, ... )
``` ```
podman run -it --rm -v .:/workspace -v $HOME/.aws/config:/workspace/.aws/config public.ecr.aws/zero-downtime/cloudbender:latest cloudbender version podman run --rm -v .:/workspace -v $HOME/.aws/config:/workspace/.aws/config public.ecr.aws/zero-downtime/cloudbender:latest podman run -q --rm docker.io/busybox:latest echo "Rootless container inception works!"
``` ```
## Local install ## Local install
1. ```pip install cloudbender``` 1. ```pip3 install cloudbender```
2. ```curl -fsSL https://get.pulumi.com | sh```, see official [Docs](https://www.pulumi.com/docs/get-started/install/) 2. ```curl -fsSL https://get.pulumi.com | sh``` (official [Docs](https://www.pulumi.com/docs/get-started/install/))
3. Ensure you either have `docker` or `podman` in your PATH. 3. install either `podman` or `docker` depending on your platform
To verify that all pieces are in place run: To verify that all pieces are in place run:
``` ```
@ -29,23 +30,11 @@ cloudbender version
``` ```
which should get you something like: which should get you something like:
``` ```
[2022-06-28 16:06:24] CloudBender: 0.13.4 [2022-06-28 16:06:24] CloudBender: 0.13.5
[2022-06-28 16:06:24] Pulumi: v3.34.1 [2022-06-28 16:06:24] Pulumi: v3.34.1
[2022-06-28 16:06:24] Podman/Docker: podman version 4.1.0 [2022-06-28 16:06:24] Podman/Docker: podman version 4.1.0
``` ```
## State management
### Pulumi
The state for all Pulumi resources are stored on S3 in your account and in the same region as the resources being deployed.
No data is send to nor shared with the official Pulumi provided APIs.
CloudBender configures Pulumi with a local, temporary workspace on the fly. This incl. the injection of various common parameters like the AWS account ID and region etc.
### Cloudformation
All state is handled by AWS Cloudformation.
The required account and region are determined by CloudBender automatically from the configuration.
## CLI ## CLI
``` ```
@ -76,20 +65,32 @@ Commands:
version Displays own version and all dependencies version Displays own version and all dependencies
``` ```
# Architecture
## State management
### Pulumi
The state for all Pulumi resources are stored on S3 in your account and in the same region as the resources being deployed.
No data is send to nor shared with the official Pulumi provided APIs.
CloudBender configures Pulumi with a local, temporary workspace on the fly. This incl. the injection of various common parameters like the AWS account ID and region etc.
### Cloudformation
All state is handled by AWS Cloudformation.
The required account and region are determined by CloudBender automatically from the configuration.
## Config management ## Config management
- Within the config folder each directory represents either a stack group if it has sub-directories, or an actual Cloudformation stack in case it is a leaf folder. - Within the config folder each directory represents either a stack group if it has sub-directories, or an actual Cloudformation stack in case it is a leaf folder.
- The actual configuration for each stack is hierachly merged. Lower level config files overwrite higher-level values. Complex data structures like dictionaries and arrays are deep merged. - The actual configuration for each stack is hierachly merged. Lower level config files overwrite higher-level values. Complex data structures like dictionaries and arrays are deep merged.
## Secrets handling ## Secrets
### Pulumi ### Pulumi
CloudBender supports the native Pulumi secret handling. CloudBender supports the native Pulumi secret handling.
See [Pulumi Docs](https://www.pulumi.com/docs/intro/concepts/secrets/) for details. See [Pulumi Docs](https://www.pulumi.com/docs/intro/concepts/secrets/) for details.
### Cloudformation ### Cloudformation
CloudBender supports [SOPS](https://github.com/mozilla/sops) to encrypt values in any config yaml file since version 0.8.1 CloudBender supports [SOPS](https://github.com/mozilla/sops) to encrypt values in any config file.
If a sops encrypted config file is detected CloudBender will automatically try to decrypt the file during execution. If a sops encrypted config file is detected by CloudBender, it will automatically try to decrypt the file. All required information to decrypt has to be present in the embedded sops config or set ahead of time via sops supported ENVIRONMENT variables.
All required information to decrypt has to be present in the embedded sops config or set ahead of time via sops supported ENVIRONMENT variables.
SOPS support can be disabled by setting `DISABLE_SOPS` in order to reduce timeouts etc. SOPS support can be disabled by setting `DISABLE_SOPS` in order to reduce timeouts etc.

View File

@ -54,7 +54,6 @@ def version():
logger.error(f"CloudBender: {__version__}") logger.error(f"CloudBender: {__version__}")
# Pulumi # Pulumi
# import pdb;pdb.set_trace()
pulumi_version = get_pulumi_version() pulumi_version = get_pulumi_version()
if not pulumi_version: if not pulumi_version:
logger.error( logger.error(
@ -63,7 +62,7 @@ def version():
else: else:
logger.error(f"Pulumi: {pulumi_version}") logger.error(f"Pulumi: {pulumi_version}")
# Docker / podman # Docker / podman version
docker_version = get_docker_version() docker_version = get_docker_version()
if not docker_version: if not docker_version:
logger.error("Podman/Docker: Cannot call podman nor docker") logger.error("Podman/Docker: Cannot call podman nor docker")

View File

@ -7,7 +7,7 @@ import time
import pathlib import pathlib
import pprint import pprint
import pulumi import pulumi
import importlib.resources as pkg_resources import pkg_resources
from datetime import datetime, timedelta from datetime import datetime, timedelta
from dateutil.tz import tzutc from dateutil.tz import tzutc
@ -519,7 +519,7 @@ class Stack(object):
if self.outputs: if self.outputs:
if self.store_outputs: if self.store_outputs:
filename = self.stackname + ".yaml" filename = self.stackname + ".yaml"
my_template = pkg_resources.read_text(templates, "outputs.yaml") my_template = importlib.resources.read_text(templates, "outputs.yaml")
output_file = os.path.join( output_file = os.path.join(
self.ctx["outputs_path"], self.rel_path, filename self.ctx["outputs_path"], self.rel_path, filename
@ -576,7 +576,7 @@ class Stack(object):
return return
if not template: if not template:
doc_template = pkg_resources.read_text(templates, "stack-doc.md") doc_template = importlib.resources.read_text(templates, "stack-doc.md")
jenv = JinjaEnv() jenv = JinjaEnv()
template = jenv.from_string(doc_template) template = jenv.from_string(doc_template)
data = {} data = {}