Skip to content

Commit

Permalink
merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam-D-Lewis committed May 6, 2024
1 parent d4f301d commit 8881d7c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 29 deletions.
18 changes: 10 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,23 @@ module = [
ignore_missing_imports = true

[tool.ruff]
extend-exclude = [
"src/_nebari/template",
"home",
"__pycache__"
]

[tool.ruff.lint]
select = [
"E",
"F",
"PTH",
"E", # E: pycodestyle rules
"F", # F: pyflakes rules
"PTH", # PTH: flake8-use-pathlib rules
]
ignore = [
"E501", # Line too long
"F821", # Undefined name
"PTH123", # open() should be replaced by Path.open()
]
extend-exclude = [
"src/_nebari/template",
"home",
"__pycache__"
]

[tool.coverage.run]
branch = true
Expand Down
27 changes: 7 additions & 20 deletions src/_nebari/stages/kubernetes_ingress/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from __future__ import annotations

import enum
import logging
import socket
import sys
import time
from typing import Any, Dict, List, Optional, Type, Union
from typing import Any, Dict, List, Literal, Optional, Type, Union

from pydantic import Field

Expand Down Expand Up @@ -116,35 +115,23 @@ def _attempt_dns_lookup(
sys.exit(1)


@schema.yaml_object(schema.yaml)
class CertificateEnum(str, enum.Enum):
letsencrypt = "lets-encrypt"
selfsigned = "self-signed"
existing = "existing"
disabled = "disabled"

@classmethod
def to_yaml(cls, representer, node):
return representer.represent_str(node.value)


class SelfSignedCertificate(schema.Base):
type: str = Field(..., const=CertificateEnum.selfsigned)
type: Literal["self-signed"] = Field("self-signed", validate_default=True)


class LetsEncryptCertificate(schema.Base):
type: str = CertificateEnum.letsencrypt
acme_email: str = None
type: Literal["lets-encrypt"] = Field("lets-encrypt", validate_default=True)
acme_email: str
acme_server: str = "https://acme-v02.api.letsencrypt.org/directory"


class ExistingCertificate(schema.Base):
type: str = CertificateEnum.existing
secret_name: str = None
type: Literal["existing"] = Field("existing", validate_default=True)
secret_name: str


class DisabledCertificate(schema.Base):
type: str = CertificateEnum.disabled
type: Literal["disabled"] = Field("disabled", validate_default=True)


Certificate = Union[
Expand Down
5 changes: 4 additions & 1 deletion src/nebari/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@

class Base(pydantic.BaseModel):
model_config = ConfigDict(
extra="forbid", validate_assignment=True, populate_by_name=True
extra="forbid",
validate_assignment=True,
populate_by_name=True,
validate_default=True,
)


Expand Down

0 comments on commit 8881d7c

Please sign in to comment.