Skip to content

Instantly share code, notes, and snippets.

@DazWilkin
DazWilkin / gist:e4cfa4bf77b5775f13dc40ce376e5e96
Created August 11, 2018 00:02
Kubernetes Engine access and audit
[
{
"email": "[email protected]",
"method": [
"io.k8s.apps.v1.deployments.create",
"io.k8s.extensions.v1beta1.deployments.create"
]
},
{
"email": "system:unsecured",
@DazWilkin
DazWilkin / instance-ssh.role.yaml
Created August 10, 2018 18:25
Kubernetes Engine access and audit
description: instance_ssh
includedPermissions:
- compute.instances.get
- compute.instances.setMetadata
- compute.projects.get
- compute.zones.list
stage: ALPHA
@DazWilkin
DazWilkin / test.sh
Created August 6, 2018 19:24
kubectl hacking
#!/bin/bash
# Prerequisites
: "${PROJECT:?Expects PROJECT to be non-empty}"
: "${CONTEXT:?Expects CONTEXT to be non-empty}"
: "${NAMESPACE:?Expects NAMESPACE to be non-empty}"
NODE=$(\
kubectl get nodes \
--context=${CONTEXT} \
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
labels:
app: hellohenry
name: hellohenry
spec:
replicas: 1
FROM golang:1.10 as build
WORKDIR /go/src/app
COPY . .
RUN go get -d -v ./...
RUN go install -v ./...
FROM gcr.io/distroless/base
@DazWilkin
DazWilkin / main.go
Created July 25, 2018 22:16
Kubernetes All NodePorts
package main
import (
"flag"
"fmt"
"log"
"os"
"path/filepath"
"sync"
@DazWilkin
DazWilkin / useful.go
Created July 25, 2018 22:15
Kubernetes All NodePorts
package useful
type Node struct {
Left *Node
Right *Node
Value int32
}
// Permits us to have an empty tree
type Tree struct {
@DazWilkin
DazWilkin / main.go
Created July 25, 2018 21:32
Kubernetes All NodePorts
package main
import (
"flag"
"fmt"
"log"
"os"
"path/filepath"
"sort"
"sync"
@DazWilkin
DazWilkin / package.json
Created July 11, 2018 17:04
Google Cloud Storage "exploder"
{
"name": "gcs-exploder",
"version": "0.0.2",
"description": "Unzip zipped files stored to GCS",
"scripts": {
"start": "node app.js"
},
"author": "Your Name <[email protected]>",
"dependencies": {
"@google-cloud/storage": "1.7.0",
@DazWilkin
DazWilkin / index.js
Last active July 11, 2018 17:06
Google Cloud Storage "exploder"
/* globals exports, require */
/* jshint node: true */
/* jshint strict: false */
/* jshint esversion: 6 */
"use strict";
const crc32 = require("fast-crc32c");
const gcs = require('@google-cloud/storage')();
const stream = require("stream");
const unzipper = require("unzipper");