Skip to content

Instantly share code, notes, and snippets.

@dmc5179
dmc5179 / etcd-backup-s3.yaml
Created March 25, 2021 03:01
etcd backup kubecron to S3
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: etcd-backup
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
@dmc5179
dmc5179 / etcd-backup-cron.yaml
Created March 2, 2021 02:19
OpenShift Cron job to backup etcd database
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: etcd-backup
spec:
schedule: "0 0 * * *"
jobTemplate:
spec:
template:
@dmc5179
dmc5179 / bridge.sh
Created February 1, 2021 18:29
Creating a Bridge for VMs to communicate guest to host
#!/bin/bash
DEVICE=${1:-eth0}
BR_NAME=br-pub
ipv4_transfer=(
method
dns
addresses
gateway
@dmc5179
dmc5179 / snowball.sh
Last active January 24, 2024 15:19
OpenShift 4 on an AWS Snowball Edge
#!/bin/bash -xe
SNOWBALL_IP='192.168.1.240'
S3="aws --profile snowballEdge --region snow --endpoint https://${SNOWBALL_IP}:8443 --ca-bundle /etc/pki/ca-trust/source/anchors/sbe.crt s3"
EC2="aws --profile snowballEdge --region snow --endpoint https://${SNOWBALL_IP}:8243 --ca-bundle /etc/pki/ca-trust/source/anchors/sbe.crt ec2"
BUCKET="redhat-dan"
IGN_CONFIGS='/home/danclark/openshift_clusters/snow/'
IGN_BASE='/home/danclark/openshift_clusters/install-config.yaml'
@dmc5179
dmc5179 / clair_export_import.sh
Created November 12, 2020 02:49
Clair export import
#!/bin/bash -x
QUAY_NAMESPACE='quay-enterprise'
CLAIR_POSTGRES_POD=$(oc get -n ${QUAY_NAMESPACE} pods | grep clair-postgres | awk -F\ '{print $1}')
echo "POD: ${CLAIR_POSTGRES_POD}"
oc rsh -n ${QUAY_NAMESPACE} ${CLAIR_POSTGRES_POD} /bin/sh -c "pg_dump -U postgres -a -t feature -t keyvalue -t namespace -t schema_migrations -t vulnerability -t vulnerability_fixedin_feature clair" > clair_vulnerability.sql
@dmc5179
dmc5179 / quay_fips_deploy.sh
Last active November 11, 2020 22:32
Quay upstream on a FIPS enabled OpenShift 4.6 cluster
#!/bin/bash
WORKING_DIR=/tmp/
QUAY_NAMESPACE='quay-enterprise'
S3BUCKET=''
ACCESS_KEY=''
SECRET_KEY=''
mkdir -p "${WORKING_DIR}"
pushd "${WORKING_DIR}"
@dmc5179
dmc5179 / icsp.sh
Created September 29, 2020 18:24
Image Content Source Policy Machine Config
#!/bin/bash -xe
REGISTRY="registry.caas.cia.ic.gov:5000"
# Read in the new chrony.conf file
ICSP_B64=$(cat ./icsp.conf | sed "s|registry.example.com|${REGISTRY}|g" | base64 -w 0)
# Create a machine config to set the private registry for master nodes
rm -f ./99_master-private-registry-configuration.yaml
cat << EOF > ./99_master-private-registry-configuration.yaml
@dmc5179
dmc5179 / rhcos_ami.sh
Created September 2, 2020 00:55
Importing RedHat CoreOS RAW Disk image into AWS to create an AMI
#!/bin/bash -xe
RHCOS_VERSION="4.5.6"
RHCOS_TMP="/tmp"
S3_BUCKET="mybucket"
# Change to the temporary directory
pushd "${RHCOS_TMP}"
# NOTE: Uncomment the curl command if you need to download the disk
@dmc5179
dmc5179 / openshift4-mirror.sh
Last active October 22, 2024 17:02
Mirroring OpenShift 4 Required Images and RedHat Operator Hub Images
#!/bin/bash -xe
export OCP_RELEASE="4.5.4"
export ARCHITECTURE="x86_64"
export LOCAL_REG='localhost:5000'
export LOCAL_REPO='ocp4/openshift4'
export LOCAL_REG_INSEC='true'
export UPSTREAM_REPO='openshift-release-dev'
export OCP_ARCH="x86_64"
# Directory where OCP images are written to or read from
# When mirroring to disk
@dmc5179
dmc5179 / Dockerfile.rhel
Last active October 7, 2022 14:31
Dockerfile to build Docker registry on RHEL UBI Images
FROM registry.redhat.io/ubi8/go-toolset:latest AS build
ENV DISTRIBUTION_DIR /opt/app-root/src/go/src/github.com/docker/distribution
ENV BUILDTAGS include_oss include_gcs
ENV GOPATH /opt/app-root/src/go
ENV GOBIN /usr/lib/golang/bin
ARG GOOS=linux
ARG GOARCH=s390x