Skip to content

Instantly share code, notes, and snippets.

@dmc5179
dmc5179 / ols-config.yaml
Created January 28, 2025 18:48
OpenShift Lightspeed for Disconnected systems
apiVersion: ols.openshift.io/v1alpha1
kind: OLSConfig
metadata:
name: cluster
spec:
llm:
providers:
- credentialsSecretRef:
name: credentials
models:
@dmc5179
dmc5179 / openshift_disconnected_vpc_cf.yaml
Created December 28, 2024 19:52
AWS Cloudformation template to create a disconnected environment for OpenShift testing
AWSTemplateFormatVersion: 2010-09-09
Description: Template for creating a disconnected VPC in up to 3 AZs
Parameters:
VpcCidr:
AllowedPattern: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(1[6-9]|2[0-4]))$
ConstraintDescription: CIDR block parameter must be in the form x.x.x.x/16-24.
Default: 10.0.0.0/16
Description: CIDR block for VPC.
@dmc5179
dmc5179 / devfile.yaml
Created December 12, 2024 01:01
OpenShift DevSpaces DevFile for Continue Code Assist
schemaVersion: 2.1.0
metadata:
name: codeassist-images
attributes:
controller.devfile.io/storage-type: ephemeral
controller.devfile.io/scc: container-build
.continue/config.json: |
{
"allowAnonymousTelemetry": false,
"models": [
@dmc5179
dmc5179 / rescue.sh
Created October 25, 2024 00:59
RHEL 8 Live ISO
# enable network
nmcli con show
nmcli con up enp1s0
mkdir /mnt/tmpfs
mount -o size=8G -t tmpfs none /mnt/tmpfs
# Enable subscription
subscription-manager register
# or copy in /etc/yum.repos.d files for satellite to base system
@dmc5179
dmc5179 / openshift4-reset-kubeadmin.yaml
Created October 23, 2024 00:19
Ansible playbook to reset the kubeadmin password of an OpenShift 4 cluster
---
# https://access.redhat.com/solutions/4845381
# https://access.redhat.com/solutions/6985513
# ##############
# https://access.redhat.com/solutions/5286371
- hosts: all
vars:
ansible_ssh_private_key_file: /home/ec2-user/.ssh/id_rsa_ocp.pem
#ansible_connection: ssh
ansible_user: core
@dmc5179
dmc5179 / agent-config.yaml
Created October 22, 2024 15:35
OpenShift 4 Agent Based Installer
apiVersion: v1alpha1
kind: AgentConfig
metadata:
name: agent-config
rendezvousIP: 192.168.1.80 # For a SNO cluster this is the same IP as the server. For a non-SNO install, pick an IP of one of the control plane servers
hosts:
- hostname: master-0
role: master
interfaces:
- name: eno1 # This doesn't need to be the actual interface name, it has to match the names below
@dmc5179
dmc5179 / README.md
Last active September 19, 2024 00:18
OpenShift AWS EFS Deployment
  • Create the IAM role for EFS and attach to control plane and worker nodes (can just be worker nodes)
  • Deploy the EFS Operator from Operator Hub
  • Install the EFS CSI Driver with efs-cluster-csi-driver.yaml
  • create the EFS Storage Class with efs-sc.yaml example (Need to change fields here for your EFS)
@dmc5179
dmc5179 / oc-mirror-faster.sh
Last active August 9, 2024 02:47
Script to output information about OpenShift operators
#!/bin/bash
# Usage: ./extract.sh --catalog=registry.redhat.io/redhat/redhat-operator-index:v4.15 --package=advanced-cluster-management --channel=release-2.11
# Usage with cache: ./extract.sh --catalog=registry.redhat.io/redhat/redhat-operator-index:v4.15 --package=advanced-cluster-management --channel=release-2.11 --cache=true
CACHE="false"
# Default configs directory
CONFIGS_DIR="/configs"
for i in "$@"; do
@dmc5179
dmc5179 / fix-broken-index.sh
Created July 2, 2024 12:33
Script to fix an operator index container image created by oc-mirror with an improperly set umask
#!/bin/bash -xe
# This script is indexed to "fix" an operator index image created by the oc-mirror tool where
# the /configs and files under /configs are created with root only read permissions.
# When /configs and the files under that directory can only be read by root, the operator index container
# will crash when running on OpenShift as the non-root users that the index runs as will be unable
# to read the operator index configuration data under /configs
# Change INDEX to the index container image that needs to be fixed
INDEX="ip-10-0-185-96.us-east-2.compute.internal:8443/redhat/redhat-operator-index:v4.15"
@dmc5179
dmc5179 / 98-lso-partition.bu
Created June 6, 2024 13:27
OpenShift agent single node custom partitions
variant: openshift
version: 4.15.0
metadata:
labels:
machineconfiguration.openshift.io/role: master
name: 98-lso-partition
storage:
disks:
- device: /dev/sda # This can also be written as /dev/sda or /dev/nvme0n1 if you know the name of the disk device itself. It's recommended to use by-id in case the device changes names but not required. Make sure this matches what is in the install-config.yaml device
partitions: