kubeshop / testkube

☸️ Kubernetes-native testing framework for test execution and orchestration
https://testkube.io
Other
1.36k stars 132 forks source link

Research - Openapi Schemas sync between teskube.yaml api spec and operators #446

Open exu opened 3 years ago

exu commented 3 years ago

Describe the enhancement you'd like to see Currently spec between operator and testkube api spec is sync manually Maybe there is some nice way to load parts of testkube spec into operator (or operator into testkube)

Additional context

Example executor spec in for operator CRDs


---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.4.1
  creationTimestamp: null
  name: executors.executor.testkube.io
spec:
  group: executor.testkube.io
  names:
    kind: Executor
    listKind: ExecutorList
    plural: executors
    singular: executor
  scope: Namespaced
  versions:
  - name: v1
    schema:
      openAPIV3Schema:
        description: Executor is the Schema for the executors 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: ExecutorSpec defines the desired state of Executor
            properties:
              executor_type:
                description: ExecutorType one of "rest" for rest openapi based executors
                  or "job" which will be default runners for testkube soon
                type: string
              image:
                description: Image for kube-job
                type: string
              types:
                description: Types defines what types can be handled by executor e.g.
                  "postman/collection", ":curl/command" etc
                items:
                  type: string
                type: array
              uri:
                description: URI for rest based executors
                type: string
              volume_mount_path:
                description: VolumeMountPath - where should PV be monted inside job
                  pod for e.g. artifacts
                type: string
              volume_quantity:
                description: VolumeQuantity for kube-job PersistentVolume
                type: string
            required:
            - types
            type: object
          status:
            description: ExecutorStatus defines the observed state of Executor
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
status:
  acceptedNames:
    kind: ""
    plural: ""
  conditions: []
  storedVersions: []

part of this need to be passed into testkube openapi spec and then we need to sync all changes through both specs

TheBrunoLopes commented 2 years ago

is this still an issue @exu ?

aabedraba commented 1 year ago

@vsukhin do you know if this is already covered?