how to patch configmap field using python client library how to patch configmap field using python client library kubernetes kubernetes

how to patch configmap field using python client library


The body parameter in patch_namespaced_config_map is the actual configmap data that you want to patch and needs to be first obtained with read_namespaced_config_map.

Following steps are required for all the operations that have the body argument:

  1. Get the data using the read_*/get_*method
  2. Use the data returned in the first step in the API modifying the object.

Further, for most cases, it is enough to pass the required arguments namelyname, namespace and body but here is the info about each:

Parameters

NameTypeDescriptionNotes
namestrname of the ConfigMap
namespacestrobject name and auth scope, such as for teams and projects
bodyobject
prettystrIf 'true', then the output is pretty printed.[optional]
dry_runstrWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed[optional]
field_managerstrfieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. This field is required for apply requests (application/apply-patch) but optional for non-apply patch types (JsonPatch, MergePatch, StrategicMergePatch).[optional]
forceboolForce is going to "force" Apply requests. It means user will re-acquire conflicting fields owned by other people. Force flag must be unset for non-apply patch requests.[optional]

Review the K8s python client README for the list of all supported APIs and their usage.