OC(1)

πŸ“¦
version 4.22.0 Β· 2 versions
, in nixpkgs unstable

πŸ’… OC(1) β€” annotate, but make it a whole vibe ✨

okay so bestie, welcome to the oc annotate glow-up manual, the June 2016 edition, ported straight from the Kubernetes man-doc generator and honestly it's giving iconic legacy. this page lives in the Openshift CLI User Manuals and yes we're gonna read the whole thing together. πŸŽ€


🌸 NAME 🌸

oc annotate β€” update the annotations on a resource. that's it. that's the job. πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

oc annotate [OPTIONS]

literally just the command and your flags, no cap.


✨ DESCRIPTION ✨

okay so first thing: this updates the annotations on one or more resources. one. or more. we love flexibility. πŸ’…

now, every single Kubernetes object supports storing extra data on itself as annotations β€” it's basically the object's little diary. annotations are key/value pairs, and here's the slay part: they can be bigger than labels and can hold arbitrary string values like structured JSON. tools and system extensions will absolutely use annotations to stash their own data. that's the whole point. πŸ”₯

⚠️ important though: if you try to set an annotation that already exists, it will fail β€” unless --overwrite is set. and if --resource-version is specified and it doesn't match the current resource version on the server, the command fails too. respect the version, bestie. 😭

and if you're ever sitting there like "what resources even exist" β€” just run oc api-resources for a complete list of supported resources. iykyk. 🌈


πŸ’œ OPTIONS πŸ’œ

  • --all=false β€” select all resources, in the namespace of the specified resource types. all of them. yes, all. πŸ‘‘
  • -A, --all-namespaces=false β€” if true, check the specified action in all namespaces. every single one. πŸ¦‹
  • --allow-missing-template-keys=true β€” if true, ignore any errors in templates when a field or map key is missing in the template. only applies to golang and jsonpath output formats. it's very forgiving energy. 🌸
  • --dry-run="none" β€” must be "none", "server", or "client". if client strategy, only print the object that would be sent, without sending it. if server strategy, submit a server-side request without persisting the resource. a little look-but-don't-touch moment. πŸ™ˆ
  • --field-manager="kubectl-annotate" β€” the name of the manager used to track field ownership. it's the little name tag on your edits. πŸŽ€
  • --field-selector="" β€” selector (field query) to filter on, supports =, ==, and !=. (e.g. --field-selector key1=value1,key2=value2). heads up, the server only supports a limited number of field queries per type. ⭐
  • -f, --filename=[] β€” filename, directory, or URL to files identifying the resource to update the annotation. point at it, we'll handle it. πŸ’–
  • -k, --kustomize="" β€” process the kustomization directory. > this flag can't be used together with -f or -R. pick a lane, bestie. πŸ’…
  • --list=false β€” if true, display the annotations for a given resource. just lookin'. πŸ‘€
  • --local=false β€” if true, annotation will NOT contact api-server but run locally. off the grid. 🧚
  • -o, --output="" β€” output format. one of: (json, yaml, kyaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file). so many options, pick your fighter. 🌈
  • --overwrite=false β€” if true, allow annotations to be overwritten, otherwise reject annotation updates that overwrite existing annotations. the permission slip. ✨
  • -R, --recursive=false β€” process the directory used in -f, --filename recursively. useful when you want to manage related manifests organized within the same directory. go deep. πŸ¦‹
  • --resource-version="" β€” if non-empty, the annotation update will only succeed if this is the current resource-version for the object. only valid when specifying a single resource. one resource only, don't get greedy. πŸ”₯
  • -l, --selector="" β€” selector (label query) to filter on, supports =, ==, !=, in, notin. (e.g. -l key1=value1,key2=value2,key3 in (value3)). matching objects must satisfy all of the specified label constraints. all of 'em. πŸ‘‘
  • --show-managed-fields=false β€” if true, keep the managedFields when printing objects in JSON or YAML format. 🫢
  • --template="" β€” template string or path to template file to use when -o=go-template, -o=go-template-file. the template format is golang templates [ ⟨http://golang.org/pkg/text/template/#pkg-overview⟩ ]. πŸŽ€

πŸ’« OPTIONS INHERITED FROM PARENT COMMANDS πŸ’«

these aren't even annotate's flags, they're the family flags. they came with the place. 😭

  • --as="" β€” username to impersonate for the operation. user could be a regular user or a service account in a namespace. 🧚
  • --as-group=[] β€” group to impersonate for the operation, this flag can be repeated to specify multiple groups. stack 'em. πŸ’œ
  • --as-uid="" β€” UID to impersonate for the operation. πŸ¦‹
  • --as-user-extra=[] β€” user extras to impersonate for the operation, this flag can be repeated to specify multiple values for the same key. 🌸
  • --cache-dir="/homeless-shelter/.kube/cache" β€” default cache directory. that path is real, i promise. 😭
  • --certificate-authority="" β€” path to a cert file for the certificate authority. πŸŽ€
  • --client-certificate="" β€” path to a client certificate file for TLS. ⭐
  • --client-key="" β€” path to a client key file for TLS. πŸ”₯
  • --cluster="" β€” the name of the kubeconfig cluster to use. πŸ‘‘
  • --context="" β€” the name of the kubeconfig context to use. 🌈
  • --disable-compression=false β€” if true, opt-out of response compression for all requests to the server. no zipping. πŸ’…
  • --insecure-skip-tls-verify=false β€” if true, the server's certificate will not be checked for validity. > this will make your HTTPS connections insecure. like actually. be careful, bestie. 🚨
  • --kubeconfig="" β€” path to the kubeconfig file to use for CLI requests. 🫢
  • --kuberc="" β€” path to the kuberc file to use for preferences. this can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off. πŸ¦‹
  • --match-server-version=false β€” require server version to match client version. strict vibes only. ✨
  • -n, --namespace="" β€” if present, the namespace scope for this CLI request. πŸ’–
  • --profile="none" β€” name of profile to capture. one of (none|cpu|heap|goroutine|threadcreate|block|mutex). pick your profile era. πŸ”₯
  • --profile-output="profile.pprof" β€” name of the file to write the profile to. πŸŽ€
  • --request-timeout="0" β€” the length of time to wait before giving up on a single server request. non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). a value of zero means don't timeout requests. patience is a virtue, or whatever. 🌸
  • -s, --server="" β€” the address and port of the Kubernetes API server. πŸ“
  • --tls-server-name="" β€” server name to use for server certificate validation. if it is not provided, the hostname used to contact the server is used. 😌
  • --token="" β€” bearer token for authentication to the API server. πŸ”‘
  • --user="" β€” the name of the kubeconfig user to use. πŸ‘€
  • --warnings-as-errors=false β€” treat warnings received from the server as errors and exit with a non-zero exit code. no warning slander tolerated. πŸ’€

πŸ“ EXAMPLE πŸ“

these are verbatim, don't @ me, just copy them:

# Update pod 'foo' with the annotation 'description' and the value 'my frontend'
# If the same annotation is set multiple times, only the last value will be applied
oc annotate pods foo description='my frontend'

# Update a pod identified by type and name in "pod.json"
oc annotate -f pod.json description='my frontend'

# Update pod 'foo' with the annotation 'description' and the value 'my frontend running nginx', overwriting any existing value
oc annotate --overwrite pods foo description='my frontend running nginx'

# Update all pods in the namespace
oc annotate pods --all description='my frontend running nginx'

# Update pod 'foo' only if the resource is unchanged from version 1
oc annotate pods foo description='my frontend running nginx' --resource-version=1

# Update pod 'foo' by removing an annotation named 'description' if it exists
# Does not require the --overwrite flag
oc annotate pods foo description-

that last one with the trailing -? it removes the annotation and does not need --overwrite. ate. πŸ’…


🌈 SEE ALSO 🌈

go read the parent, bestie, it's the main character of this whole family. πŸ‘‘


🧚 HISTORY 🧚

June 2016 β€” ported from the Kubernetes man-doc generator. vintage. iconic. πŸŽ€


okay that's the whole page!! mwah πŸ’– this lil number came to you from Openshift, part of the Openshift CLI User Manuals, dated June 2016 β€” and yes the header said OC(1) and the footer was still out here living its OC(1) life too. love that for us. 🫢✨

πŸ“¦ where this page comes from