This gist gives instructions to setup a Validating Admission Webhook or Mutating Admission Webhook in Kubernetes.
Heavy credits to
This gist gives instructions to setup a Validating Admission Webhook or Mutating Admission Webhook in Kubernetes.
Heavy credits to
#!/bin/bash | |
$IPT=/sbin/iptables | |
################# | |
# GENERIC INPUT # | |
################# | |
$IPT --policy INPUT DROP | |
# Drop invalid |
func ip2int(ip net.IP) uint32 { | |
if len(ip) == 16 { | |
return binary.BigEndian.Uint32(ip[12:16]) | |
} | |
return binary.BigEndian.Uint32(ip) | |
} | |
func int2ip(nn uint32) net.IP { | |
ip := make(net.IP, 4) | |
binary.BigEndian.PutUint32(ip, nn) |
package main | |
import ( | |
"fmt" | |
"log" | |
"os/user" | |
"path/filepath" | |
"strings" | |
apixv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" |
Hopefully helped another k8s newbie with the following. The question was, how do you update a single key in a secret in k8s? I don't know anything about secrets but I will probably want to know this in the future, so here we go.
First, to create a dummy secret:
apiVersion: v1
kind: Secret
metadata:
name: test-secret
data:
package main | |
import ( | |
"compress/gzip" | |
"io" | |
"net/http" | |
"strings" | |
) | |
// Gzip Compression |
// keepDoingSomething will keep trying to doSomething() until either | |
// we get a result from doSomething() or the timeout expires | |
func keepDoingSomething() (bool, error) { | |
timeout := time.After(5 * time.Second) | |
tick := time.Tick(500 * time.Millisecond) | |
// Keep trying until we're timed out or got a result or got an error | |
for { | |
select { | |
// Got a timeout! fail with a timeout error | |
case <-timeout: |
// some updates for https://rsmitty.github.io/Kubernetes-Events/ | |
// and http://blog.ctaggart.com/2016/09/accessing-kubernetes-api-on-google.html | |
import ( | |
"encoding/base64" | |
"fmt" | |
"log" | |
"net/http" | |
"time" |
package main | |
import ( | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/rand" | |
"crypto/sha256" | |
"encoding/base64" | |
"fmt" | |
"io" |
# first: | |
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
# go to /usr/local/lib and delete any node and node_modules | |
cd /usr/local/lib | |
sudo rm -rf node* |