Skip to content

Instantly share code, notes, and snippets.

@dmc5179
dmc5179 / openshift-api-example.md
Created January 22, 2022 17:05
Calling the OpenShift API from inside a pod
  • Create a user for the pods that will call the OpenShift API
oc create sa rest-api-user
  • Assign the user privileges. Note: This is an example, a lesser set of permissions should be used where possible
oc policy add-role-to-user admin -z rest-api-edit
@dmc5179
dmc5179 / source-strategy.yaml
Created August 4, 2021 10:05
OpenShift 4 Build Config using the Source Strategy
---
kind: ImageStream
apiVersion: image.openshift.io/v1
metadata:
name: myapp
namespace: mynamespace
spec: {}
---
apiVersion: build.openshift.io/v1
@dmc5179
dmc5179 / docker-strategy.yaml
Created August 4, 2021 10:03
OpenShift 4 Build Config using the Docker Strategy
---
kind: ImageStream
apiVersion: image.openshift.io/v1
metadata:
name: myapp
namespace: mynamespace
spec: {}
---
kind: BuildConfig
@dmc5179
dmc5179 / openshift4-cronjob-is
Created May 18, 2021 02:32
CronJob in OpenShift 4 using an image stream named alp in the project httpd-test
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: hello
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
@dmc5179
dmc5179 / httpd_server_deployment_is.yaml
Created May 7, 2021 14:23
https_server_deployment_is
---
kind: ImageStream
apiVersion: image.openshift.io/v1
metadata:
name: httpd
namespace: httpd-test
spec: {}
#---
#apiVersion: v1
@dmc5179
dmc5179 / httpd_server_deployment.yaml
Created April 29, 2021 16:43
Example OpenShift 4 Deployment of an Apache HTTPD server
#---
#apiVersion: v1
#kind: PersistentVolumeClaim
#metadata:
# name: httpd-pv-claim
# labels:
# app: httpd-frontend
#spec:
# accessModes:
# - ReadWriteOnce
@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'