Skip to content

Instantly share code, notes, and snippets.

View rinormaloku's full-sized avatar

Rinor Maloku rinormaloku

View GitHub Profile
#!/usr/bin/env bash
number=$1
name=$2
region=$3
zone=$4
twodigits=$(printf "%02d\n" $number)
if [ -z "$3" ]; then
region=us-east-1
# go and find a deeply nested key with the name accessLog
jq '.. |."accessLog"? | select(. != null)'
"domains": [
"catalog.prod.svc.cluster.local"
],
"name": "catalog.prod.svc.cluster.local:80",
"routes": [
{
"match": {
"headers": [
{
"name": "x-dark-launch",
@rinormaloku
rinormaloku / delve-pilot.md
Last active February 9, 2022 11:48 — forked from stevenctl/delve-pilot.md
Debugging Pilot in K8S

Debugging Pilot with Delve

First build pilot with GCFLAGS="all=-n -l":

GCFLAGS="all=-N -l" DEBUG=1 HUB=docker.io/slandow TAG=slandow BUILD_IN_CONTAINER=1 make docker.pilot

Then we can wrap that image in one that includes delve:

kubectl --context=cluster1 create ns echo
kubectl --context=cluster1 label ns echo istio-injection=enabled
kubectl --context=cluster1 -n echo apply -f https://git.io/JyIRn
kubectl --context=cluster1 -n echo apply -f https://git.io/JyqPy
kubectl kubectl --context=mgmt apply -f - <<EOF
---
apiVersion: networking.enterprise.mesh.gloo.solo.io/v1beta1
kind: RateLimitServerConfig
metadata:
apiVersion: v1
kind: Service
metadata:
name: keycloak
labels:
app: keycloak
spec:
ports:
- name: http
port: 8080
apiVersion: v1
kind: Service
metadata:
labels:
app: echo-v2
name: echo-v2
spec:
ports:
- name: http
port: 8080
apiVersion: v1
kind: Service
metadata:
labels:
app: echo-v1
name: echo-v1
spec:
ports:
- name: http
port: 8080
@rinormaloku
rinormaloku / App.js
Last active December 26, 2020 20:29
[Authenticating requests with Bearer Token] for the article series Intro to Istio https://rinormaloku.com/istio-an-introduction/
analyzeSentence() {
fetch('/sentiment', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${auth.getAccessToken()}` // Access Token
},
body: JSON.stringify({ sentence: this.textField.getValue() })
})
.then(response => response.json())
@rinormaloku
rinormaloku / named-arguments.sh
Last active July 8, 2020 07:46
named arguments sample for bash
#!/bin/bash
#set -e
help() {
cat <<EOF
A minimalistic script to showcase named arguments in bash.
The following flags are required.
--req-arg If required arg is not specified execution is interrupted.