Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Jason Hall imjasonh

🏠
Working from home
View GitHub Profile
View go-containerregistry
$ cat pkg/**/*.go | sort | uniq -c | sort -n | tail -n 20
195 if err != nil {
201 import (
225 )
226 // http://www.apache.org/licenses/LICENSE-2.0
226 // Licensed under the Apache License, Version 2.0 (the "License");
226 // See the License for the specific language governing permissions and
226 // Unless required by applicable law or agreed to in writing, software
226 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
226 // You may obtain a copy of the License at
View cloud-run-migration.md

GCPing is a simple single-page website where you can find out the relative latency between your browser and multiple GCP regions. GCP manages data centers around the world, but which one is closest to you, or more importantly, your customers? GCPing can answer that.

GCPing is a 20% project, and for the four years since its inception it was backed by small f1-micro GCE VMs in each region, with a public IP address, and a static HTML and JavaScript frontend served from GCS.

Over time, new regions would come online, or basic maintenance and upgrades

@imjasonh
imjasonh / tarfs.go
Created Jan 13, 2021
Trying to plug a tar.Reader into fs.FS
View tarfs.go
package main
import (
"archive/tar"
"errors"
"io"
"io/fs"
"log"
"os"
"path/filepath"
@imjasonh
imjasonh / README.md
Last active Nov 22, 2020
Terraform config for GCPing
View README.md

Setup

Prerequisites: Install Terraform and ko

$ terraform init
$ terraform apply -var image=$(KO_DOCKER_REPO=gcr.io/gcping-1369 ko publish ./cmd/ping/)
@imjasonh
imjasonh / multi_write.go
Created Nov 2, 2020
remote.MultiWrite demo
View multi_write.go
package main
import (
"fmt"
"log"
"os"
"strings"
"time"
"github.com/google/go-containerregistry/pkg/authn"
@imjasonh
imjasonh / gcr-creds.yaml
Created Oct 2, 2020
GCR creds-updating Tekton sidecar
View gcr-creds.yaml
# Demonstrates a GCR creds-updating sidecar
# - The `creds-refresh` sidecar periodically fetches a Service Account auth
# token and uses it with `docker login` to authorize docker pushes to GCR.
# - The dind sidecar provides an ephemeral Docker daemon to run builds and
# store images before they're pushed.
# - The step periodically uses these credentials to push an image to GCR.
# $ kubectl create -f gcr-creds.yaml
# taskrun.tekton.dev/gcr-creds-9d7t7 created
View README.md

Testing GCE VM suspend/resume latency

time ./suspend-test.sh  &> output.txt

tl;dr

  • COS VM create takes ~10s
  • VM delete takes ~2m20s
@imjasonh
imjasonh / todos.md
Last active Jul 13, 2020
Custom Tasks TODOs
View todos.md
@imjasonh
imjasonh / README.md
Created Jun 24, 2020
Cloud Build custom task for Tekton
View README.md

Google Cloud Build for Tekton

Install

Install and configure ko.

ko apply -f cmd/cloudbuild/