Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forces HELM to use auto settings as output_type #1278

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ parameters:
compile:
- output_path: .
input_type: helm
output_type: yaml # this tests that helm switches to auto output type
input_paths:
- charts/nginx-ingress
helm_values:
Expand Down
2 changes: 1 addition & 1 deletion kapitan/inputs/helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from kapitan.errors import HelmTemplateError
from kapitan.helm_cli import helm_cli
from kapitan.inputs.base import CompiledFile, InputType
from kapitan.inputs.base import InputType
from kapitan.inputs.kadet import BaseModel, BaseObj
from kapitan.inventory.model.input_types import KapitanInputTypeHelmConfig

Expand Down
12 changes: 11 additions & 1 deletion kapitan/inventory/model/input_types.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import logging
from typing import Annotated, List, Literal, Optional, Union

from pydantic import BaseModel, ConfigDict, Field
from pydantic import BaseModel, ConfigDict, Field, field_validator

from kapitan.utils import StrEnum

logger = logging.getLogger(__name__)


class InputTypes(StrEnum):
JSONNET = "jsonnet"
Expand Down Expand Up @@ -72,6 +75,13 @@ class KapitanInputTypeHelmConfig(KapitanInputTypeBaseConfig):
helm_path: Optional[str] = None
kube_version: Optional[str] = None

@field_validator("output_type")
@classmethod
def type_must_be_auto(cls, _: OutputType) -> OutputType:
"""Helm output type must be auto."""
logger.debug("field `output_type` for helm input type must be set to 'auto': enforcing.")
return OutputType.AUTO


class KapitanInputTypeKadetConfig(KapitanInputTypeBaseConfig):
input_type: Literal[InputTypes.KADET] = InputTypes.KADET
Expand Down
Loading