Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【勘误-P38】PodTemplateSpec字段添加报错 #10

Open
Shuimo03 opened this issue Feb 14, 2023 · 8 comments
Open

【勘误-P38】PodTemplateSpec字段添加报错 #10

Shuimo03 opened this issue Feb 14, 2023 · 8 comments

Comments

@Shuimo03
Copy link

我的代码:

// CoffeeSpec defines the desired state of Coffee
type CoffeeSpec struct {
	// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
	// Important: Run "make" to regenerate code after modifying this file
	Replicas int32                  `json:"replicas,omitempty"`
	Template corev1.PodTemplateSpec `json:"template,omitempty"`
}

我的环境

  • Intel macos
  • golang 1.19
  • kubebuilder 3.9.0

错误

* spec.validation.openAPIV3Schema.properties[spec].properties[template].properties[spec].properties[volumes].items.properties[ephemeral].properties[volumeClaimTemplate].properties[spec].properties[resources].properties[claims].items.x-kubernetes-map-type: Invalid value: "null": must be atomic as item of a list with x-kubernetes-list-type=set
* spec.validation.openAPIV3Schema.properties[spec].properties[template].properties[spec].properties[ephemeralContainers].items.properties[resources].properties[claims].items.x-kubernetes-map-type: Invalid value: "null": must be atomic as item of a list with x-kubernetes-list-type=set
* spec.validation.openAPIV3Schema.properties[spec].properties[template].properties[spec].properties[containers].items.properties[resources].properties[claims].items.x-kubernetes-map-type: Invalid value: "null": must be atomic as item of a list with x-kubernetes-list-type=set
* spec.validation.openAPIV3Schema.properties[spec].properties[template].properties[spec].properties[initContainers].items.properties[resources].properties[claims].items.x-kubernetes-map-type: Invalid value: "null": must be atomic as item of a list with x-kubernetes-list-type=set
make: *** [install] Error 1
```
@Sucran
Copy link

Sucran commented Feb 19, 2023

同样遇到这个问题

@Sucran
Copy link

Sucran commented Mar 3, 2023

我是这样解决的 go.mod文件 k8s.io/api v0.26.0 改成 k8s.io/api v0.26.1 然后修改Makefile 里的ENVTEST_K8S_VERSION = 1.26.0 改成 ENVTEST_K8S_VERSION = 1.25.0 就能正常make install 了
机器是MacBookpro14'(2021) M1 chip,使用插件--plugins=go/v4-alpha

kubectl version --short :

Client Version: v1.25.0
Kustomize Version: v4.5.7
Server Version: v1.25.0

@Sucran
Copy link

Sucran commented Mar 3, 2023

@Shuimo03 可以参考一下我的解决方案

@Shuimo03
Copy link
Author

Shuimo03 commented Mar 3, 2023

@Sucran 好咧,多谢大佬,最近没看了,到时候试试看

@kcxg
Copy link

kcxg commented Apr 4, 2023

kubebuilder 版本用的3.8 可以,现在v3.9.0版本和kubernetes 1.25.0版本结合有报错

@kcxg
Copy link

kcxg commented Apr 4, 2023

解决方法2,修改go.mod,加入replace k8s.io/api v0.26.0 => k8s.io/api v0.25.0定义,然后执行go mod tidy

@vavikast
Copy link

vavikast commented Apr 13, 2023

参考https://github.com/kubernetes-sigs/kubebuilder/issues/3303.升级k8s.io/api即可 。 目前发现升级太高会引起其他问题,暂时升级为go get k8s.io/[email protected] ,go mod tidy.

@MajLuu
Copy link

MajLuu commented May 14, 2023

kubernetes-sigs/kubebuilder#3303 (comment)

升级版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants