Skip to content

Instantly share code, notes, and snippets.

View rjhowe's full-sized avatar

Ryan Howe rjhowe

  • Red Hat
  • Raleigh
View GitHub Profile
@rjhowe
rjhowe / haproxy-config.template
Created October 4, 2019 19:18
v3.11 Template remove default "ECDHE-ECDSA-CHACHA20-POLY1305" cipher.
{{/*
haproxy-config.cfg: contains the main config with helper backends that are used to terminate
encryption before finally sending to a host_be which is the backend that is the final
backend for a route and contains all the endpoints for the service
*/}}
{{- define "/var/lib/haproxy/conf/haproxy.config" }}
{{- $workingDir := .WorkingDir }}
{{- $defaultDestinationCA := .DefaultDestinationCA }}
{{- $dynamicConfigManager := .DynamicConfigManager }}
{{- $router_ip_v4_v6_mode := env "ROUTER_IP_V4_V6_MODE" "v4" }}
@rjhowe
rjhowe / reload-haproxy
Created September 4, 2019 15:31
reload-haproxy
#!/bin/bash
set -o nounset
config_file=/var/lib/haproxy/conf/haproxy.config
pid_file=/var/lib/haproxy/run/haproxy.pid
haproxy_conf_dir=/var/lib/haproxy/conf
readonly max_wait_time=30
readonly timeout_opts="-m 1 --connect-timeout 1"
readonly numeric_re='^[0-9]+$'
@rjhowe
rjhowe / awsocp.md
Last active August 28, 2019 16:44
OpenShift 4 IPI aws cli cheatsheet

OpenShift AWS Cheat Sheet

Recreate metadata.json

Steps needed

Move metadata.json to home dir as a dot file

cp metadata.json ~/.metadata.json
AWSTemplateFormatVersion: 2010-09-09
Description: Template for Openshift Bastion (EC2 bastion instance)
Parameters:
ClusterName:
Description: A short, representative cluster name to use for hostnames, etc.
Type: String
RhcosAmi:
Description: Current RHEL CoreOS AMI to use for boostrap
Type: AWS::EC2::Image::Id
#!/bin/bash
#set +x
gitdir="${HOME}/git/"
ocp_go_repos=(origin
installer
api
cluster-image-registry-operator
cluster-monitoring-operator
@rjhowe
rjhowe / etcd_downgrade_and_restore.md
Last active January 13, 2022 19:01
Downgrading from etcd 3.3 to 3.2 and retoring etcd on OpenShift 3.10 and 3.11
# ETCD_ALL_ENDPOINTS=` etcdctl3 --write-out=fields   member list | awk '/ClientURL/{printf "%s%s",sep,$3; sep=","}'`
# etcdctl3 --endpoints=$ETCD_ALL_ENDPOINTS  endpoint status  --write-out=table 

Capture a snapshot:

# etcdctl3 snapshot save /tmp/snapshot.db 
#!/usr/bin/python
#
# List all Namespaces (works for Ubuntu 12.04 and higher)
#
# (C) Ralf Trezeciak 2013-2014
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@rjhowe
rjhowe / certcheck.sh
Last active November 22, 2018 19:16
OpenShift Cert Issuer Check
#!/bin/bash
opensslcmd="openssl x509 -noout -issuer"
if [[ -d /etc/origin/master ]]; then
printf "%b%bOCP Master Certs%b\n" "\033[1m" "\033[33m" "\033[0;0m"
pushd /etc/origin/master/
for i in `ls *.crt`; do
echo $i
$opensslcmd -in $i
@rjhowe
rjhowe / openshift_master.py
Last active September 26, 2018 15:41
openshift_master.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Custom filters for use in openshift-master
'''
import copy
import sys
from ansible import errors
from ansible.parsing.yaml.dumper import AnsibleDumper
@rjhowe
rjhowe / etcd-ocp.md
Last active February 13, 2019 22:56

Alias Initial Setup

  • Docker
alias etcdctl3="docker run --rm --net=host -v /etc/etcd:/etc/etcd -e ETCDCTL_API=3 --entrypoint etcdctl registry.access.redhat.com/rhel7/etcd --cert /etc/etcd/peer.crt --cacert /etc/etcd/ca.crt --key /etc/etcd/peer.key --endpoints https://`hostname`:2379"

alias etcdctl2="docker run --rm --net=host -v /etc/etcd:/etc/etcd -e ETCDCTL_API=2 --entrypoint etcdctl registry.access.redhat.com/rhel7/etcd --cert-file /etc/etcd/peer.crt --ca-file /etc/etcd/ca.crt --key-file /etc/etcd/peer.key -C https://`hostname`:2379"