Skip to content

Instantly share code, notes, and snippets.

@jewzaam
jewzaam / ocp-groupResourceVerb.sh
Last active December 6, 2019 14:29
Script to scrape OCP API to get all groups + resources + verbs
#!/bin/bash
# /api
GROUP=""
for VERSION in `oc get --raw /api | jq -r .versions[] | sort`;
do
echo "- apiGroups:"
echo " - $GROUP"
for RESOURCE in `oc get --raw /api/${VERSION} | jq -r .resources[].name | sort`;
@jewzaam
jewzaam / Installing Hive.md
Last active March 7, 2019 18:01
Installing Hive

https://github.com/openshift/hive

# login to the target cluster with oc
go get sigs.k8s.io/kustomize
go get sigs.k8s.io/controller-tools
go get github.com/openshift/hive
cd $GOPATH/src/github.com/openshift/hive
make deploy
@jewzaam
jewzaam / _Prometheus scrape external endpoints.md
Last active October 11, 2018 02:41
Setup Prometheus to scrape external node-exporter

Setup Prometheus to scrape external node-exporter

This came out of an ansible role I was creating to monitor some external hosts that run node-exporter. I've since moved away from exposting node-exporter and am using prometheus pushgateway instead. This gist exists to capture what I learned.

How does it work?

Deploy the endpoint, service, and servicemonitor in the openshift-monitoring namespace. You should be able to deploy to another project but you'll maybe have problems with reading data. A couple of notes on that at the end

Ansible snippet to make this happen (I have not tested this). Assumes the host it runs on has ability to run oc commands against openshift-monitoring.

@jewzaam
jewzaam / README.md
Last active September 7, 2018 18:33
API Key Authentication for Open REST API

Sometimes you need simple authentication in front of a REST endpoint that doesn't provide authentication. In this gist I outline how to do this with API Gateway and Lambda.

The original goal with this work was to secure a deployment of Prometheus node_exporter. I have since found the configuration for the prometheus-operator does not support setting custom headers, only Authorization. See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#%3Cscrape_config%3E

What was done:

. Create EC2 instance (sg allows 9100) . Install node_exporter on :9100 . Create Lambda function . Create API Gateway

@jewzaam
jewzaam / OctoPrint-MultiColors Configuration.md
Last active April 8, 2018 00:25
OctoPrint-MultiColors Configuration

https://github.com/MoonshineSG/OctoPrint-MultiColors

I slice with Slic3r and have enabled verbose GCODE. I found GOCDE to move the hot end off the print at a layer change (reference eludes me right now). Wanted to share what I did with this OctoPrint plugin for my setup.

The trick is to get the retract, extrucsion reset, and Z change captured in a group so you can replay it.

My regex: (.*layer [(]{0}[)])\n(G1 X.*move.*)\n(G1 E([\d.]*) F([\d.]*)[; ]*.*unretract)

My GCODE:

@jewzaam
jewzaam / find.json
Last active November 29, 2016 15:49
Self reference on array contents. Note the reference in the metadata may be wrong. This doesn't work yet, so the exact query hasn't been worked out yet.
{
"objectType": "selfReferenceArrayContainsArray",
"projection": [
{
"field": "*",
"include": true,
"recursive": true
},{
"field": "test_reference",
"include": true,
sed 's/\([ ]*\)\([^ :]*\)[ ]*:[ ]*\([^,]*\).*/\1"\2": "\3",/g' | sed 's/"{",/{/g' | sed 's/"\[",/[/g' | sed 's/""/"/g'
@jewzaam
jewzaam / README.md
Last active April 25, 2016 15:00 — forked from Ulrhol/README.md

##Yet another gist to provide Graphite support for Dashing Pull data from Graphite and present in Dashing. Support both graph and number widget.

Quick install:

dashing install efffa657c31e244131e3

Set the graphite name and names of metrics in jobs/graphite.rb

@jewzaam
jewzaam / gist:a9a3a3d585a97688d5e9
Created January 5, 2015 18:48
Example JSON Schema for lightblue metadata: country/1.0.0
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "JSON schema for entity 'country' version '1.0.0' (see https://raw.githubusercontent.com/lightblue-platform/openshift-lightblue-cart/master/versions/shared/template/src/main/data/country.json)",
"properties": {
"createdBy": {
"type": "string",
"description": "Identifies who created this entity. Ideally, a login. Worst case an ID from some other system."
},
"creationDate": {
@jewzaam
jewzaam / gist:6b6ac2a66fd73971b5ab
Last active August 29, 2015 14:11
deploy openshift-lightblue-cart via REST API
# setup
OS_USERNAME=<user>
OS_PASSWORD=<password>
OS_GEAR_SIZE="medium"
# verify you can get application list
curl -k -X GET https://openshift.redhat.com/broker/rest/domain/lightblue/applications --user $OS_USERNAME:$OS_PASSWORD
# delete existing app, get ID from app list above
curl -k -X DELETE https://openshift.redhat.com/broker/rest/application/<ID> --user $OS_USERNAME:$OS_PASSWORD