Skip to content

generated CRD is not in canonical format and contains unnecessary fields #31

@cbf123

Description

@cbf123

Following the example in the README for generating CRDs gives:

metadata:
  finalizers: []
  labels: {}
  name: featureflags.my-beautiful-saas.com
  ownerReferences: []
spec:
  group: my-beautiful-saas.com
  names:
    kind: FeatureFlag
    plural: featureflags
    shortNames:
    - ff
  scope: Namespaced
  versions:
  - name: v1alpha1
    served: true
    storage: true
    additionalPrinterColumns:
    - jsonPath: .spec.canary_ingress
      name: Ingress
      type: string
    schema:
      openAPIV3Schema:
        properties:
          apiVersion:
            type: string
            x-kubernetes-list-map-keys: []
            x-kubernetes-validations: []
          kind:
            type: string
            x-kubernetes-list-map-keys: []
            x-kubernetes-validations: []
          spec:
            properties:
              enabled:
                default: false
                type: boolean
                x-kubernetes-list-map-keys: []
                x-kubernetes-validations: []
              rollout_percent:
                default: 0
                maximum: 100
                minimum: 0
                type: integer
                x-kubernetes-list-map-keys: []
                x-kubernetes-validations: []
              canary_ingress:
                type: string
                x-kubernetes-list-map-keys: []
                x-kubernetes-validations: []
            required:
            - enabled
            - rollout_percent
            - canary_ingress
            type: object
            x-kubernetes-list-map-keys: []
            x-kubernetes-validations: []
        type: object
        x-kubernetes-list-map-keys: []
        x-kubernetes-validations: []
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition

It seems pretty clear that all those x-kubernetes-list-map-keys and x-kubernetes-validations fields aren't needed. And I think the "apiVersion" and "kind" fields don't need to be explicitly specified as part of openAPIV3Schema.properties so maybe they should be filtered out?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions