Skip to content

Instantly share code, notes, and snippets.

View WadeBarnes's full-sized avatar

Wade Barnes WadeBarnes

View GitHub Profile
@WadeBarnes
WadeBarnes / gist:d50ed906af40c035a0a3cf04b7d938fd
Created February 10, 2023 14:34
Docker build commands for testing/troubleshooting indy-test-automation image builds
docker build \
--no-cache \
--progress plain \
--build-arg URSA_VERSION=0.3.2-1 \
--build-arg PYTHON3_PYZMQ_VERSION=22.3.0 \
--build-arg INDY_PLENUM_VERSION=1.13.1~rc3 \
--build-arg INDY_NODE_VERSION=1.13.2~rc5 \
--build-arg NODE_REPO_COMPONENT=rc \
-f Dockerfile.ubuntu-2004 \
-t dockerfile.ubuntu-2004 \
@WadeBarnes
WadeBarnes / container-throttling-queries.md
Last active November 10, 2023 19:19
Container throttling queries that I keep forgetting about

Queries to determine how much a container is being throttled

Examples courtesy of Jason Leach.

Example promql query for OCP:

avg(container_cpu_cfs_throttled_periods_total / container_cpu_cfs_periods_total {namespace=~"4a9599-prod", pod=~".*mediator.*", container_name!="POD", image!=""} * 100) BY (pod) 
  • The namespace portion of the query can be a problem when querying inside a namespace.
@WadeBarnes
WadeBarnes / getElasticSearchLogs
Created June 29, 2023 11:56
In cluster query Elastic Search for logs for a given namespace through the api
curl -vk -XGET "https://elasticsearch.openshift-logging.svc:9200/_search" -H 'Content-Type: application/json' -H "Authorization: Bearer sha256~123abc" -d'
{
"query": {
"match_all": {}
}
}'
@WadeBarnes
WadeBarnes / getScaledDownPods.sh
Last active January 23, 2024 21:32
List all Deployments and DeploymentConfigs that have been scaled to zero
export items=$(oc projects -q);
for item in ${items}; do
pods=$(oc -n ${item} get dc,deploy 2> /dev/null | awk '$4==0' | awk '{print $1}');
if [ ! -z "${pods}" ]; then
echo -e "\n${item}:";
for pod in ${pods}; do
echo -e "\t${pod}";
done
fi
done
@WadeBarnes
WadeBarnes / getCredentialFromJenkins
Last active May 1, 2024 19:31
Selectivity extract credentials from Jenkins
def credentialId='credential-id-goes-here'
import com.cloudbees.plugins.credentials.CredentialsProvider
import com.cloudbees.plugins.credentials.Credentials
import com.cloudbees.plugins.credentials.domains.Domain
import jenkins.model.Jenkins
def indent = { String text, int indentationCount ->
def replacement = "\t" * indentationCount
text.replaceAll("(?m)^", replacement)
}
@WadeBarnes
WadeBarnes / ListApps.md
Last active December 3, 2024 13:24
List apps in OpenShift

Scripts to provide a deduplicated list of all apps in a namespace or namespace.

List apps in all namespaces:

oc projects -q | xargs -I {} oc -n {} label all --all --list 2>/dev/null | grep app= | awk '!a[$0]++' | sed s~app=~~

List apps in a given namespace:

oc -n a99fd4-dev label all --all --list 2>/dev/null | grep app= | awk '!a[$0]++' | sed s~app=~~

@WadeBarnes
WadeBarnes / gist:2bda40096a091c8a0a81b2b145b2d633
Created March 27, 2025 12:55
Delete IS tags matching a pattern
oc -n 9b71af-tools get is web -o jsonpath='{range .status.tags[*]}{.tag}{"\n"}' | grep 20250307 | xargs -i sh -c "./manage -e tools untag {} || true"