Skip to content

Commit

Permalink
Forces HELM to use auto settings as output_type (#1278)
Browse files Browse the repository at this point in the history
Fixes #

## Proposed Changes

* Forces the helm input_type to autodetect extension

## Docs and Tests

* [ ] Tests added
* [ ] Updated documentation
  • Loading branch information
ademariag authored Dec 18, 2024
1 parent 5096cac commit 752ce9f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
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

0 comments on commit 752ce9f

Please sign in to comment.