Skip to content

Commit

Permalink
fix: allow node roles different than bootstrapped node (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
skatsaounis authored Jun 27, 2024
1 parent 94ed47c commit 81bb7a0
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 117 deletions.
23 changes: 23 additions & 0 deletions anvil-python/anvil/commands/haproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import List

from sunbeam.clusterd.client import Client
from sunbeam.commands.terraform import TerraformInitStep
from sunbeam.jobs.juju import JujuHelper
from sunbeam.jobs.manifest import BaseStep
from sunbeam.jobs.steps import (
AddMachineUnitsStep,
DeployMachineApplicationStep,
RemoveMachineUnitStep,
)

from anvil.jobs.manifest import Manifest
from anvil.provider.local.deployment import LocalDeployment

APPLICATION = "haproxy"
CONFIG_KEY = "TerraformVarsHaproxyPlan"
Expand Down Expand Up @@ -103,3 +108,21 @@ def __init__(

def get_unit_timeout(self) -> int:
return HAPROXY_UNIT_TIMEOUT


def haproxy_install_steps(
client: Client,
manifest: Manifest,
jhelper: JujuHelper,
deployment: LocalDeployment,
fqdn: str,
) -> List[BaseStep]:
return [
TerraformInitStep(manifest.get_tfhelper("haproxy-plan")),
DeployHAProxyApplicationStep(
client, manifest, jhelper, deployment.infrastructure_model
),
AddHAProxyUnitsStep(
client, fqdn, jhelper, deployment.infrastructure_model
),
]
23 changes: 23 additions & 0 deletions anvil-python/anvil/commands/maas_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import List

from sunbeam.clusterd.client import Client
from sunbeam.commands.terraform import TerraformInitStep
from sunbeam.jobs.juju import JujuHelper
from sunbeam.jobs.manifest import BaseStep
from sunbeam.jobs.steps import (
AddMachineUnitsStep,
DeployMachineApplicationStep,
RemoveMachineUnitStep,
)

from anvil.jobs.manifest import Manifest
from anvil.provider.local.deployment import LocalDeployment

APPLICATION = "maas-agent"
CONFIG_KEY = "TerraformVarsMaasagentPlan"
Expand Down Expand Up @@ -105,3 +110,21 @@ def __init__(

def get_unit_timeout(self) -> int:
return MAASAGENT_UNIT_TIMEOUT


def maas_agent_install_steps(
client: Client,
manifest: Manifest,
jhelper: JujuHelper,
deployment: LocalDeployment,
fqdn: str,
) -> List[BaseStep]:
return [
TerraformInitStep(manifest.get_tfhelper("maas-agent-plan")),
DeployMAASAgentApplicationStep(
client, manifest, jhelper, deployment.infrastructure_model
),
AddMAASAgentUnitsStep(
client, fqdn, jhelper, deployment.infrastructure_model
),
]
23 changes: 22 additions & 1 deletion anvil-python/anvil/commands/maas_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Any
from typing import Any, List

from sunbeam.clusterd.client import Client
from sunbeam.commands.terraform import TerraformInitStep
from sunbeam.jobs.juju import JujuHelper
from sunbeam.jobs.manifest import BaseStep
from sunbeam.jobs.steps import (
AddMachineUnitsStep,
DeployMachineApplicationStep,
RemoveMachineUnitStep,
)

from anvil.jobs.manifest import Manifest
from anvil.provider.local.deployment import LocalDeployment

APPLICATION = "maas-region"
CONFIG_KEY = "TerraformVarsMaasregionPlan"
Expand Down Expand Up @@ -115,3 +118,21 @@ def __init__(

def get_unit_timeout(self) -> int:
return MAASREGION_UNIT_TIMEOUT


def maas_region_install_steps(
client: Client,
manifest: Manifest,
jhelper: JujuHelper,
deployment: LocalDeployment,
fqdn: str,
) -> List[BaseStep]:
return [
TerraformInitStep(manifest.get_tfhelper("maas-region-plan")),
DeployMAASRegionApplicationStep(
client, manifest, jhelper, deployment.infrastructure_model
),
AddMAASRegionUnitsStep(
client, fqdn, jhelper, deployment.infrastructure_model
),
]
23 changes: 23 additions & 0 deletions anvil-python/anvil/commands/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import List

from sunbeam.clusterd.client import Client
from sunbeam.commands.terraform import TerraformInitStep
from sunbeam.jobs.juju import JujuHelper
from sunbeam.jobs.manifest import BaseStep
from sunbeam.jobs.steps import (
AddMachineUnitsStep,
DeployMachineApplicationStep,
RemoveMachineUnitStep,
)

from anvil.jobs.manifest import Manifest
from anvil.provider.local.deployment import LocalDeployment

APPLICATION = "postgresql"
CONFIG_KEY = "TerraformVarsPostgresqlPlan"
Expand Down Expand Up @@ -105,3 +110,21 @@ def __init__(

def get_unit_timeout(self) -> int:
return POSTGRESQL_UNIT_TIMEOUT


def postgresql_install_steps(
client: Client,
manifest: Manifest,
jhelper: JujuHelper,
deployment: LocalDeployment,
fqdn: str,
) -> List[BaseStep]:
return [
TerraformInitStep(manifest.get_tfhelper("postgresql-plan")),
DeployPostgreSQLApplicationStep(
client, manifest, jhelper, deployment.infrastructure_model
),
AddPostgreSQLUnitsStep(
client, fqdn, jhelper, deployment.infrastructure_model
),
]
Loading

0 comments on commit 81bb7a0

Please sign in to comment.