gavinbunney / terraform-provider-kubectl

Terraform provider to handle raw kubernetes manifest yaml files
https://registry.terraform.io/providers/gavinbunney/kubectl
Mozilla Public License 2.0
609 stars 102 forks source link

terraform provider does not work on clusters which has open api v3 ( k8s-1.27 ) #281

Closed bseenu closed 9 months ago

bseenu commented 9 months ago

https://kubernetes.io/blog/2023/04/24/openapi-v3-field-validation-ga/

The provider currently built with the k8s-client version - 1.21 , ref: https://github.com/gavinbunney/terraform-provider-kubectl/blob/master/go.mod#L22, it needs to be built with new client library which can handle this properly

Currently the version is being repeated in the api call , ref: /apis/cert-manager.io/v1/v1/namespaces/default/certificates/test-cert

bash-5.2$ kubectl version|head -1
Client Version: v1.28.4
bash-5.2$ kubectl explain cert.spec|head -3
GROUP:      cert-manager.io
KIND:       Certificate
VERSION:    v1
bash-5.2$ ./kubectl version|head -1
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.6", GitCommit:"d921bc6d1810da51177fbd0ed61dc811c5228097", GitTreeState:"clean", BuildDate:"2021-10-27T17:50:34Z", GoVersion:"go1.16.9", Compiler:"gc", Platform:"darwin/amd64"}
WARNING: version difference between client (1.21) and server (1.27) exceeds the supported minor version skew of +/-1
bash-5.2$ ./kubectl explain cert.spec|head -3
KIND:     Certificate
VERSION:  cert-manager.io/v1
bseenu commented 9 months ago

Just saw that this is already being discussed in other issue - https://github.com/gavinbunney/terraform-provider-kubectl/issues/270

Closing this one