Coder Social home page Coder Social logo

lberk / discovery Goto Github PK

View Code? Open in Web Editor NEW

This project forked from knative-extensions/discovery

0.0 2.0 0.0 11.33 MB

Enable interactions with a cluster and its resources: built-in types, CRDs and COs.

License: Apache License 2.0

Shell 15.25% Go 84.75%

discovery's Introduction

Knative Discovery API

go.dev reference Go Report Card Releases LICENSE TestGrid Slack Status

This is Work in Progress. It is based on the Discovery API design doc.

Install

TODO: instructions on installing nightly and a release.

Development

Install,

ko apply -f ./config

ClusterDuckType:discovery.knative.dev/v1alpha1

The goal is to have a custom type that is user installable to help a developer, cluster admin, or tooling to better understand the duck types that are installed in the cluster. This information could be used to understand which Kinds could fulfill a role for another resource.

demos.example.com.yaml

apiVersion: discovery.knative.dev/v1alpha1
kind: ClusterDuckType
metadata:
  name: demos.example.com
spec:
  # selectors is a list of CRD label selectors to find CRDs that have been
  # labeled as the given duck type.
  selectors:
    - labelSelector: "example.com/demo=true"

  # Names allows us to give a short name to the duck type.
  names:
    name: "Demo"
    plural: "demos"
    singular: "demo"

  # Versions are to allow the definition of a single duck type with multiple
  # versions, useful if the duck type API shape changes.
  versions:
    - name: "v1"
      # refs allows for adding native types, or crds directly as the ducks via
      # Group/Version/Kind/Resource
      refs:
        - group: "demo.example.com"
          version: "v1"
          kind: "Demo"
      # additionalPrinterColumns is intended to understand what printer columns
      # should be used for the custom objects.
      additionalPrinterColumns:
        - name: Ready
          type: string
          jsonPath: ".status.conditions[?(@.type=='Ready')].status"
        - name: Reason
          type: string
          jsonPath: ".status.conditions[?(@.type=='Ready')].reason"
        - name: Demo
          type: string
          jsonPath: .status.demo
      # schema is the partial schema of the duck type.
      schema:
        openAPIV3Schema:
          properties:
            status:
              type: object
              properties:
                address:
                  type: object
                  properties:
                    demo:
                      type: string
  group: example.com

Demo

Using addressables.duck.knative.dev.yaml, we will apply it,

kubectl apply -f ./config/knative/addressables.duck.knative.dev.yaml
clusterducktype.discovery.knative.dev/addressables.duck.knative.dev created

After applying this, you can fetch it:

kubectl get cducks addressables.duck.knative.dev
NAME                            SHORT NAME    DUCKS   READY   REASON
addressables.duck.knative.dev   addressable   6       True

And get the full DuckType addressables.duck.knative.dev resource:

kubectl get clusterducktypes addressables.duck.knative.dev -oyaml
apiVersion: discovery.knative.dev/v1alpha1
kind: ClusterDuckType
metadata:
  generation: 2
  name: addressables.duck.knative.dev
spec: ...
status:
  conditions:
    - lastTransitionTime: "2020-08-11T22:21:57Z"
      status: "True"
      type: Ready
  duckCount: 6
  ducks:
    v1:
      - apiVersion: eventing.knative.dev/v1
        kind: Broker
        scope: Namespaced
      - apiVersion: eventing.knative.dev/v1beta1
        kind: Broker
        scope: Namespaced
      - apiVersion: flows.knative.dev/v1
        kind: Parallel
        scope: Namespaced
      - apiVersion: flows.knative.dev/v1
        kind: Sequence
        scope: Namespaced
      - apiVersion: flows.knative.dev/v1beta1
        kind: Parallel
        scope: Namespaced
      - apiVersion: flows.knative.dev/v1beta1
        kind: Sequence
        scope: Namespaced
      - apiVersion: messaging.knative.dev/v1
        kind: Channel
        scope: Namespaced
      - apiVersion: messaging.knative.dev/v1beta1
        kind: Channel
        scope: Namespaced
      - apiVersion: serving.knative.dev/v1
        kind: Route
        scope: Namespaced
      - apiVersion: serving.knative.dev/v1
        kind: Service
        scope: Namespaced
      - apiVersion: serving.knative.dev/v1alpha1
        kind: Route
        scope: Namespaced
      - apiVersion: serving.knative.dev/v1alpha1
        kind: Service
        scope: Namespaced
      - apiVersion: serving.knative.dev/v1beta1
        kind: Route
        scope: Namespaced
      - apiVersion: serving.knative.dev/v1beta1
        kind: Service
        scope: Namespaced
  observedGeneration: 2

Knative Duck Types

If the ./config/knative directory is applied (via kubectl apply -f config/knative), a quick view of the duck types used by Knative in this cluster becomes easier to find:

kubectl get clusterducktypes
NAME                            SHORT NAME    DUCKS   READY   REASON
addressables.duck.knative.dev   Addressable   6       True
bindings.duck.knative.dev       Binding       1       True
channelables.duck.knative.dev   Channelable   0       True
podspecables.duck.knative.dev   PodSpecable   7       True
sources.duck.knative.dev        Source        4       True

Note: there is also a short name: cducks

kubectl get cducks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.