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

Running controller-tools over k8s.io/api/core/v1.PodSpec fails #696

Closed
dprotaso opened this issue Jun 28, 2022 · 5 comments
Closed

Running controller-tools over k8s.io/api/core/v1.PodSpec fails #696

dprotaso opened this issue Jun 28, 2022 · 5 comments

Comments

@dprotaso
Copy link
Contributor

Here the marker mapType is on a map[string]string
https://github.com/kubernetes/api/blob/b98f264fe39f5b5393bf918d8c16f86527965f1c/core/v1/types.go#L3129-L3132

Running controller-tools over this field results in a warning/error

k8s.io/api/core/v1/types.go:3129:2: must apply mapType to an object
@dprotaso
Copy link
Contributor Author

I was testing this against master@529c857f74b225412836567200cd0ae003fbb3b3

And it still reproduces when I rebased with #692 - so master@6bfa604a52c3515580a919f6265e23f37b2d5632

@alvaroaleman alvaroaleman changed the title Running controller-tools over k8s.io/api/core/v1 fails Running controller-tools over k8s.io/api/core/v1.PodSpec fails Jun 28, 2022
@dprotaso
Copy link
Contributor Author

dprotaso commented Jun 28, 2022

Full error - ran against k8s api version v0.23.5

[some-local-path]/k8s.io/api/core/v1/types.go:3129:2: must apply mapType to an object
[some-local-path]/k8s.io/api/core/v1/types.go:3273:2: must apply listType to an array, found
[some-local-path]/k8s.io/api/core/v1/types.go:3273:2: must apply listMapKey to an array, found
[some-local-path]/k8s.io/api/core/v1/types.go:3273:2: must apply listMapKey to an array, found
Error: not all generators ran successfully

Process exits with exit code 1

@dprotaso
Copy link
Contributor Author

Here are the fields with the markers

must apply mapType to an object

	// NodeSelector is a selector which must be true for the pod to fit on a node.
	// Selector which must match a node's labels for the pod to be scheduled on that node.
	// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
	// +optional
	// +mapType=atomic
	NodeSelector map[string]string `json:"nodeSelector,omitempty" protobuf:"bytes,7,rep,name=nodeSelector"`

must apply listType to an array, found
must apply listMapKey to an array, found
must apply listMapKey to an array, found

	// TopologySpreadConstraints describes how a group of pods ought to spread across topology
	// domains. Scheduler will schedule pods in a way which abides by the constraints.
	// All topologySpreadConstraints are ANDed.
	// +optional
	// +patchMergeKey=topologyKey
	// +patchStrategy=merge
	// +listType=map
	// +listMapKey=topologyKey
	// +listMapKey=whenUnsatisfiable
	TopologySpreadConstraints []TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty" patchStrategy:"merge" patchMergeKey:"topologyKey" protobuf:"bytes,33,opt,name=topologySpreadConstraints"`

@dprotaso
Copy link
Contributor Author

Note - this is the schema patcher

@dprotaso
Copy link
Contributor Author

false - alarm - it's my changes

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

1 participant