1

I am implementing a Kubernetes controller and am creating an API using a struct that looks like:

import (
    corev1 "k8s.io/api/core/v1"
)

type MySpec struct {
    corev1.PodSpec `json:",inline"`
}

However, since the Containers field in PodSpec is required, when generating a corresponding CRD using controller-gen the containers field is being marked as required - however I want it to be optional in my CRD.

Is there any way to override this without copying out the whole structure or patching the output of controller-gen?

For reference the whole project is here.

dippynark
  • 2,743
  • 20
  • 58

0 Answers0