Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.idea
.venv
__pycache__
*.py[cod]
11 changes: 11 additions & 0 deletions .github/workflows/containers-openstack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- "containers/octavia/**"
- "containers/openstack-client/**"
- "containers/placement/**"
- "containers/neutron-router-flavor-sync/**"
- "containers/skyline/**"
- ".github/workflows/containers-openstack.yaml"
- ".github/workflows/build-container-reuse.yaml"
Expand Down Expand Up @@ -74,6 +75,16 @@ jobs:
build_args: OPENSTACK_VERSION=2026.1
latest_name: "2026.1"

neutron-router-flavor-sync:
uses: ./.github/workflows/build-container-reuse.yaml
secrets: inherit
with:
container_name: neutron-router-flavor-sync
dockerfile_path: containers/neutron-router-flavor-sync/Dockerfile
build_args: OPENSTACK_VERSION=2026.1
latest_name: "2026.1"
target: prod

ironic:
uses: ./.github/workflows/build-container-reuse.yaml
secrets: inherit
Expand Down
23 changes: 23 additions & 0 deletions containers/neutron-router-flavor-sync/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# syntax=docker/dockerfile:1

ARG OPENSTACK_VERSION="required_argument"
FROM ghcr.io/flant/shell-operator:v1.13.1 AS prod
LABEL org.opencontainers.image.description="Neutron router flavor sync shell-operator"

COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

RUN --mount=type=cache,target=/var/cache/apk apk add python3
RUN python3 -m venv /opt/venv
ENV VIRTUAL_ENV="/opt/venv"
ENV PATH="/opt/venv/bin:$PATH"

ARG OPENSTACK_VERSION="required_argument"
ADD https://releases.openstack.org/constraints/upper/${OPENSTACK_VERSION} /upper-constraints.txt
COPY python/understack-neutron-flavors /src/understack-neutron-flavors
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install \
--upgrade \
--constraint /upper-constraints.txt \
/src/understack-neutron-flavors

COPY --chmod=755 python/understack-neutron-flavors/understack_neutron_flavors/router_flavors.py /hooks/router_flavors.py
4 changes: 4 additions & 0 deletions python/understack-neutron-flavors/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# understack-neutron-flavors

Shell-operator hooks for reconciling Neutron router flavors and service
profiles from UnderStack deploy configuration.
84 changes: 84 additions & 0 deletions python/understack-neutron-flavors/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "understack-neutron-flavors"
description = "Shell-operator hooks for UnderStack Neutron reconciliation"
authors = [{ name = "Understack Developers" }]
requires-python = ">=3.12"
readme = "README.md"
dependencies = [
"openstacksdk>=4.2.0,<5",
]
license = { text = "Apache-2.0" }
dynamic = ["version"]

[project.scripts]
neutron-router-flavors = "understack_neutron_flavors.router_flavors:main"

[project.urls]
Homepage = "https://github.com/rackerlabs/understack"
Issues = "https://github.com/rackerlabs/understack/issues"

[dependency-groups]
test = [
"pytest<10",
"pytest-github-actions-annotate-failures",
"pytest-cov>=6.1.0",
]

[tool.uv]
default-groups = ["test"]

[tool.hatch.build.targets.sdist]
include = ["understack_neutron_flavors"]

[tool.hatch.build.targets.wheel]
include = ["understack_neutron_flavors"]

[tool.hatch.version]
source = "vcs"

[tool.hatch.version.raw-options]
root = "../../"
tag_regex = "^understack-neutron-flavors/v(?P<version>.*)$"
git_describe_command = "git describe --dirty --tags --long --match understack-neutron-flavors/v*"
fallback_version = "0.1.0"

[tool.ruff]
target-version = "py312"
fix = true

[tool.ruff.lint]
select = [
"D", # pydocstyle
"E", # pycodestyle (error)
"F", # pyflakes
"B", # flake8-bugbear
"I", # isort
"S", # flake8-bandit
"UP", # pyupgrade
"ASYNC", # flake8-async
]

ignore = [
"D100", # don't require docs for every module
"D101", # don't require docs for every class
"D102", # don't require docs for every class method
"D103", # don't require docs for every function
"D104", # don't require docs for every package
"D106", # don't require docs for every nested class
"D107", # don't require docs for __init__
"D417", # don't require docs for every function parameter
]

[tool.ruff.lint.isort]
force-single-line = true

[tool.ruff.lint.pydocstyle]
# enable the google doc style rules by default
convention = "google"

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101"] # assert is the point in tests
1 change: 1 addition & 0 deletions python/understack-neutron-flavors/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Tests for understack-neutron-flavors."""
Loading
Loading