Skip to content

Instantly share code, notes, and snippets.

View mbach04's full-sized avatar
💭
This is my status

Matt mbach04

💭
This is my status
  • Red Hat
  • Virginia
View GitHub Profile
apiVersion: template.openshift.io/v1
kind: Template
labels:
app: jenkins-ephemeral
template: jenkins-ephemeral-template
message: A Jenkins service has been created in your project. Log into Jenkins with
your OpenShift account. The tutorial at https://github.com/openshift/origin/blob/master/examples/jenkins/README.md
contains more information about using this template.
metadata:
annotations:
#compliments of Nate Revo :-)
---- Virtual Bridge on Controllers ----
export MAIN_CONN=enp2s0
export MAIN_IP="192.168.3.11"
systemctl stop libvirtd
nmcli c delete "$MAIN_CONN"
nmcli c delete "System $MAIN_CONN"
nmcli c add type bridge ifname br0 autoconnect yes con-name br0 stp off
nmcli c modify br0 ipv4.addresses $MAIN_IP/24 ipv4.method manual
@mbach04
mbach04 / patch-streams.sh
Created May 11, 2019 21:56
Enable OpenShift image stream consumption from insecure docker registry
#!/bin/bash
verbose=1
#Enable verbose console output
verbose_print()
{
if [[ $verbose -eq 1 ]] ; then
echo "$1"
fi
@mbach04
mbach04 / mount_custom_certs.sh
Created February 5, 2019 20:34
Mount node certs into openshift internal docker registry pod for custom s3 regions, also need to configure custom s3 endpoint var in deployer
#!/bin/bash
# From an ocp master:
# create the secret from the node cert bundle
oc create secret generic ca-certificate --from-file=/etc/pki/tls/certs/ca-bundle.crt --from-file=/etc/pki/tls/certs/ca-bundle.trust.crt
# attach the secret as a volume to the docker registry pod
oc set volume dc docker-registry --add -m /etc/pki/tls/certs/ -t secret --secret-name ca-certificate -n default
@mbach04
mbach04 / random_password.sh
Created December 23, 2018 01:57
Create random password with urandom
#!/bin/bash
export PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | sed 1q)
@mbach04
mbach04 / heketi-cli-ocs.sh
Last active January 10, 2019 16:07
Using heketi in OpenShift
Now using project "glusterfs" on server "https://master1.internal:443".
[root@bastion ~]# oc get pods
NAME READY STATUS RESTARTS AGE
glusterblock-storage-provisioner-dc-1-2crqc 1/1 Running 1 13h
glusterfs-storage-6kkhx 1/1 Running 1 13h
glusterfs-storage-fzfqx 1/1 Running 1 13h
glusterfs-storage-xkgsg 1/1 Running 1 13h
heketi-storage-1-z8dzg 1/1 Running 1 13h
[root@bastion ~]# oc rsh heketi-storage-1-z8dzg
sh-4.2# export HEKETI_CLI_KEY=$HEKETI_ADMIN_KEY
@mbach04
mbach04 / scripts.sh
Last active December 6, 2018 14:43
Useful scripts for OpenShift 3.x consulting
# Export a CA bundle from a web site
printf '' | openssl s_client -showcerts -connect $HOST:$PORT 2>/dev/null | sed -e '/^-----BEGIN CERTIFICATE-----$/,/^-----END CERTIFICATE-----$/ !d'
# Export OpenShift image streams names for downloading with docker manual
oc get --export is -n openshift -o json | jq -r '.items[].spec.tags[].from.name' > image-names.json
#Flipping your upstream image stream registry reference to --insecure
# Export OpenShift image streams for editing
oc get --export is -n openshift -o json > image-streams.json