Skip to content

Instantly share code, notes, and snippets.

View bjethwan's full-sized avatar

Bipin Jethwani bjethwan

  • Temenos
  • India
View GitHub Profile
@bjethwan
bjethwan / mutate-and-validate.md
Last active July 13, 2020 15:13
Deploying both validating and mutating webhook configs together for open policy agent (OPA) policies

Example setup for making OPA work for both validating and mutating policies.

This would require two webhook (dynamic admission controller) configurations - MutatingWebhookConfiguration & ValidatingWebhookConfiguration

Replace the caBundle field below with ca cert you have used for generating certs for OPA.

Check the att in the path. It will be used later in the ConfigMap carrying OPA config.

kind: MutatingWebhookConfiguration
apiVersion: admissionregistration.k8s.io/v1beta1
metadata:
 name: opa-mutating-webhook
@bjethwan
bjethwan / k8s-api-server-certs
Last active April 13, 2019 00:32
Dump client k8s certificates from your kubeconf for use in remote k8s with Kubernetai CoreDNS Plugin
# Dump certs (client.crt, client.key, & ca.crt) in a directory called c3certs
export KUBECONFIG_PATH=/home/ec2-user/.kube/config
sudo cat $KUBECONFIG_PATH | grep client-certificate-data | cut -f2 -d : | tr -d ' ' | base64 -d > c3certs/client.crt
sudo cat $KUBECONFIG_PATH | grep client-key-data | cut -f2 -d : | tr -d ' ' | base64 -d > c3certs/client.key
sudo cat $KUBECONFIG_PATH | grep certificate-authority-data | cut -f2 -d : | tr -d ' ' | base64 -d > c3certs/ca.crt
# Load the above certificates as ConfigMap in Kubernetes running with CoreNS Kubernetai plugin
kubectl -n kube-system create cm c3certs --from-file=/home/ec2-user/c3certs
IPVS on AWS EC2
ip_vs & ipvsadm
Note: ipvsadm is just the cli tools for interacting with the IP virtual server table in the kernel.
"ip_vs" is the kernel module that does the actual connection manipulating.
ipvsadm command options:
Either long or short options are allowed.
--add-service -A add virtual service with options
@bjethwan
bjethwan / cluster2.log
Created February 6, 2019 17:37
cilium clustermesh cluster2 logs
level=info msg=" --access-log=''" subsys=daemon
level=info msg=" --agent-labels=''" subsys=daemon
level=info msg=" --allow-localhost='auto'" subsys=daemon
level=info msg=" --auto-direct-node-routes='false'" subsys=daemon
level=info msg=" --auto-ipv6-node-routes='false'" subsys=daemon
level=info msg=" --bpf-compile-debug='false'" subsys=daemon
level=info msg=" --bpf-ct-global-any-max='262144'" subsys=daemon
level=info msg=" --bpf-ct-global-tcp-max='1000000'" subsys=daemon
level=info msg=" --bpf-root=''" subsys=daemon
level=info msg=" --cgroup-root=''" subsys=daemon
@bjethwan
bjethwan / cluster1.log
Created February 6, 2019 17:36
cilium clustermesh cluster1 logs
level=info msg=" --access-log=''" subsys=daemon
level=info msg=" --agent-labels=''" subsys=daemon
level=info msg=" --allow-localhost='auto'" subsys=daemon
level=info msg=" --auto-direct-node-routes='false'" subsys=daemon
level=info msg=" --auto-ipv6-node-routes='false'" subsys=daemon
level=info msg=" --bpf-compile-debug='false'" subsys=daemon
level=info msg=" --bpf-ct-global-any-max='262144'" subsys=daemon
level=info msg=" --bpf-ct-global-tcp-max='1000000'" subsys=daemon
level=info msg=" --bpf-root=''" subsys=daemon
level=info msg=" --cgroup-root=''" subsys=daemon
DELIMITER //
CREATE PROCEDURE Whileloop()
BEGIN
DECLARE i INT DEFAULT 1;
WHILE i < 6 DO
SELECT POW(i, 2);
SET i = i + 1;
@bjethwan
bjethwan / convert-to-multi-broker-kafka.sh
Created March 8, 2018 04:12
Script to convert a single broker kafka instance to multi instance on single node for my demo at TMB...changing the boker.id, broker.port, and broker.log.dirs
#!/bin/bash
rm -rf mykafka
mkdir mykafka
cd mykafka
mkdir kafka-config
mkdir kafka-log0
mkdir kafka-log1
mkdir kafka-log2
cp /opt/kafka_2.12-1.0.0/config/server.properties kafka-config/server0.properties
cp /opt/kafka_2.12-1.0.0/config/server.properties kafka-config/server1.properties
@bjethwan
bjethwan / install-kafka.sh
Created March 8, 2018 04:08
Script for single node single broker apache kafka install
#!/bin/bash
sudo yum update -y
sudo yum install wget -y
sudo yum install java-1.8.0-openjdk-devel.x86_64 -y
mkdir mykafka
cd mykafka
mkdir kafka-config
mkdir kafka-log
wget http://www-us.apache.org/dist/kafka/1.0.0/kafka_2.12-1.0.0.tgz
tar -xzf kafka_2.12-1.0.0.tgz
@bjethwan
bjethwan / redis on ec2
Last active December 31, 2017 05:53
shell script to install redis on aws ec2 (amazon linux)
#!/bin/bash
sudo yum update -y
sudo yum install make -y
sudo yum install gcc -y
wget http://download.redis.io/releases/redis-4.0.6.tar.gz
tar xzf redis-4.0.6.tar.gz
cd redis-4.0.6
cd deps
make hiredis jemalloc linenoise lua geohash-int
cd ..
//This is from frmLoginController.js
define({
loginSuccess:function() {
var emailID = this.view.login.getUsername();
kony.store.setItem("USER_ID", emailID);
try {