calicoctl patch

This sections describes the calicoctl patch command.

Read the calicoctl command line interface user reference for a full list of calicoctl commands.

Displaying the help text for ‘calicoctl patch’ command

Run calicoctl patch --help to display the following help menu for the command.

  1. Usage:
  2. calicoctl patch <KIND> <NAME> --patch=<PATCH> [--type=<TYPE>] [--config=<CONFIG>] [--namespace=<NS>]
  3. Examples:
  4. # Partially update a node using a strategic merge patch.
  5. calicoctl patch node node-0 --patch '{"spec":{"bgp": {"routeReflectorClusterID": "CLUSTER_ID"}}}'
  6. # Partially update a node using a json merge patch.
  7. calicoctl patch node node-0 --patch '{"spec":{"bgp": {"routeReflectorClusterID": "CLUSTER_ID"}}}' --type json
  8. Options:
  9. -h --help Show this screen.
  10. -p --patch=<PATCH> Spec to use to patch the resource.
  11. -t --type=<TYPE> Format of patch type:
  12. strategic Strategic merge patch (default)
  13. json JSON Patch, RFC 6902 (not yet implemented)
  14. merge JSON Merge Patch, RFC 7386 (not yet implemented)
  15. -c --config=<CONFIG> Path to the file containing connection
  16. configuration in YAML or JSON format.
  17. [default: ` + constants.DefaultConfigPath + `]
  18. -n --namespace=<NS> Namespace of the resource.
  19. Only applicable to NetworkPolicy, NetworkSet, and WorkloadEndpoint.
  20. Uses the default namespace if not specified.
  21. --context=<context> The name of the kubeconfig context to use.
  22. Description:
  23. The patch command is used to patch a specific resource by type and identifiers in place.
  24. Currently, only JSON format is accepted.
  25. Valid resource types are:
  26. * bgpConfiguration
  27. * bgpPeer
  28. * felixConfiguration
  29. * globalNetworkPolicy
  30. * globalNetworkSet
  31. * hostEndpoint
  32. * ipPool
  33. * networkPolicy
  34. * networkSet
  35. * node
  36. * profile
  37. * workloadEndpoint
  38. The resource type is case insensitive and may be pluralized.
  39. Attempting to patch a resource that does not exists is treated as a
  40. terminating error unless the --skip-not-exists flag is set. If this flag is
  41. set, resources that do not exist are skipped.
  42. When patching resources by type, only a single type may be specified at a
  43. time. The name is required along with any and other identifiers required to
  44. uniquely identify a resource of the specified type.

Examples

  1. Patch an IP Pool to enable outgoing NAT:

    1. calicoctl patch ippool ippool1 -p '{"spec":{"natOutgoing": true}}'

    Results indicate that a resource was successfully patched:

    1. Successfully patched 1 'ipPool' resource

Options

  1. -p --patch=<PATCH> Spec to use to patch the resource.
  2. -t --type=<TYPE> Format of patch type:
  3. strategic Strategic merge patch (default)
  4. json JSON Patch, RFC 6902 (not yet implemented)
  5. merge JSON Merge Patch, RFC 7386 (not yet implemented)
  6. -n --namespace=<NS> Namespace of the resource.
  7. Only applicable to NetworkPolicy and WorkloadEndpoint.
  8. Uses the default namespace if not specified.

General options

  1. -c --config=<CONFIG> Path to the file containing connection
  2. configuration in YAML or JSON format.
  3. [default: /etc/calico/calicoctl.cfg]

See also