Skip to content

Instantly share code, notes, and snippets.

View bentito's full-sized avatar

Brett Tofel bentito

  • Red Hat
  • Shelburne, VT
View GitHub Profile
@bentito
bentito / gist:3c64e21d3d0ad6f121b6de3c4cb81d4e
Last active December 10, 2020 21:50
Hadoop + Hive Build/Runtime issues for Metering Operator -- trying to get the tip of Hadoop 3.3 branch and latest Hive master (Oct 15, 2020) to work to see if will fix a bug related to S3 bucket contents deletion
│ Exception in thread "main" 2020-10-13T17:23:10.464510059Z java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V2020-10-13T17:23:10.464518738Z │
│ at org.apache.hadoop.conf.Configuration.set(Configuration.java:1382)2020-10-13T17:23:10.464616395Z │
│ at org.apache.hadoop.conf.Configuration.set(Configuration.java:1363)2020-10-13T17:23:10.464630106Z │
│ at org.apache.hadoop.mapred.JobConf.setJar(JobConf.java:536)2020-10-13T17:23:10.464669465Z │
│ at org.apache.hadoop.mapred.JobConf.setJarByClass(JobConf.java:554)
@bentito
bentito / mysql_metering.md
Last active March 10, 2021 20:37
getting metering 4.6 running on 4.7 cluster with MySQL 5.7 backing store for Hive

where the namespace I will run metering in is btofel:

oc new-app -n btofel -e MYSQL_USER=mysql -e MYSQL_PASSWORD=password -e MYSQL_DATABASE=hive_metastore -e MYSQL_ROOT_PASSWORD=password  mysql:5.7
@bentito
bentito / graphholder.js
Created April 30, 2021 19:56
Servicemesh Mermaid Graph
This file has been truncated, but you can view the full file.
Servicemeshoperator Graph from 4.7 RH Index
<svg id="mermaid-1619812178224" width="15456" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="11691.75" viewBox="0 0 15456 11691.75"><style>#mermaid-1619812178224{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-1619812178224 .error-icon{fill:#552222;}#mermaid-1619812178224 .error-text{fill:#552222;stroke:#552222;}#mermaid-1619812178224 .edge-thickness-normal{stroke-width:2px;}#mermaid-1619812178224 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-1619812178224 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-1619812178224 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-1619812178224 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-1619812178224 .marker{fill:#333333;stroke:#333333;}#mermaid-1619812178224 .marker.cross{stroke:#333333;}#mermaid-1619812178224 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-1619812178224 .label{font-family:"trebuchet ms",ve
@bentito
bentito / check_comma_sep_versions.py
Created July 14, 2021 21:10
Script for Python 3.z to check indexes for problematic comma-separated values
# Requires
# OPM, operator-sdk v1.8.0 or higher
# grpcurl, podman or docker, skopeo
import os
import json
import sqlite3
import subprocess
CONTAINER_TOOL = "docker"
@bentito
bentito / gist:1b852d20e8d8c17b3406be240e536b78
Last active August 27, 2021 15:40
Build Code Ready Containers - With OKD (commentable version)

Build Code Ready Containers - With OKD This Page Is A Work In Progress

Stay tuned for full instructions

One time setup

dnf -y module install virt
dnf -y install jq golang-bin gcc-c++ golang make zip wget git bash-completion libguestfs-tools virt-install
@bentito
bentito / gist:c72db53bc01a5f394d3dd4cfdc1220cd
Last active May 13, 2022 20:02
Building kind node-image for a given k8s tag
See comments to this gist for how to build a kind node-image for a given k8s tag
@bentito
bentito / opm-render-fbc-how-to.md
Last active June 29, 2022 15:47
Working with PR#748 operator-registry opm render output

From PR operator-framework/operator-registry#748 build this version of OPM then :

opm index prune --from-index registry.redhat.io/redhat/redhat-operator-index:v4.10 -c docker --packages cluster-logging

(will need to docker login redhat registry) then: docker push the pared down index, for ex:

@bentito
bentito / aws_sts_pod_id_webhook_steps.md
Last active March 16, 2023 19:33
AWS STS pod Identity webhook Steps

AWS STS pod Identity Steps

oc login -u kubeadmin -p zXqDV-wqxpa-YTV7N-hNpgV https://api.crc.testing:6443
oc get -n openshift-kube-apiserver cm -o json bound-sa-token-signing-certs | jq -r '.data["service-account-001.pub"]' > sa-signer-pkcs8.pub
bin/self-hosted-darwin -key "sa-signer-pkcs8.pub" | jq '.keys += [.keys[0]] | .keys[1].kid = ""' > "keys.json"
aws s3 mb s3://btofel-sts-test --profile redhat-openshift-dev
aws s3 cp keys.json s3://btofel-sts-test --profile redhat-openshift-dev --acl public-read
cp ~/hold_code/discovery.json . 
vi discovery.json (verify it has bucket URL params to match above)
aws s3 cp discovery.json s3://btofel-sts-test/.well-known/openid-configuration --profile redhat-openshift-dev --acl public-read
@bentito
bentito / steps-to-crc-dev.md
Last active March 20, 2023 16:51
Steps to be able to do local dev on OpenShift Local (CRC)

To enable faster dev process with OpenShift Local (CRC) where you can push dev images to the local internal registry included with OpenShift and pull those same images internally in the cluster you need to follow these steps:

Push images to OpenShift Local's image registry, must be labeled like:

REGISTRY=$(oc get route/default-route -n openshift-image-registry -o=jsonpath='{.spec.host}'); \
IMAGE_PUSH=$($REGISTRY/openshift/pod-identity-webhook:0.4) \

or simpler and actually working:

@bentito
bentito / sa_key_rotation_notes.md
Created March 21, 2023 16:23
SA Key Rotation Notes
cd ~/workspace/sa-key-rotation
cd jwks
go run jwks.go ../../aws-pod-identity-webhook/sa-signer-pkcs8.pub ../../cloud-credential-operator/new/serviceaccount-signer.public
cat keys.json
S3_BUCKET_NAME=btofel-sts-test &&  aws s3 cp keys.json s3://${S3_BUCKET_NAME} --profile redhat-openshift-dev --acl public-read
PRIVKEY=`base64 -i ../cloud-credential-operator/new/serviceaccount-signer.private`
PUBKEY=`base64 -i ../cloud-credential-operator/new/serviceaccount-signer.public`
oc patch secret next-bound-service-account-signing-key -n openshift-kube-apiserver-operator --type=json -p '[{"op":"replace","path":"/data/service-account.key","value":"'"$PRIVKEY"'"},{"op":"replace","path":"/data/service-account.pub","value":"'"$PUBKEY"'"}]'