github.com/wmuizelaar/kpt@v0.0.0-20221018115725-bd564717b2ed/site/reference/annotations/local-config/README.md (about)

     1  ---
     2  title: "`local-config`"
     3  linkTitle: "local-config"
     4  type: docs
     5  description: >
     6    Specify a resource to be skipped when applying.
     7  ---
     8  
     9  The `config.kubernetes.io/local-config` annotation specifies a resource to be
    10  skipped when applying.
    11  
    12  These resources are generally used as input to kpt functions.
    13  
    14  Because local resources are not applied, they don't need to follow a resource
    15  schema known by the cluster. They just need to be a valid Kubernetes resource,
    16  with apiVersion, kind, metadata, and name.
    17  
    18  ### Schema
    19  
    20  The annotation value accepts string values of `true` and `false`.
    21  
    22  Make sure to surround the value in quotes, otherwise it will be considered a
    23  YAML boolean (invalid annotation), not a string.
    24  
    25  ### Behavior
    26  
    27  Resources with the `local-config` annotation set to `true` will not be applied
    28  to the cluster when using `kpt live apply`.
    29  
    30  ### Example
    31  
    32  In this example, the `ConfigMap` `cm-a` is local and not applied.
    33  
    34  Create a new kpt package:
    35  
    36  ```shell
    37  mkdir my-pkg
    38  cd my-pkg
    39  kpt pkg init
    40  ```
    41  
    42  Configure a local `ConfigMap`:
    43  
    44  ```shell
    45  cat > setters.yaml << EOF
    46  apiVersion: v1
    47  kind: ConfigMap
    48  metadata:
    49    name: setters
    50    annotations:
    51      config.kubernetes.io/local-config: "true"
    52  data:
    53    key-a: value-a
    54    key-b: value-b
    55  EOF
    56  ```
    57  
    58  Create a namespace for your package:
    59  
    60  ```shell
    61  kubectl create namespace test
    62  ```
    63  
    64  Initialize the package inventory:
    65  
    66  ```shell
    67  kpt live init
    68  ```
    69  
    70  Apply the package to your Kubernetes cluster:
    71  
    72  ```shell
    73  kpt live apply
    74  ```
    75  
    76  If all goes well, the output should be empty.
    77  
    78  To verify that the `ConfigMap` was not created:
    79  
    80  ```shell
    81  kubectl get ConfigMap setters
    82  ```
    83  
    84  The request should error:
    85  
    86  ```
    87  Error from server (NotFound): configmaps "setters" not found
    88  ```