OC(1)

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

πŸ‘‘ OC(1) β€” the oc diff glow-up

okay bestie, pull up a chair because we're talking about oc diff from the OpenShift CLI user manual, and honestly? it's giving "let me show you the future before you commit to it" energy πŸ’…

✨ NAME ✨

oc diff β€” diff the live version against a would-be applied version πŸ¦‹

🌸 SYNOPSIS 🌸

oc diff [OPTIONS]

πŸ’– DESCRIPTION πŸ’–

So here's the vibe: oc diff diffs the configurations you point it at β€” either by file name or from stdin β€” between the current online configuration and the configuration as it would be if applied ✨. Like a sneak peek. A preview. A little trailer before the movie drops 🎬

The output is always YAML. no cap. 🫢

You can also bring your own diff tool with the KUBECTL_EXTERNAL_DIFF environment variable. And yes, you can absolutely pass params to external commands too β€” for example:

KUBECTL_EXTERNAL_DIFF="colordiff -N -u"

By default, whatever diff command is chillin' in your path gets run with the -u (unified diff) and -N (treat absent files as empty) options ✨

Exit status tea β˜•: 0 = no differences were found. 1 = differences were found. >1 = kubectl or diff failed with an error 😭
Note bestie: if you use KUBECTL_EXTERNAL_DIFF, it's expected to follow that convention. iykyk πŸ’€

πŸŽ€ OPTIONS πŸŽ€

  • --concurrency=1 β€” number of objects to process in parallel when diffing against the live version. bigger number = faster, but more memory, I/O and CPU crammed into that shorter window of time πŸ”₯
  • --field-manager="kubectl-client-side-apply" β€” the name of the manager used to track field ownership πŸ‘‘
  • -f, --filename=[] β€” filename, directory, or URL to files containing the configuration to diff πŸ“
  • --force-conflicts=false β€” if true, server-side apply will force the changes against conflicts πŸ’₯
  • -k, --kustomize="" β€” process the kustomization directory. heads up: this flag can't be used together with -f or -R πŸ™ˆ
  • --prune=false β€” include resources that would be deleted by pruning. can be used with -l, and by default shows all resources that would be pruned 🌈
  • --prune-allowlist=[] β€” overwrite the default allowlist with <group/version/kind> for --prune ⭐
  • -R, --recursive=false β€” process the directory used in -f, --filename recursively. so useful when you want to manage related manifests organized within the same directory 🧚
  • -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 ✨
  • --server-side=false β€” if true, apply runs in the server instead of the client πŸ’œ
  • --show-managed-fields=false β€” if true, include managed fields in the diff πŸ‘€

🌟 OPTIONS INHERITED FROM PARENT COMMANDS 🌟

these are the family heirlooms, passed down from the parent command, we love a legacy πŸ’–

  • --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 πŸ‘―
  • --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 πŸ“
  • --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 πŸ“¦
  • --insecure-skip-tls-verify=false β€” if true, the server's certificate will not be checked for validity. this will make your HTTPS connections insecure β€” yes, actually insecure, take that seriously 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 the KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off 🧚
  • --match-server-version=false β€” require server version to match client version πŸͺž
  • -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) πŸ“Š
  • --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 ⏳
  • -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 β€” dramatic but valid πŸ’€

🌈 EXAMPLE 🌈

# Diff resources included in pod.json
oc diff -f pod.json

# Diff file read from stdin
cat service.yaml | oc diff -f -

πŸ‘‘ SEE ALSO πŸ‘‘

πŸ’œ HISTORY πŸ’œ

June 2016, ported from the Kubernetes man-doc generator πŸŽ€


and that's the whole page, bestie β€” iconic, honestly. this gem lives in the Openshift CLI User Manuals, brought to you by Openshift, dated June 2016 ✨ periodt πŸ’…πŸ¦‹

πŸ“¦ where this page comes from