Skip to content

Commit

Permalink
Merge pull request #314 from rackerlabs/deploy-fixesd
Browse files Browse the repository at this point in the history
fix: deployment issues identified when creating a new env
  • Loading branch information
cardoe authored Sep 17, 2024
2 parents d2cf39e + 4c5ed8e commit 0bdb9b0
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 30 deletions.
13 changes: 7 additions & 6 deletions components/keystone/aio-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ bootstrap:
--user="${OS_USERNAME}" \
--domain="${OS_DEFAULT_DOMAIN}" \
"admin"
# TODO: only create this actually requested
# create 'demo' user with sufficient permissions
openstack user create --or-show --password demo --email '[email protected]' demo
openstack user set --email '[email protected]' demo
# add 'demo' user to 'ucadmin' group
openstack group add user ucadmin demo
# create 'argoworkflow' user
# credentials for ironic-nautobot-sync and other argo workflows
openstack project create undercloud --or-show
Expand Down Expand Up @@ -90,6 +84,13 @@ bootstrap:
openstack role add --group ucadmin --domain default admin
openstack role add --group ucadmin --project undercloud admin
# TODO: only create this actually requested
# create 'demo' user with sufficient permissions
openstack user create --or-show --password demo --email '[email protected]' demo
openstack user set --email '[email protected]' demo
# add 'demo' user to 'ucadmin' group
openstack group add user ucadmin demo
network:
# configure OpenStack Helm to use Undercloud's ingress
# instead of expecting the ingress controller provided
Expand Down
15 changes: 15 additions & 0 deletions operators/rabbitmq-system/cluster-operator/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- https://github.com/rabbitmq/cluster-operator/releases/download/v2.10.0/cluster-operator.yml

# this needs to be here to remove the namespace from the above
# because the cluster-operator defines the same namespace and it would conflict
patches:
- patch: |-
apiVersion: v1
kind: Namespace
metadata:
name: rabbitmq-system
$patch: delete
18 changes: 2 additions & 16 deletions operators/rabbitmq-system/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml

# this needs to be here to remove the namespace from the above
# because the messaging-topology-operator defines the same namespace and it would conflict
patches:
- patch: |-
apiVersion: v1
kind: Namespace
metadata:
name: rabbitmq-system
$patch: delete
# have to put this after the patch above
resources: # yamllint disable-line rule:key-duplicates
- https://github.com/rabbitmq/messaging-topology-operator/releases/download/v1.13.0/messaging-topology-operator-with-certmanager.yaml
- cluster-operator/
- messaging-topology/
13 changes: 13 additions & 0 deletions operators/rabbitmq-system/messaging-topology/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- https://github.com/rabbitmq/messaging-topology-operator/releases/download/v1.13.0/messaging-topology-operator-with-certmanager.yaml
# this needs to be here to remove the namespace from the above
# because the messaging-topology-operator defines the same namespace and it would conflict
patches:
- patch: |-
apiVersion: v1
kind: Namespace
metadata:
name: rabbitmq-system
$patch: delete
26 changes: 26 additions & 0 deletions python/neutron-understack/neutron_understack/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import random
import uuid

import pytest


@pytest.fixture
def device_id() -> uuid.UUID:
return uuid.uuid4()


@pytest.fixture
def mac_address() -> str:
return (
f"{random.randint(0, 255):02x}:"
f"{random.randint(0, 255):02x}:"
f"{random.randint(0, 255):02x}:"
f"{random.randint(0, 255):02x}:"
f"{random.randint(0, 255):02x}:"
f"{random.randint(0, 255):02x}"
)


@pytest.fixture
def network_id() -> uuid.UUID:
return uuid.uuid4()
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,33 @@

import pytest

from neutron_understack.neutron_understack_mech import UnderstackDriver
from neutron_understack.argo.workflows import ArgoClient
from neutron_understack.neutron_understack_mech import UnderstackDriver


@pytest.fixture
def argo_client() -> ArgoClient:
return MagicMock(spec_set=ArgoClient)


def test_move_to_network__provisioning(argo_client):
def test_move_to_network__provisioning(argo_client, device_id, network_id, mac_address):
driver = UnderstackDriver()
driver._move_to_network(
vif_type="other",
mac_address="fa:16:3e:35:1c:3d",
device_uuid="41d18c6a-5548-4ee9-926f-4e3ebf43153f",
network_id="c2702769-5592-4555-8ae6-e670db82c31e",
mac_address=mac_address,
device_uuid=str(device_id),
network_id=str(network_id),
argo_client=argo_client,
)

argo_client.submit.assert_called_once_with(
template_name="undersync-device",
entrypoint="trigger-undersync",
parameters={
"interface_mac": "fa:16:3e:35:1c:3d",
"device_uuid": "41d18c6a-5548-4ee9-926f-4e3ebf43153f",
"interface_mac": mac_address,
"device_uuid": str(device_id),
"network_name": "tenant",
"network_id": str(network_id),
"dry_run": True,
"force": False,
},
Expand Down
7 changes: 7 additions & 0 deletions python/neutron-understack/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"

[tool.poetry]
name = "neutron-understack"
version = "0.1.0"
Expand Down Expand Up @@ -64,3 +68,6 @@ ignore = [
[tool.ruff.lint.pydocstyle]
# enable the google doc style rules by default
convention = "google"

[tool.poetry.plugins."neutron.ml2.mechanism_drivers"]
understack = "neutron_understack.neutron_understack_mech:UnderstackDriver"
4 changes: 3 additions & 1 deletion scripts/gitops-secrets-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ EOF
[ -n "${UC_AIO}" ] && gen-argocd || echo "UC_AIO is NOT set so not creating ArgoCD bits"

echo "Checking cert-manager"
mkdir -p "${DEST_DIR}/cert-manager"
if [ ! -f "${DEST_DIR}/cert-manager/cluster-issuer.yaml" ]; then
if [ "${UC_DEPLOY_EMAIL}" = "" ]; then
echo "UC_DEPLOY_EMAIL is not set. Unable to generate cert-manager issuer." >&2
Expand Down Expand Up @@ -287,14 +288,15 @@ create_os_secret() {
local username=$3
local secret_var="SECRET_${name}"
local data_var="VARNAME_${name}"
local password_var="${!data_var}"
file_suffix=$(convert_to_secret_name "${name}")

echo "Writing ${component}/secret-${file_suffix}.yaml, please commit"
kubectl --namespace openstack \
create secret generic "${!secret_var}" \
--type Opaque \
--from-literal=username="${username}" \
--from-literal=password="${!data_var}" \
--from-literal=password="${!password_var}" \
--dry-run=client -o yaml \
| secret-seal-stdin "${DEST_DIR}/${component}/secret-${file_suffix}.yaml"
}
Expand Down

0 comments on commit 0bdb9b0

Please sign in to comment.