Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mateoflorido committed Mar 21, 2024
1 parent e2591c8 commit 80a146c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 57 deletions.
55 changes: 0 additions & 55 deletions charms/worker/k8s/lib/charms/k8s/v0/k8sd_api_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,61 +48,6 @@ class utilises different connection factories (UnixSocketConnectionFactory
logger = logging.getLogger(__name__)


class CreateClusterRequest(BaseModel):
"""Request model for creating a new Canonical Kubernetes cluster.
Attributes:
bootstrap (bool): Flag to enable or disable the bootstrap process for
the cluster. Defaults to True.
name (str): The name of the cluster to be created.
address (str): The address where the cluster is hosted.
config (Dict[str, str]): A dictionary of additional configuration
parameters for the cluster.
"""

bootstrap: bool = True
name: str
address: str
config: Dict[str, str]


class BootstrapConfig(BaseModel):
"""Configuration model for bootstrapping a Canonical K8s cluster.
Attributes:
components (List[str]): A list of default components to be installed
during the bootstrap process. Defaults to ["dns", "metrics-server",
"network"].
cluster_cidr (str): The IP address range for the cluster's pods. Defaults
to "10.1.0.0/16".
service_cidr (str): The IP address range for the cluster services. Defaults
to "10.152.183.0/24".
rbac (bool): Flag to enable or disable role-based access control
(RBAC). Defaults to True.
k8s_dqlite_port (int): The port used by Dqlite. Defaults to 9000.
datastore (str): The type of datastore used by the cluster.
Defaults to "k8s-dqlite".
datastore_url (str): The URL of the datastore. Optional; defaults to None.
datastore_ca_cert (str): The CA certificate for the datastore.
Optional; defaults to None.
datastore_client_cert (str): The client certificate for accessing the
datastore. Optional; defaults to None.
datastore_client_key (str): The client key for accessing the datastore.
Optional; defaults to None.
"""

components: List[str] = ["dns", "metrics-server", "network"]
cluster_cidr: str = Field("10.1.0.0/16", alias="cluster-cidr")
service_cidr: str = Field("10.152.183.0/24", alias="service-cidr")
rbac: bool = Field(True, alias="enable-rbac")
k8s_dqlite_port: int = Field(9000, alias="k8s-dqlite-port")
datastore: str = "k8s-dqlite"
datastore_url: str = Field(None, alias="datastore-url")
datastore_ca_cert: str = Field(None, alias="datastore-ca-crt")
datastore_client_cert: str = Field(None, alias="datastore-client-crt")
datastore_client_key: str = Field(None, alias="datastore-client-key")


class K8sdAPIManagerError(Exception):
"""Base exception for K8sd API Manager errors."""

Expand Down
4 changes: 2 additions & 2 deletions charms/worker/k8s/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ def _configure_datastore(self, config: BootstrapConfig):
log.info("Using etcd as external datastore")
etcd_relation = self.model.get_relation("etcd")

assert etcd_relation, "Missing etcd relation"
assert self.etcd.is_ready, "etcd is not ready"
assert etcd_relation, "Missing etcd relation" # nosec
assert self.etcd.is_ready, "etcd is not ready" # nosec

config.datastore = "external"
etcd_config = self.etcd.get_client_credentials()
Expand Down

0 comments on commit 80a146c

Please sign in to comment.