Skip to content

Instantly share code, notes, and snippets.

View Miciah's full-sized avatar

Miciah Dashiel Butler Masters Miciah

  • Red Hat, Inc.
  • North Carolina
View GitHub Profile
@Miciah
Miciah / go-template-mode.el
Created December 12, 2023 22:45 — forked from anonymous/go-template-mode.el
Go template mode
;;; go-template-mode.el --- Major mode for Go template language
;;; Commentary:
;; 1) Copy this file somewhere in your Emacs `load-path'. To see what
;; your `load-path' is, run inside emacs: C-h v load-path<RET>
;;
;; 2) Add the following to your .emacs file:
;;
;; (require 'go-template-mode)
graph TB
    322[openshift/cluster-dns-operator#322] -- fixes --> 2095941[BZ#2095941]
    322 -- causes --> 5943[OCPBUGS-5943]
    113544[kubernetes/kubernetes#113544] -- causes --> 5943
    358[openshift/cluster-dns-operator#358] -- fixes --> 5943
    364[openshift/cluster-dns-operator#364] -- fixes --> 5943
    358 -- causes --> 13209[OCPBUGS-13209]
 15531[OCPBUGS-15531] -- causes --&gt; 13209
@Miciah
Miciah / test-route-validation.sh
Created July 15, 2022 21:14
Shell script to test the OpenShift Route API validation with an OpenShift cluster
#!/bin/bash
set -uo pipefail
expect_pass() {
rc=$?
if [[ $rc != 0 ]]
then
tput setaf 1
echo "expected success: $*, got exit code $rc"
@Miciah
Miciah / check-json-tags.go
Created November 26, 2021 18:21
Check the godoc for struct fields in type definitions in Go source code files in the current working directory and report whether the godoc for each field refers to the field by identifier or by json tag
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"strconv"
"strings"
)
@Miciah
Miciah / sanitize-haproxy-config.pl
Created November 19, 2021 01:23
Short Perl script to sanitize haproxy.config files
#!/bin/perl
# This script expects an haproxy.config file on standard input and writes out a
# "sanitized" haproxy.config file to standard output where potentially sensitive
# information has been replaced with sanitized values. At the end of the
# output, the script lists the substitutions that it performed.
#
# Specifically, this script sanitizes the following things:
#
# • backend names,
@Miciah
Miciah / route-subdomain.txt
Created November 3, 2021 01:04
Example of using route spec.subdomain
% # /msg @cluster-bot launch openshift/openshift-apiserver#254,openshift/cluster-ingress-operator#674,openshift/router#357
% oc get dnses.config/cluster -o 'jsonpath={.spec.baseDomain}{"\n"}'
ci-ln-c9vsmcb-72292.origin-ci-int-gce.dev.rhcloud.com
% cat ~/tmp/ingresscontroller-custom.yaml
apiVersion: operator.openshift.io/v1
kind: IngressController
metadata:
name: custom
namespace: openshift-ingress-operator
spec:
% cat ~/tmp/ingresscontroller-sharding-example/cluster-ingress-config.yaml
apiVersion: config.openshift.io/v1
kind: Ingress
metadata:
name: cluster
spec:
domain: apps.ci-ln-c5gx03b-f76d1.origin-ci-int-gce.dev.openshift.com
appsDomain: custom.ci-ln-c5gx03b-f76d1.origin-ci-int-gce.dev.openshift.com
% cat ~/tmp/ingresscontroller-sharding-example/default-ingresscontroller.yaml
apiVersion: operator.openshift.io/v1
@Miciah
Miciah / indent-go-template.awk
Last active March 30, 2021 21:33
AWK script to indent Go template actions
#!/bin/awk
# This AWK script indents actions in Go templates. The script only modifies
# indentation for lines that begin with any amount of indentation followed by
# "{{". The script also normalizes blanks within the action, so that "{{if
# foo}}" or "{{ if foo }}" becomes "{{ if foo }}". Minus signs (as in "{{-
# if foo}}") are skipped over and preserved. Comment-only actions are formatted
# as "{{/* comment */}}" or "{{- /* command */ -}}".
#
# Shortcomings:
% oc adm new-project hello-openshift
Created project hello-openshift
% oc -n hello-openshift create -f ~/src/github.com/openshift/origin/examples/hello-openshift/hello-pod.json
pod/hello-openshift created
% oc -n hello-openshift expose pod/hello-openshift
service/hello-openshift exposed
% INGRESS_DOMAIN="$(oc get ingress.config/cluster -o 'jsonpath={.spec.domain}')"
% oc -n hello-openshift create -f - <<EOF
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
@Miciah
Miciah / ssh-stunnel.yaml
Last active July 7, 2020 23:03
Example of configuring OpenSSH on OpenShift using stunnel and a passthrough route.
# This is an example for configuring a Kubernetes deployment to provide SSH
# access to an OpenShift cluster. The deployment runs OpenSSH and stunnel.
# SSH clients connect through an OpenShift passthrough route using stunnel.
#
# Example usage:
#
# Create a host key-pair for sshd:
#
# /bin/ssh-keygen -q -t rsa -f ssh_host_rsa_key -C '' -N ''
#