[BUG] - ValidationError for `kube_context` when deploying on existing k8s
Describe the bug
A ValidationError occurs when initializing ExistingInputVars as part of the nebari deploy without passing an explicit value for kube_context. According to the schema validation rules, the validation expects a non-null string for this field when configuring the existing provider type. However, it seems that the default values is not being correctly accessed.
Expected behavior
Default value should be used instead, as originally suggested https://github.com/nebari-dev/nebari/blob/a26b8df19c31363082ca3104e4e7b2e9354b22ae/RELEASE.md?plain=1#L1137
OS and architecture in which you are running Nebari
Linux
How to Reproduce the problem?
- Set the provider to existing in the configuration.
- Do not provide a value for
kube_context - Attempt to deploy, for easier reproduction running
nebari renderwould trigger the validation as well
Command output
â 8 in input_vars â
â â
â 695 â â if self.config.provider == schema.ProviderEnum.local: â
â 696 â â â return LocalInputVars(kube_context=self.config.local.kube_context).dict() â
â 697 â â elif self.config.provider == schema.ProviderEnum.existing: â
â âą 698 â â â return ExistingInputVars( â
â 699 â â â â kube_context=self.config.existing.kube_context â
â 700 â â â ).dict() â
â 701 â â elif self.config.provider == schema.ProviderEnum.do: â
â â
â in pydantic.main.BaseModel.__init__:341 â
â°âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââŊ
ValidationError: 1 validation error for ExistingInputVars
kube_context
none is not an allowed value (type=type_error.none.not_allowed)
Versions and dependencies used.
2024.4.1rc1
Compute environment
None
Integrations
No response
Anything else?
No response
As an extra comment here, I think we should get the current default context from kubectl (we are doing this somewhere already), and apply as the default value. Though, I would also like to add a message to the user to validate such information when attempting to run deploy
$ nebari deploy -c ***
Do you approve deploying Nebari using the current kube_context configuration <value+from+yaml>? (Y/n)