loft-sh / vcluster

vCluster - Create fully functional virtual Kubernetes clusters - Each vcluster runs inside a namespace of the underlying k8s cluster. It's cheaper than creating separate full-blown clusters and it offers better multi-tenancy and isolation than regular namespaces.
https://www.vcluster.com
Apache License 2.0
6.92k stars 426 forks source link

sync.toHost.pods.enforceTolerations.0: Invalid type. Expected: string, given: object #2199

Closed wutz closed 1 month ago

wutz commented 1 month ago

Create a new vcluster by https://vcluster.com/docs/vcluster/configure/vcluster-yaml/sync/to-host/core/pods#automatically-apply-tolerations-to-all-pods-synced-by-vcluster

but got

Error: values don't meet the specifications of the schema(s) in the following chart(s):
vcluster:
- sync.toHost.pods.enforceTolerations.0: Invalid type. Expected: string, given: object

It should be a problem with the type definition.

https://github.com/loft-sh/vcluster/blob/58005894621ecb17166c38f5f8f913678e9408cc/chart/values.schema.json#L2743-L2749

wutz commented 1 month ago

According to the code description https://github.com/loft-sh/vcluster/blob/v0.20.1/pkg/util/toleration/toleration.go#L11, the document description should be incorrect.

The correct way to use it is:


sync:
  toHost:
    pods:
      enabled: true
      enforceTolerations:
        - "example-key=example-value:NoSchedule"
        - "another-key:PreferNoSchedule"
lucasfcnunes commented 1 month ago

I was having this problem. Yes. The docs are misleading.

image

My case is for any effect so:

sync:
  toHost:
    pods:
      enabled: true
      enforceTolerations:
        - "example-key=example-value"
lucasfcnunes commented 1 month ago

@wutz I created a PR to make it explicit https://github.com/loft-sh/vcluster-docs/pull/293, please take a look.

I not sure if the case when the operation is Exists (any value) works as another-key:PreferNoSchedule. Do you think it works?

References

wutz commented 1 month ago

It will work; I have tested the configuration nvidia.com/gpu:NoSchedule in the environment and it works fine.