INNER CODE UNIT · Go
removeUselessRequiredForTiBRGC
pingcap/tidb-operator · cmd/crd-modifier/main.go:121
func removeUselessRequiredForTiBRGC(crd *apiextensionsv1.CustomResourceDefinition) {
for i := range crd.Spec.Versions {
v := &crd.Spec.Versions[i]
schema := v.Schema.OpenAPIV3Schema
// Navigate to spec.overlay.pods
if checkPathExists(schema, "spec", "overlay", "pods") {
// Get the pods array schema
spec := schema.Properties["spec"]
overlay := spec.Properties["overlay"]
pods := overlay.Properties["pods"]
// For array items, we need to check the items schema
if pods.Items != nil && pods.Items.Schema != nil {
itemSchema := pods.Items.Schema
// Check if the item has an overlay property
if overlayProp, ok := itemSchema.Properties["overlay"]; ok {
// Process the overlay.pod path