Skip to content

Instantly share code, notes, and snippets.

View luckylittle's full-sized avatar
:octocat:
Working for @RedHatOfficial

Lucian Maly luckylittle

:octocat:
Working for @RedHatOfficial
View GitHub Profile
@luckylittle
luckylittle / README.md
Created May 5, 2021 04:02
README.md template
@luckylittle
luckylittle / ocp4_all_resources.md
Created March 12, 2021 01:48
How can I list all resources and custom resources in OpenShift 4

How can I list all resources and custom resources in OpenShift

List all CRDs with CR name and Scope

oc get crd -o=custom-columns=NAME:.metadata.name,CR_NAME:.spec.names.singular,SCOPE:.spec.scope

List every single custom resources in the cluster

oc get $(oc get crd -o=custom-columns=CR_NAME:.spec.names.singular --no-headers | awk '{printf "%s%s",sep,$0; sep=","}') --ignore-not-found --all-namespaces -o=custom-columns=KIND:.kind,NAME:.metadata.name,NAMESPACE:.metadata.namespace

List every single resource in the cluster (custom and non-custom)

oc get $(oc api-resources --verbs=list -o name | awk '{printf "%s%s",sep,$0;sep=","}') --ignore-not-found --all-namespaces -o=custom-columns=KIND:.kind,NAME:.metadata.name,NAMESPACE:.metadata.namespace --sort-by='metadata.namespace'

@luckylittle
luckylittle / registry_access.sh
Created March 11, 2021 03:39
Access to OpenShift Image Registry via ServiceAccount token
#!/bin/bash
# Confirm the service is up:
oc get svc image-registry -n openshift-image-registry
# Create a ServiceAccount:
oc create sa pipeline
# Add image-builder role to the ServiceAccount:
oc adm policy add-role-to-user system:image-builder -z pipeline
# Add privileged Security Context Constraint (SCC) so you can run container inside container:
oc adm policy add-scc-to-user privileged -z pipeline
@luckylittle
luckylittle / check_etcd.sh
Created February 22, 2021 01:32 — forked from pichuang/check_etcd.sh
Check etcd status on OCP 4.6.1
#!/bin/bash
# Ref: https://docs.openshift.com/container-platform/4.6/backup_and_restore/backing-up-etcd.html
etcd_node=`oc get pods -n openshift-etcd -l app=etcd -o=jsonpath='{.items[0].spec.nodeName}'`
ssh -i ~/.ssh/dmz-ocp4-rsa core@$etcd_node
id=$(sudo crictl ps --name etcdctl | awk 'FNR==2{ print $1}') && sudo crictl exec -it $id /bin/bash
etcdctl member list -w table
etcdctl endpoint health --cluster
@luckylittle
luckylittle / iPerf3.txt
Last active December 28, 2021 10:29
Command line options for iPerf3
# Iperf is a tool for network performance measurement and tuning. It is a cross-platform tool that can produce standardized
performance measurements for any network. Iperf has client and server functionality, and can create data streams to measure
the throughput between the two ends in one or both directions.
[user@server-1 ~]$ iperf3 -s –p 5001 -V --logfile iperf3_server2_20210118.log
1) Linear
[user@client-a ~]$ iperf3 -c –p 5001 –V --logfile iperf3_client-a_lin_20210118.log server-1 –u -4 –Z
[user@client-b ~]$ iperf3 -c –p 5001 –V --logfile iperf3_client-b_lin_20210118.log server-1 –u -4 –Z
@luckylittle
luckylittle / ocp3-garbage-collection.yml
Created February 12, 2021 10:44
Configuring garbage collection in OCP3, an example of appending to YAML in Ansible
---
# Configuring garbage collection in OCP3, an example of appending to YAML in Ansible
# Lucian Maly - Red Hat, Inc.
- name: Configuring garbage collection in OCP3
hosts: masters[0]
gather_facts: no
tasks:
- name: 1.0 | ocp3-garbage-collection.yml | Download the content of a ConfigMap
shell: |
oc extract cm/node-config-compute --to=/root --confirm=true -n openshift-node
@luckylittle
luckylittle / ocp3-etcd-monitoring.yml
Created February 12, 2021 10:41
An example of enabling ETCD monitoring in OCP3
---
# Configuring ETCD monitoring in OCP3
# Lucian Maly - Red Hat, Inc.
- name: Configuring etcd monitoring
hosts: masters[0]
gather_facts: no
tasks:
- name: 1.0 | ocp3-etcd-monitoring.yml | Fetch certificates from one master node to the local machine
fetch:
src: /etc/etcd/ca/{{ item }}
@luckylittle
luckylittle / rescene.sh
Last active February 16, 2024 09:55
Bulk rescene using srr.py and srs.py v0.7
#!/bin/zsh
for dir in */
do
[[ -d "$dir" ]] || break
echo "${dir}"
cd "${dir}" || exit
mkdir Sample
python ~/.local/bin/srr.py ./*.srr -y
python ~/.local/bin/srs.py ./*.srs ./*.mkv -y
@luckylittle
luckylittle / Enable_autologin_Win10.reg
Created January 14, 2021 02:33
This enables "Users must enter a user name and a password to use this computer" option in netplwiz
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device]
"DevicePasswordLessBuildVersion"=dword:00000000
@luckylittle
luckylittle / .zsh_aliases
Last active March 19, 2025 01:19
Backup of ~/.zshrc
# General Aliases
alias beep='speaker-test -l 1 -t wav -w Beep.wav'
alias c="code ."
alias cdd='cd ~/Downloads'
alias chksfv='cksfv -C /home/lmaly/Downloads/ -qr'
#alias d="docker"
alias h="helm"
alias sudo='sudo '
alias v='vault'
alias vi="/usr/bin/vim"