Skip to content

[Bug]: Can't configure kubeconfig via data #3185

@peterschmidt85

Description

@peterschmidt85

Steps to reproduce

  1. Configure kubernetes backend using data instead of filename

Example:

projects:
  - name: main
    backends:
      - type: kubernetes
        kubeconfig:
          data: |
            apiVersion: v1
            clusters:
            - cluster:
                certificate-authority-data: REDACTED
                server: https://1cf67631-d39b-41e8-b294-12c3a06c0eb8.k8s.ondigitalocean.com
              name: do-atl1-k8s-1-33-1-do-4-atl1-1760108754653
            contexts:
            - context:
                cluster: do-atl1-k8s-1-33-1-do-4-atl1-1760108754653
                user: do-atl1-k8s-1-33-1-do-4-atl1-1760108754653-admin
              name: do-atl1-k8s-1-33-1-do-4-atl1-1760108754653
            current-context: do-atl1-k8s-1-33-1-do-4-atl1-1760108754653
            kind: Config
            preferences: {}
            users:
            - name: do-atl1-k8s-1-33-1-do-4-atl1-1760108754653-admin
              user:
                token: dop_v1_fcb1fd61c3a1abdf4d3194f663b3398cf5023348295deb1461eaab4a44253664
  1. dstack server

Actual behaviour

  File "/Users/cheptsov/.local/share/uv/tools/dstack/lib/python3.13/site-packages/dstack/_internal/server/app.py", line 117, in lifespan
    server_config_loaded = server_config_manager.load_config()
  File "/Users/cheptsov/.local/share/uv/tools/dstack/lib/python3.13/site-packages/dstack/_internal/server/services/config.py", line 87, in load_config
    self.config = self._load_config()
                  ~~~~~~~~~~~~~~~~~^^
  File "/Users/cheptsov/.local/share/uv/tools/dstack/lib/python3.13/site-packages/dstack/_internal/server/services/config.py", line 212, in _load_config
    return ServerConfig.parse_obj(config_dict)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "pydantic/main.py", line 532, in pydantic.main.BaseModel.parse_obj
  File "pydantic/main.py", line 347, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 2 validation errors for ServerConfigRequest
projects -> 0 -> backends -> 1 -> KubernetesBackendFileConfigWithCredsRequest -> proxy_jump -> phostname
  extra fields not permitted (type=value_error.extra)
projects -> 0 -> backends -> 1 -> KubernetesBackendFileConfigWithCredsRequest -> kubeconfig -> filename
  field required (type=value_error.missing)

Expected behaviour

No response

dstack version

0.19.32

Server logs

Additional information

It seems the Pydantic model always requires kubeconfig:

filename: Annotated[str, Field(description="The path to the kubeconfig file")]

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmajor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions