Skip to content

Instantly share code, notes, and snippets.

View nickjordan's full-sized avatar

Nick Jordan nickjordan

View GitHub Profile
@nickjordan
nickjordan / get-all.sh
Last active September 19, 2020 00:06 — forked from e-minguez/get-all.sh
Get all k8s objects, both namespaced or not
#!/usr/bin/env bash
getall() {
for i in $(oc api-resources --verbs=list --namespaced -o name | grep -v "events.events.k8s.io" | grep -v "events" | sort | uniq); do
echo "Resource:" $i
oc -n ${1} get --ignore-not-found=true ${i} -o yaml > ${1}/${i}.yaml
done
}
clusterwide() {
- apiVersion: security.openshift.io/v1
defaultAddCapabilities: null
fsGroup:
type: RunAsAny
groups:
- system:cluster-admins
kind: SecurityContextConstraints
metadata:
annotations:
kubernetes.io/description: anyuid provides all features of the restricted SCC but allows users to run with any UID and any GID.
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: null
name: runasany
namespace: jupyter
apiVersion: security.openshift.io/v1
defaultAddCapabilities: null
@nickjordan
nickjordan / migrating-openshift-projects.md
Last active April 30, 2019 20:42
TAR Docker Export Import

Migrating Openshift Projects

  • Export your project resources as a template to remove UID, spec, and other metadata.
  • The object types included in oc export or oc get all include: BuildConfig, Build, DeploymentConfig, ImageStream, Pod, ReplicationController, Route, Service

1. Backup Project API Resources

Using oc export (OCP < 3.10)

# Move to your working project Directory
oc project $PROJECT_NAME 
ENV USER_ID=1002930000 GROUP_ID=0 HOME=/home/openshiftuser
RUN mkdir -p /home/openshiftuser && \
echo "default:x:${USER_ID}:${GROUP_ID}:Default OpenShift User:${HOME}:/sbin/nologin" >> /etc/passwd && \
chown ${USER_ID}:${GROUP_ID} /home/openshiftuser -R
@nickjordan
nickjordan / cloudsql-table-migration.sh
Created October 11, 2018 00:15
Bash script to export, transform, and import tables into cloudsql instances using gcloud cli.
#!/bin/bash
###################################################################
##### Name: cloudsql-table-migration
##### Version: 2.0
##### Author : Nick Jordan
##### Email : nick@nljordan.com
##### Description : Migrates tables between cloudsql instances using user owned buckets, and gcloud cli, renames tables to use new_${unix_timestamp} prefix, and imports to destination instance:db.
##### Dependencies : bash, gcloud-cli, gzip, (gnu) sed, tr, grep
##### Optional Dependencies: pigz
##################### Args #####################

Keybase proof

I hereby claim:

  • I am nickjordan on github.
  • I am nljordan (https://keybase.io/nljordan) on keybase.
  • I have a public key whose fingerprint is 9ED8 CFFF F296 EFAF 7D9D C191 A49A 446F E370 40B8

To claim this, I am signing this object:

@nickjordan
nickjordan / .gitignore
Last active August 29, 2015 14:06 — forked from octocat/.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@nickjordan
nickjordan / gist:f959cd827a724881057b
Created August 23, 2014 17:48
MYSQL: To Remember
#.bin/bash
#Check Databases
SHOW DATABASES;
#Update Root Password
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
@nickjordan
nickjordan / gist:2913979
Created June 12, 2012 02:19
Adding Keys for Heroku
heroku keys:add ~/.ssh/id_rsa.pub
http://stackoverflow.com/questions/4269922/permission-denied-publickey-when-deploying-heroku-code-fatal-the-remote-end