package
0.0.0-20200122233423-62801f1d34cf
Repository: https://github.com/vishvananda/pkg.git
Documentation: pkg.go.dev

# README

Duck Types

Knative leverages duck-typing to interact with resources inside of Kubernetes without explicit knowlage of the full resource shape. knative/pkg defines two duck types that are used throughout Knative: Addressable and Source.

For APIs leveraging ObjectReference, the context of the resource in question identifies the duck-type. To enable the case where no ObjectRefrence is used, we have labeled the Custom Resource Definition with the duck-type. Those labels are as follows:

LabelDuck-Type
duck.knative.dev/addressable=trueAddressable
duck.knative.dev/binding=trueBinding
duck.knative.dev/source=trueSource

Addressable Shape

Addressable is expected to be the following shape:

apiVersion: group/version
kind: Kind
status:
  address:
    url: http://host/path?query

Binding Shape

Binding is expected to be in the following shape:

(with direct subject)

apiVersion: group/version
kind: Kind
spec:
  subject:
    apiVersion: group/version
    kind: SomeKind
    namespace: the-namespace
    name: a-name

(with indirect subject)

apiVersion: group/version
kind: Kind
spec:
  subject:
    apiVersion: group/version
    kind: SomeKind
    namespace: the-namespace
    selector:
      matchLabels:
        key: value

Source Shape

Source is expected to be in the following shape:

(with ref sink)

apiVersion: group/version
kind: Kind
spec:
  sink:
    ref:
      apiVersion: group/version
      kind: AnAddressableKind
      name: a-name
  ceOverrides:
    extensions:
      key: value
status:
  observedGeneration: 1
  conditions:
    - type: Ready
      status: "True"
  sinkUri: http://host

(with uri sink)

apiVersion: group/version
kind: Kind
spec:
  sink:
    uri: http://host/path?query
  ceOverrides:
    extensions:
      key: value
status:
  observedGeneration: 1
  conditions:
    - type: Ready
      status: "True"
  sinkUri: http://host/path?query

(with ref and uri sink)

apiVersion: group/version
kind: Kind
spec:
  sink:
    ref:
      apiVersion: group/version
      kind: AnAddressableKind
      name: a-name
    uri: /path?query
  ceOverrides:
    extensions:
      key: value
status:
  observedGeneration: 1
  conditions:
    - type: Ready
      status: "True"
  sinkUri: http://host/path?query

# Packages

+k8s:deepcopy-gen=package +groupName=duck.knative.dev.
+k8s:deepcopy-gen=package +groupName=duck.knative.dev.
+k8s:deepcopy-gen=package +groupName=duck.knative.dev.

# Functions

AsStructuredWatcher is public for testing only.
ConformsToType will return true or false depending on whether a concrete resource properly implements the provided Implementable duck type.
CreateBytePatch is a helper function that creates the same content as CreatePatch, but returns in []byte format instead of JSONPatch.
CreateMergePatch creates a json merge patch as specified in http://tools.ietf.org/html/draft-ietf-appsawg-json-merge-patch-07.
CreatePatch creates a patch as specified in http://jsonpatch.com/.
FromUnstructured takes unstructured object from (say from client-go/dynamic) and converts it into our duck types.
NewProxyWatcher creates new proxyWatcher by wrapping a channel.
ToUnstructured takes an instance of a OneOfOurs compatible type and converts it to unstructured.Unstructured.
VerifyType verifies that a particular concrete resource properly implements the provided Implementable duck type.

# Constants

BindingExcludeLabel is a label that is placed on namespaces and resources to exclude them from consideration when binding things.
BindingIncludeLabel is a label that is placed on namespaces and resources to include them in consideration when binding things.
No description provided by the author

# Structs

CachedInformerFactory implements InformerFactory by delegating to another InformerFactory, but memoizing the results.
EnqueueInformerFactory implements InformerFactory by delegating to another InformerFactory, but attaching a ResourceEventHandler to the informer.
TypedInformerFactory implements InformerFactory such that the elements tracked by the informer/lister have the type of the canonical "obj".

# Interfaces

Bindable may be implemented by Binding resources to use shared libraries.
BindableStatus is the interface that the .status of Bindable resources must implement to work smoothly with our BaseReconciler.
Implementable is implemented by the Fooable duck type that consumers are expected to embed as a `.status.fooable` field.
InformerFactory is used to create Informer/Lister pairs for a schema.GroupVersionResource.
OneOfOurs is the union of our Accessor interface and the OwnerRefable interface that is implemented by our resources that implement the kmeta.Accessor.
Populatable is implemented by a skeleton resource wrapping an Implementable duck type.

# Type aliases

No description provided by the author