...

Source file src/sigs.k8s.io/controller-runtime/pkg/client/doc.go

Documentation: sigs.k8s.io/controller-runtime/pkg/client

     1  /*
     2  Copyright 2018 The Kubernetes 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 required 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 client contains functionality for interacting with Kubernetes API
    18  // servers.
    19  //
    20  // # Clients
    21  //
    22  // Clients are split into two interfaces -- Readers and Writers.   Readers
    23  // get and list, while writers create, update, and delete.
    24  //
    25  // The New function can be used to create a new client that talks directly
    26  // to the API server.
    27  //
    28  // It is a common pattern in Kubernetes to read from a cache and write to the API
    29  // server.  This pattern is covered by the creating the Client with a Cache.
    30  //
    31  // # Options
    32  //
    33  // Many client operations in Kubernetes support options.  These options are
    34  // represented as variadic arguments at the end of a given method call.
    35  // For instance, to use a label selector on list, you can call
    36  //
    37  //	err := someReader.List(context.Background(), &podList, client.MatchingLabels{"somelabel": "someval"})
    38  //
    39  // # Indexing
    40  //
    41  // Indexes may be added to caches using a FieldIndexer.  This allows you to easily
    42  // and efficiently look up objects with certain properties.  You can then make
    43  // use of the index by specifying a field selector on calls to List on the Reader
    44  // corresponding to the given Cache.
    45  //
    46  // For instance, a Secret controller might have an index on the
    47  // `.spec.volumes.secret.secretName` field in Pod objects, so that it could
    48  // easily look up all pods that reference a given secret.
    49  package client
    50  

View as plain text