Skip to content

Instantly share code, notes, and snippets.

View jkeam's full-sized avatar
🍻

Jon Keam jkeam

🍻
View GitHub Profile
@jkeam
jkeam / install-ruby.sh
Last active August 14, 2025 02:32
Installing Ruby using Ruby Install
#!/bin/bash
# ubuntu
ruby-install ruby 3.4.5 -- --with-openssl-lib=/usr/lib/x86_64-linux-gnu
# mac
# openssldir=$(brew --prefix openssl)
# something like /opt/homebrew/opt/openssl@3
# fedora
# openssldir=/usr/lib64
@jkeam
jkeam / openshift-login-vm-on-cluster.sh
Created July 1, 2025 02:03
Log into the OpenShift cluster using the CLI from a VM running on OpenShift Virtualization.
#!/bin/bash
oc login --token=sha256~randomstuff --server=https://apiserver.openshift-kube-apiserver.svc.cluster.local
@jkeam
jkeam / scansettingbinding-partial.yaml
Created June 23, 2025 23:29
Just the profiles of a ScanSettingBinding
profiles:
- apiGroup: compliance.openshift.io/v1alpha1
kind: Profile
name: ocp4-stig-v2r2
- apiGroup: compliance.openshift.io/v1alpha1
kind: Profile
name: rhcos4-stig-v2r2
- apiGroup: compliance.openshift.io/v1alpha1
kind: Profile
name: ocp4-stig-node-v2r2
@jkeam
jkeam / imageset-config.yaml
Created June 23, 2025 15:21
Imagset Config
kind: ImageSetConfiguration
apiVersion: mirror.openshift.io/v2alpha1
mirror:
platform:
# Uncommenting the following two lines and updating to reflect your specific architecture, will help decrease the size of the mirrored content.
# architectures:
# - amd64
channels:
- type: ocp
@jkeam
jkeam / gitops-application-set.yaml
Created June 17, 2025 01:51
ArgoCD GitOps ApplicationSet Example
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: guestbook
spec:
generators:
- list:
# Parameters are generated based on this cluster list, to be
# substituted into the template below.
elements:
@jkeam
jkeam / clusterinstance-sno.yaml
Last active June 17, 2025 01:40
ZTP ClusterInstance SNO Example
apiVersion: siteconfig.open-cluster-management.io/v1alpha1
kind: ClusterInstance
metadata:
name: "sno3"
namespace: "sno3"
spec:
additionalNTPSources:
- "2600:52:7:59::11"
baseDomain: "inbound.bos2.lab"
clusterImageSetNameRef: "openshift-4.18.0-ec.4"
@jkeam
jkeam / sqlalchemy-orm-example.py
Created April 7, 2025 17:05
Example of creating associations using SQLAlchemy
from typing import List, Optional
from sqlalchemy import String, ForeignKey, create_engine
from sqlalchemy.orm import Mapped, Session, mapped_column, relationship, DeclarativeBase
class Base(DeclarativeBase):
pass
class User(Base):
__tablename__ = "user_account"
id: Mapped[int] = mapped_column(primary_key=True)
@jkeam
jkeam / install-instructlab.sh
Created March 18, 2025 02:43
Install Instructlab
#!//bin/bash
# setup env
python3.11 -m venv --upgrade-deps venv
source ./venv/bin/activate
pip install --upgrade pip
# remove llama_cpp_python
pip uninstall llama-cpp-python -y
pip cache remove llama_cpp_python
@jkeam
jkeam / imageset-additional-images-helper.py
Created October 20, 2024 21:27
Grabs the additional images required for a given OpenShift release and puts it in a format that can be pasted into an imageset.yaml
from urllib.request import urlopen
from re import sub
def read(version:str) -> None:
with urlopen(f"https://mirror.openshift.com/pub/openshift-v4/clients/ocp/{version}/release.txt") as f:
contents = f.read().decode('utf-8').split('\n')
for content in contents:
if 'quay.io' in content:
line = sub(r"^\s*[\w-]+\s*", "", content)
print(f" - name: {line}")
@jkeam
jkeam / shutdown-compact-openshift.sh
Created September 23, 2024 19:56
Script to gracefully shutdown a compact OpenShift cluster.
#!/bin/bash
# This script tries to gracefully shutdown a 3-node / "compact" OCP cluster
# There seems to be some coordination required when shutting down
# when ODF, Logging, and Virtualization are deployed.
CLUSTER_NAME="your-cluster-name-here"
OC_BIN=/usr/local/bin/oc
KUBECONFIG=~/.kube/config
OC_CMD="$OC_BIN --kubeconfig=$KUBECONFIG"