Skip to content

controller-tools creates schema with '$ref' which is not supported in k8s #324

@aanm

Description

@aanm
type Bar struct{
	A string `json:"a"`
}

// Foo is a Bar
type Foo Bar

type CronJobSpec struct {
	Foo Foo `json:"foo"`
}
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  creationTimestamp: null
  name: cronjobs.batch.tutorial.kubebuilder.io
spec:
  group: batch.tutorial.kubebuilder.io
  names:
    kind: CronJob
    listKind: CronJobList
    plural: cronjobs
    singular: cronjob
  scope: ""
  subresources:
    status: {}
  validation:
    openAPIV3Schema:
      description: CronJob is the Schema for the cronjobs API
      properties:
        apiVersion:
          description: 'APIVersion defines the versioned schema of this representation
            of an object. Servers should convert recognized schemas to the latest
            internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
          type: string
        kind:
          description: 'Kind is a string value representing the REST resource this
            object represents. Servers may infer this from the endpoint the client
            submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
          type: string
        metadata:
          type: object
        spec:
          description: CronJobSpec defines the desired state of CronJob CronJobSpec
            defines the desired state of CronJob
          properties:
            foo:
              $ref: '#/definitions/Bar'
              description: Foo is a Bar
          required:
          - foo
          type: object
      type: object
  version: v1
  versions:
  - name: v1
    served: true
    storage: true
status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: []
  storedVersions: []

kubectl apply returns a $ref: Forbidden: $ref is not supported

/kind bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions