Skip to content

Instantly share code, notes, and snippets.

@dudash
Last active March 24, 2021 16:36
Show Gist options
  • Select an option

  • Save dudash/e62b3b25c8713386a28c19b64604891e to your computer and use it in GitHub Desktop.

Select an option

Save dudash/e62b3b25c8713386a28c19b64604891e to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# A simplifed CLI command to scale all deployments to 1
#
# source: https://gist.github.com/dudash/e62b3b25c8713386a28c19b64604891e
# docs: https://docs.openshift.com/container-platform/4.7/cli_reference/openshift_cli/extending-cli-plugins.html
#
# To install/use this:
# put this script in /usr/local/bin
# chmod a+x oc-scale1
# oc scale1
oc get dc -o name | xargs -t oc scale --replicas=1
oc get deployment -o name | xargs -t oc scale --replicas=1
@dudash
Copy link
Copy Markdown
Author

dudash commented Mar 24, 2021

You use this, just download and move this file to /usr/local/bin and make it executable with chmod a+x oc-scale1.

The oc CLI will automatically pick it up, so now you can use it with oc scale1

You can read about CLI extensions here:
https://docs.openshift.com/container-platform/4.7/cli_reference/openshift_cli/extending-cli-plugins.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment