knative.dev/pkg@v0.0.0-20260602142205-ac97e43f6622/webhook/psbinding/doc.go (about)

     1  /*
     2  Copyright 2019 The Knative Authors
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless requ ired by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  // Package psbinding provides facilities to make authoring Bindings that
    18  // work with "Pod Spec"-able subjects easier.  There are two key components
    19  //  1. The AdmissionController, which lives in psbinding.go (controller.go)
    20  //     sets it up.
    21  //  2. The BaseReconciler, which lives in reconciler.go and can either be
    22  //     used directly as a Reconciler, or it can be wrapped as a base
    23  //     implementation for a customized reconciler that wants to take advantage
    24  //     of its facilities (e.g. for updating status and manipulating finalizers).
    25  //
    26  // The core concept to consuming psbinding is the Bindable interface.  By
    27  // implementing Bindable on your binding resource, you enable the BaseReconciler
    28  // to take over a significant amount of the boilerplate reconciliation (maybe
    29  // all of it).  A lot of the interface methods will seem pretty standard to
    30  // Knative folks, but the two key methods to call our are Do and Undo.  These
    31  // "mutation" methods carry the business logic for the "Pod Spec"-able binding.
    32  //
    33  // The mutation methods have the signature:
    34  //
    35  //	func(context.Context, *v1alpha1.WithPod)
    36  //
    37  // These methods are called to have the Binding perform its mutation on the
    38  // supplied WithPod (our "Pod Spec"-able wrapper type).  However, in some
    39  // cases the binding may need additional context.  Similar to apis.Validatable
    40  // and apis.Defaultable these mutations take a context.Context, and similar
    41  // to our "resourcesemantics" webhook, the "psbinding" package provides a hook
    42  // to allow consumers to infuse this context.Context with additional... context.
    43  // The signature of these hooks is BindableContext, and they may be supplied to
    44  // both the AdmissionController and the BaseReconciler.
    45  package psbinding