Skip to content

Instantly share code, notes, and snippets.

View jleach's full-sized avatar

Jason C. Leach jleach

View GitHub Profile
@jleach
jleach / deploy.yaml
Created October 8, 2019 17:11
DigitalOcean PostgreSQL Deployment Manifest
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: test
name: postgres-data
labels:
app: postgres
spec:
accessModes:
- ReadWriteOnce
---
apiVersion: batch/v1
kind: Job
metadata:
name: pi
spec:
parallelism: 1
completions: 1
activeDeadlineSeconds: 1800
backoffLimit: 6
@jleach
jleach / gupload.js
Created December 12, 2022 19:48
Script to upload an APK to Google Play
#!/usr/bin/env node
// This script will upload to a Google Play release track. See
// the Google Developer API documentation reference here:
// https://developers.google.com/android-publisher/api-ref/rest
const { google } = require('googleapis');
const fs = require('fs');
const pjson = require('./package.json');
@jleach
jleach / Dockerfile
Created December 12, 2022 17:36
Andible runner image that will work for ARM64 and AMD64 architecture
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi8/ubi:latest
ENV TINI_VERSION=v0.19.0
ENV KUBESEAL_VERSION=v0.19.2
ENV KUSTOMIZE_VERSION=v4.5.7
ENV HELM_VERSION=v3.10.2
ARG TARGETARCH
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /bin/tini
ADD bin/entrypoint.sh /bin/entrypoint
@jleach
jleach / gist:7d51b6e00f3da09003411897d185a7fe
Created July 25, 2022 19:59
Caddy proxy that will block certain IP addresses
# Copyright 2021 The Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@jleach
jleach / how-to-idle-a-service.md
Last active June 14, 2022 21:18
How to Idle a Service in OpenShift

TL;DR

Sale down a service to zero pods, and have it scale backup up automatically when network traffic is detected with the oc idle <service> command.

How To

You can run the oc idle <service> on a service to have OpenShift scale it to zero pods. When network traffic is detected OpenShift will scale up the deployment.

@jleach
jleach / imagemgmt.md
Last active September 11, 2020 21:12
Image Management Strategy

The Problem

As part of the OCP Security Project the Platform Services (PS) team recognized that many of the images in the openshift namespace are not actively maintained. This is problematic because they are used by other teams leading to the propagation of security vulnerabilities; this will cause widespread security issues that will not be manageable when Aqua is put in play.

The Solution

Too greatly improve our security posture while not making our customers lives overly complicated or negatively impacting the platforms usability will require thinking about image management differently. Rather than one vast dumping ground for images, curated or not, we’ll use the following:

@jleach
jleach / gist:67bbdde576a0c61b5d262944da24cd27
Created June 11, 2019 04:05
Traefik ConfgMap on DigitalOcean k8s
apiVersion: v1
kind: ConfigMap
metadata:
name: traefik-conf
namespace: kube-system
labels:
k8s-app: traefik-ingress-controller
data:
traefik.toml: |
debug = true
@jleach
jleach / daemonset.yaml
Created June 11, 2019 04:03
Traefik as a Daemon Set on a DigitalOcean k8s cluster
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
annotations:
labels:
k8s-app: traefik-ingress-controller
name: traefik-ingress-controller
namespace: kube-system
spec:
selector:
@jleach
jleach / .swift
Created April 19, 2016 19:24
Create a bar chart with iOS Charts.
internal func bodyStateBarChartFromDate(fromDate: NSDate = NSDate(timeIntervalSinceReferenceDate: NSTimeInterval(0)), toDate: NSDate = NSDate(), unit: NSCalendarUnit = .Day) -> BarChartView {
print ("start = \(fromDate), end = \(toDate)")
let chartView = BarChartView()
// Build the chart view data
let data = buildHeartRateDataFromDate(fromDate, toDate: toDate, unit: unit)
if data.count == 0 {