Skip to content

Instantly share code, notes, and snippets.

View sjenning's full-sized avatar

Seth Jennings sjenning

  • Red Hat
  • Austin, TX
View GitHub Profile
#!/bin/bash
set -eux
HC_NAMESPACE=sjenning
HC_NAME=sjenning-mgmt
NP_NAME=sjenning-mgmt-us-east-1a
IGNITION_ROUTE=$(oc get route -n $HC_NAMESPACE-$HC_NAME ignition-server -ojsonpath='{.status.ingress[0].host}')
NODEPOOL_TOKEN_SECERT=$(oc get secret | cut -f1 -d' ' | grep ^token-$NP_NAME)
{
"kind": "AuthenticationConfiguration",
"apiVersion": "apiserver.k8s.io/v1alpha1",
"jwt": [
{
"issuer": {
"url": "https://login.microsoftonline.com/fa5d3dd8-b8ec-4407-a55c-ced639f1c8c5/v2.0",
"audiences": [
"fdd45692-2aa8-4c30-b472-b86b84e5ed1d"
],
@sjenning
sjenning / main.go
Last active December 21, 2022 17:05
Bitwarden JSON encoder
package main
import (
"bufio"
"encoding/json"
"log"
"os"
"strings"
)

hypershift create cluster aws --endpointAccess=PublicAndPrivate --external-dns-domain=service.ci.hypershift.devcluster.openshift.com

  services:
  - service: APIServer
    servicePublishingStrategy:
      route:
        hostname: api-sjenning-guest.service.ci.hypershift.devcluster.openshift.com
      type: Route
  - service: OAuthServer
apiVersion: v1
kind: Namespace
metadata:
name: sjenning
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: hypershift
namespace: sjenning
@sjenning
sjenning / extract-ignition.sh
Created April 28, 2022 13:15
Script for extracting ignition for a nodepool in Hypershift
#!/bin/bash
set -eux
NODEPOOL=${NODEPOOL:-'example'}
SECRET=$(oc get secret | grep ^token-${NODEPOOL} | cut -f1 -d' ')
TOKEN=$(oc get secret ${SECRET} -ojsonpath='{.data.token}')
IGNPOD=$(oc get pod | grep ignition-server | cut -f1 -d' ')
oc rsh ${IGNPOD} /bin/curl --insecure -H "Accept: application/vnd.coreos.ignition+json; version=3.2.0" -H "Authorization: Bearer ${TOKEN}" -k https://127.0.0.1:9090/ignition | jq > ${NODEPOOL}.ign
@sjenning
sjenning / aws-private-clusters.md
Last active December 1, 2021 15:16
Deploying AWS Private Cluster with Hypershift

Deploying AWS Private Cluster with Hypershift

Create a hypershift-operator IAM user in the management account

NOTE: An IAM Role can also be used but this is the simpliest method to document

Create the policy document

# cat << EOF >> policy.json
{
@sjenning
sjenning / oc-nuke
Last active February 12, 2021 19:23
Remove Kubernetes namespaces with prejudice
#!/bin/bash
# This script is a kubectl/oc plugin that will start namespace deletion,
# watch the namespace conditions for resources blocking on finalizers,
# and remove those finalizers from the blocking resources
# TODO: Does not yet work against core resource types. The regex doesn't get them.
NAMESPACE=$1
if ! oc get ns ${NAMESPACE} &>/dev/null; then
@sjenning
sjenning / heb-to-go.sh
Last active September 5, 2021 16:24
Check for HEB curbside availability
#!/bin/bash
#set -eux
TOKEN=""
ID=""
STATE_FILE="/root/heb-to-go/.state"
#curl https://api.telegram.org/bot$TOKEN/getUpdates | jq .message.chat.id
notify() {
@sjenning
sjenning / upstream-kubelet-backports.sh
Created March 11, 2020 15:42
Monitor upstream kubelet backports
#!/bin/sh
set -eu
cd $GOPATH/src/k8s.io/kubernetes
for release in "1.15" "1.16" "1.17"; do
echo "=== v${release} ==="
git log --oneline --no-merges v${release}.0..upstream/release-${release} -- pkg/kubelet cmd/kubelet
done