Skip to content

About

Sky Port gate that provides cloud integration

Resources

Stars

5 stars

Watchers

1 watching

Forks

Repository files navigation

Sky Port cloud gate

Sky Port gate that provides cloud integration for Open Workload. It is a FastAPI service used by swm-core to create, query, and destroy cloud partitions (VMs) on Azure and OpenStack.

Source: github.com/openworkload/swm-cloud-gate

What it does

  • Exposes HTTPS REST APIs for cloud partitions, flavors, and images
  • Renders provider templates (ARM / Heat) and cloud-init for job VMs
  • Talks to Azure (service principal + certificate) or OpenStack (libcloud)
  • Runs with mutual TLS: the listener requires a client certificate issued by the Sky Port cluster CA (uvicorn ssl_cert_reqs=CERT_REQUIRED). Sky Port presents secure/node/{cert,key}.pem. Connections without a client cert fail the TLS handshake.

Default listen address: https://<fqdn>:8444

Requirements

  • Python 3.12
  • Sky Port TLS material under /opt/swm/spool/secure/ (node + cluster certs). Override the secure directory with SWM_GATE_SPOOL or SWM_SPOOL (uses $SWM_SPOOL/secure).
  • Provider credentials in ~/.swm/cloud-gate.yaml (copy from config/cloud-gate.yaml)

For Azure setup (service principal, storage, registry), see HOWTO/AZURE.md. For OpenStack (Keystone HTTPS, project credentials, TLS verify), see HOWTO/OPENSTACK.md and HOWTO/SECURITY.md.

Setup

make prepare-venv

Copy and edit the config:

mkdir -p ~/.swm
cp config/cloud-gate.yaml ~/.swm/cloud-gate.yaml
# fill providers.azure and/or providers.openstack credentials

Run

Prefer the swm-core debug container so certs and Python deps match CI:

# from swm-core
make cr
# inside the container, in this repo:
./run.sh

Mocked mode (uses test/data/responses.json, no real cloud calls):

./run-mocked.sh

Optional: SWM_GATE_WORKERS controls uvicorn worker count (default 2 in run.py).

Project layout

swmcloudgate/
  main.py                 # FastAPI app + routers
  routers/azure/          # Azure connector, partitions, flavors, images, templates
  routers/openstack/      # OpenStack / Heat connector and templates
config/cloud-gate.yaml    # Config template
HOWTO/AZURE.md            # Azure account and credentials guide
HOWTO/OPENSTACK.md        # OpenStack Keystone and TLS settings
HOWTO/SECURITY.md         # mTLS and OpenStack credential rules
test/                     # Unit tests

Cloud-init for Azure job VMs lives in:

  • swmcloudgate/routers/azure/templates/cloud-init.yaml
  • swmcloudgate/routers/azure/templates/cloud-init.sh

Development

make format    # autoflake, isort, black
make check     # flake8, black --check, ruff, bandit
make test      # unittest

Run a single test module (example):

make azure_custom_data
# equivalent to: python -m unittest -v test/test_azure_custom_data.py

Regenerate pinned deps after editing requirements.in:

make requirements

Build / publish:

make package
make upload

Contributing

Bug fixes can be submitted directly. For new features or larger changes, please open an issue first.

License

BSD-3-Clause. Contributors retain copyright on their contributions.

About

Sky Port gate that provides cloud integration

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages