Skip to content

Commit

Permalink
Merge branch 'main' into charm-upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
skatsaounis authored Aug 22, 2024
2 parents 19f2694 + ddbdf98 commit d8073a9
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 8 deletions.
68 changes: 68 additions & 0 deletions anvil-python/anvil/commands/clusterd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Copyright (c) 2024 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import logging
from typing import List

from sunbeam.clusterd.client import Client

LOG = logging.getLogger(__name__)

from sunbeam.commands.clusterd import (
ClusterInitStep as SunbeamClusterInitStep,
ClusterJoinNodeStep as SunbeamClusterJoinNodeStep,
ClusterListNodeStep as SunbeamClusterListNodeStep,
ClusterRemoveNodeStep as SunbeamClusterRemoveNodeStep,
)


class ClusterInitStep(SunbeamClusterInitStep):
"""Bootstrap clustering on Anvil clusterd."""

def __init__(self, client: Client, role: List[str], machineid: int):
super().__init__(client=client, role=role, machineid=machineid)

self.name = "Bootstrap Cluster"
self.description = "Bootstrapping Anvil cluster"


class ClusterJoinNodeStep(SunbeamClusterJoinNodeStep):
"""Join node to the Anvil cluster."""

def __init__(self, client: Client, token: str, role: List[str]):
super().__init__(client=client, token=token, role=role)

self.name = "Join node to Cluster"
self.description = "Adding node to Anvil cluster"


class ClusterListNodeStep(SunbeamClusterListNodeStep):
"""List nodes in the Anvil cluster."""

def __init__(self, client: Client):
super().__init__(client=client)

self.name = "List nodes of Cluster"
self.description = "Listing nodes in Anvil cluster"


class ClusterRemoveNodeStep(SunbeamClusterRemoveNodeStep):
"""Remove node from the Anvil cluster."""

def __init__(self, client: Client, name: str):
super().__init__(client=client, name=name)

self.name = "Remove node from Cluster"
self.description = "Removing node from Anvil cluster"
12 changes: 6 additions & 6 deletions anvil-python/anvil/provider/local/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,9 @@
from rich.table import Table
from snaphelpers import Snap
from sunbeam import utils

# from sunbeam.commands import refresh as refresh_cmds
from sunbeam.commands.clusterd import (
ClusterAddJujuUserStep,
ClusterAddNodeStep,
ClusterInitStep,
ClusterJoinNodeStep,
ClusterListNodeStep,
ClusterRemoveNodeStep,
ClusterUpdateJujuControllerStep,
ClusterUpdateNodeStep,
)
Expand Down Expand Up @@ -69,6 +63,12 @@
from sunbeam.provider.local.deployment import LOCAL_TYPE
import yaml

from anvil.commands.clusterd import (
ClusterInitStep,
ClusterJoinNodeStep,
ClusterListNodeStep,
ClusterRemoveNodeStep,
)
from anvil.commands.haproxy import (
RemoveHAProxyUnitStep,
haproxy_install_steps,
Expand Down
4 changes: 2 additions & 2 deletions anvil-python/anvil/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

MAAS_REGION_CHANNEL = "latest/edge"
MAAS_AGENT_CHANNEL = "latest/edge"
MAAS_REGION_CHANNEL = "3.4/edge"
MAAS_AGENT_CHANNEL = "3.4/edge"
POSTGRESQL_CHANNEL = "14/stable"
PGBOUNCER_CHANNEL = "1/stable"
HAPROXY_CHANNEL = "latest/stable"
Expand Down

0 comments on commit d8073a9

Please sign in to comment.