kubernetes-sigs / cluster-api-provider-vsphere

Apache License 2.0
373 stars 294 forks source link

Env vs config file error when I tried to follow the ignition docs #3245

Closed ksemele closed 1 month ago

ksemele commented 1 month ago

/kind bug

I followed this manual for simple test vSphere cluster.

So I skipped Set required environment variables: part because of I have an existing config file here: ~/.cluster-api/clusterctl.yaml

I added 2 extra envs to my env and checked that they are exist:

env | grep EXP_
EXP_CLUSTER_RESOURCE_SET=true
EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION=true

When I tried to apply a cluster.yaml file I got an validation error:

kubectl apply -f cluster.yaml
cluster.cluster.x-k8s.io/my-cluster created
vspherecluster.infrastructure.cluster.x-k8s.io/my-cluster created
vspheremachinetemplate.infrastructure.cluster.x-k8s.io/my-cluster created
machinedeployment.cluster.x-k8s.io/my-cluster-md-0 created
clusterresourceset.addons.cluster.x-k8s.io/my-cluster-crs-0 created
secret/my-cluster created
secret/vsphere-config-secret created
configmap/csi-manifests created
secret/cloud-provider-vsphere-credentials created
configmap/cpi-manifests created
Error from server (Invalid): error when creating "cluster.yaml": admission webhook "validation.kubeadmcontrolplane.controlplane.cluster.x-k8s.io" denied the request: KubeadmControlPlane.cluster.x-k8s.io "my-cluster" is invalid: [spec.kubeadmConfigSpec.format: Forbidden: can be set only if the KubeadmBootstrapFormatIgnition feature gate is enabled, spec.kubeadmConfigSpec.ignition: Forbidden: can be set only if the KubeadmBootstrapFormatIgnition feature gate is enabled]
Error from server (Invalid): error when creating "cluster.yaml": admission webhook "validation.kubeadmconfigtemplate.bootstrap.cluster.x-k8s.io" denied the request: KubeadmConfigTemplate.bootstrap.cluster.x-k8s.io "my-cluster-md-0" is invalid: [spec.template.spec.format: Forbidden: can be set only if the KubeadmBootstrapFormatIgnition feature gate is enabled, spec.template.spec.ignition: Forbidden: can be set only if the KubeadmBootstrapFormatIgnition feature gate is enabled]

What did you expect to happen: Cluster is created.

Anything else you would like to add: I think there are some errors with envs vs configfile... Because when I added EXP_KUBEADM_BOOTSTRAP_FORMAT_IGNITION: true to my existing ~/.cluster-api/clusterctl.yaml This error is gone.

Environment:

neolit123 commented 1 month ago

please open this ticket in the main cluster-api repository.

i think you should be using either the config or the env vars, but not the mixture. for the mixture to work i think clusterctl needs to merge the env values on top of a config that is either provided by the user or blank/defaulted.

/close

k8s-ci-robot commented 1 month ago

@neolit123: Closing this issue.

In response to [this](https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/issues/3245#issuecomment-2449927950): >please open this ticket in the main cluster-api repository. > >i think you should be using either the config or the env vars, but not the mixture. >for the mixture to work i think clusterctl needs to merge the env values on top of a config that is either provided by the user or blank/defaulted. > >/close > Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.