Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stage the place for openapi sports for new versions of the IMC #2588

Closed
wants to merge 2 commits into from

Conversation

matzew
Copy link
Member

@matzew matzew commented Feb 17, 2020

Proposed Changes

  • Use versioned OpenAPI for CRDs in eventing for resources that are being promoted.

like #2554 did for "core" APIs

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 17, 2020
@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Feb 17, 2020
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 17, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: matzew

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 17, 2020
replyURI:
type: string
minLength: 1
deliveryURI:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so... deliveryURI seems not used ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it's called delivery now

@matzew
Copy link
Member Author

matzew commented Feb 17, 2020

/cc @dprotaso

@matzew
Copy link
Member Author

matzew commented Feb 17, 2020

/test pull-knative-eventing-integration-tests

@matzew
Copy link
Member Author

matzew commented Feb 17, 2020

/retest

1 similar comment
@matzew
Copy link
Member Author

matzew commented Feb 18, 2020

/retest

@matzew matzew changed the title WIP: stage the place for openapi sports for new versions of the IMC Stage the place for openapi sports for new versions of the IMC Feb 18, 2020
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 18, 2020
@n3wscott
Copy link
Contributor

if you install this, does the CRD report back a happy status?

@matzew matzew changed the title Stage the place for openapi sports for new versions of the IMC WIP: Stage the place for openapi sports for new versions of the IMC Feb 18, 2020
@knative-prow-robot knative-prow-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 18, 2020
@matzew
Copy link
Member Author

matzew commented Feb 18, 2020

marking as WIP, since I noticed a glitch here ...

@matzew
Copy link
Member Author

matzew commented Feb 18, 2020

@lionelvillard I did a change on the delivery (was deliveryURI before)

I think... according to this we are structural

and getting the yaml is giving me:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"apiextensions.k8s.io/v1beta1","kind":"CustomResourceDefinition","metadata":{"annotations":{},"labels":{"duck.knative.dev/addressable":"true","eventing.knative.dev/release":"devel","knative.dev/crd-install":"true","messaging.knative.dev/subscribable":"true"},"name":"inmemorychannels.messaging.knative.dev"},"spec":{"additionalPrinterColumns":[{"JSONPath":".status.conditions[?(@.type==\"Ready\")].status","name":"Ready","type":"string"},{"JSONPath":".status.conditions[?(@.type==\"Ready\")].reason","name":"Reason","type":"string"},{"JSONPath":".status.address.url","name":"URL","type":"string"},{"JSONPath":".metadata.creationTimestamp","name":"Age","type":"date"}],"group":"messaging.knative.dev","names":{"categories":["all","knative","messaging","channel"],"kind":"InMemoryChannel","plural":"inmemorychannels","shortNames":["imc"],"singular":"inmemorychannel"},"scope":"Namespaced","subresources":{"status":{}},"versions":[{"name":"v1alpha1","schema":{"openAPIV3Schema":{"properties":{"spec":{"properties":{"subscribable":{"properties":{"subscribers":{"description":"Events received on the channel are forwarded to its subscribers.","items":{"properties":{"delivery":{"description":"Channel delivery options. More information: https://knative.dev/docs/eventing/event-delivery.","type":"object"},"ref":{"description":"a reference to a Kubernetes object from which to retrieve the target URI.","properties":{"apiVersion":{"type":"string"},"kind":{"type":"string"},"name":{"minLength":1,"type":"string"},"namespace":{"minLength":1,"type":"string"},"uid":{"minLength":1,"type":"string"}},"required":["namespace","name","uid"],"type":"object"},"replyURI":{"description":"Endpoint for the reply.","minLength":1,"type":"string"},"subscriberURI":{"description":"Endpoint for the subscriber.","minLength":1,"type":"string"},"uid":{"description":"Used to understand the origin of the subscriber.","minLength":1,"type":"string"}},"required":["uid"],"type":"object"},"type":"array"}},"type":"object"}},"type":"object"}},"type":"object"}},"served":true,"storage":true},{"name":"v1beta1","served":false,"storage":false}]}}
  creationTimestamp: "2020-02-18T16:29:20Z"
  generation: 1
  labels:
    duck.knative.dev/addressable: "true"
    eventing.knative.dev/release: devel
    knative.dev/crd-install: "true"
    messaging.knative.dev/subscribable: "true"
  name: inmemorychannels.messaging.knative.dev
  resourceVersion: "14499"
  selfLink: /apis/apiextensions.k8s.io/v1/customresourcedefinitions/inmemorychannels.messaging.knative.dev
  uid: 3f34cc43-d598-40e2-9ef7-9baaf2b16456
spec:
  conversion:
    strategy: None
  group: messaging.knative.dev
  names:
    categories:
    - all
    - knative
    - messaging
    - channel
    kind: InMemoryChannel
    listKind: InMemoryChannelList
    plural: inmemorychannels
    shortNames:
    - imc
    singular: inmemorychannel
  preserveUnknownFields: true
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - jsonPath: .status.conditions[?(@.type=="Ready")].status
      name: Ready
      type: string
    - jsonPath: .status.conditions[?(@.type=="Ready")].reason
      name: Reason
      type: string
    - jsonPath: .status.address.url
      name: URL
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1alpha1
    schema:
      openAPIV3Schema:
        properties:
          spec:
            properties:
              subscribable:
                properties:
                  subscribers:
                    description: Events received on the channel are forwarded to its
                      subscribers.
                    items:
                      properties:
                        delivery:
                          description: 'Channel delivery options. More information:
                            https://knative.dev/docs/eventing/event-delivery.'
                          type: object
                        ref:
                          description: a reference to a Kubernetes object from which
                            to retrieve the target URI.
                          properties:
                            apiVersion:
                              type: string
                            kind:
                              type: string
                            name:
                              minLength: 1
                              type: string
                            namespace:
                              minLength: 1
                              type: string
                            uid:
                              minLength: 1
                              type: string
                          required:
                          - namespace
                          - name
                          - uid
                          type: object
                        replyURI:
                          description: Endpoint for the reply.
                          minLength: 1
                          type: string
                        subscriberURI:
                          description: Endpoint for the subscriber.
                          minLength: 1
                          type: string
                        uid:
                          description: Used to understand the origin of the subscriber.
                          minLength: 1
                          type: string
                      required:
                      - uid
                      type: object
                    type: array
                type: object
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
  - additionalPrinterColumns:
    - jsonPath: .status.conditions[?(@.type=="Ready")].status
      name: Ready
      type: string
    - jsonPath: .status.conditions[?(@.type=="Ready")].reason
      name: Reason
      type: string
    - jsonPath: .status.address.url
      name: URL
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta1
    served: false
    storage: false
    subresources:
      status: {}
status:
  acceptedNames:
    categories:
    - all
    - knative
    - messaging
    - channel
    kind: InMemoryChannel
    listKind: InMemoryChannelList
    plural: inmemorychannels
    shortNames:
    - imc
    singular: inmemorychannel
  conditions:
  - lastTransitionTime: "2020-02-18T16:29:20Z"
    message: no conflicts found
    reason: NoConflicts
    status: "True"
    type: NamesAccepted
  - lastTransitionTime: "2020-02-18T16:29:20Z"
    message: the initial names have been accepted
    reason: InitialNamesAccepted
    status: "True"
    type: Established
  storedVersions:
  - v1alpha1

@matzew matzew changed the title WIP: Stage the place for openapi sports for new versions of the IMC Stage the place for openapi sports for new versions of the IMC Feb 18, 2020
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 18, 2020
Copy link
Contributor

@slinkydeveloper slinkydeveloper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nits for the validation

type: string
description: "Used to understand the origin of the subscriber."
minLength: 1
subscriberURI:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both this and the one below should use the format uri or uri-ref

- name
- uid
properties:
apiVersion:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The apiVersion subschema should be a const schema, but since OpenAPI 3.0 doesn't contain it, maybe you should add the property enum: ["v1alpha1"]

properties:
apiVersion:
type: string
kind:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@vaikas
Copy link
Contributor

vaikas commented Feb 18, 2020

Given the issues that actually come up with the conversion and the validation once the conversion webhook comes into play, I'm not sure that staging these adds much value. I'm fine with this, but as witnessed by various issues in the (status needs to be filled in, etc.):
#2577
I'd much rather we move the schemas at the same time we add the conversion.

minLength: 1
delivery:
description: "Channel delivery options. More information: https://knative.dev/docs/eventing/event-delivery."
type: object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need status here, see #2577

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vaikas I will follow up - just seeing this

@matzew
Copy link
Member Author

matzew commented Feb 19, 2020

@vaikas I will give the conversion a shot

@vaikas
Copy link
Contributor

vaikas commented Feb 21, 2020

As discussed offline:
#2621

@matzew
Copy link
Member Author

matzew commented Feb 21, 2020

/close

@knative-prow-robot
Copy link
Contributor

@matzew: Closed this PR.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants