Skip to content

Instantly share code, notes, and snippets.

View ajeya's full-sized avatar

Ajeya Vempati ajeya

  • Sydney, Australia
View GitHub Profile
@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'

@clarkmcc
clarkmcc / main.go
Created March 16, 2021 18:43
Get all filenames inside an Golang embedded filesystem.
func getAllFilenames(fs *embed.FS, path string) (out []string, err error) {
if len(path) == 0 {
path = "."
}
entries, err := fs.ReadDir(path)
if err != nil {
return nil, err
}
for _, entry := range entries {
fp := filepath.Join(path, entry.Name())
@thikade
thikade / convert-deploymentconfig-to-deployment.md
Last active June 12, 2022 05:13 — forked from tillkahlbrock/convert-deploymentconfig-to-deployment.md
Convert OpenShift DeploymentConfig to Kubernetes Deployment
  1. Change apiVersion from:

    - apiVersion: v1

    (or apiVersion: apps.openshift.io/v1)

    to:

@henrik242
henrik242 / airtag-to-gpx-sync.sh
Last active May 25, 2024 13:24
Read AirTag data from the FindMy.app cache and convert to GPX
#!/usr/bin/env bash
#
# Reads AirTag data from the FindMy.app cache and converts it to a daily GPX file
#
# Rsyncs the data to a web accessible folder that can be displayed with e.g.
# https://gist.github.com/henrik242/84ad80dd2170385fe819df1d40224cc4
#
# This should typically be run as a cron job
#