Skip to content

Instantly share code, notes, and snippets.

View njhale's full-sized avatar

Nick Hale njhale

View GitHub Profile
@njhale
njhale / forkdir.go
Last active August 15, 2023 18:28
Clone a directory for the lifetime of a Go test
package forkdir
import (
"fmt"
"io"
"os"
"path/filepath"
"testing"
"github.com/acorn-io/z"
@njhale
njhale / get_candidates.sh
Created November 30, 2021 14:56
OLM Downstream Sync
#!/bin/bash
set -o errexit
set -o pipefail
num_commits=256
set +u
while getopts 'n:' flag; do
case "${flag}" in
@njhale
njhale / sync_staging.sh
Created July 21, 2021 19:52
Best effort cherry-pick OLM staging subtrees from remotes
#!/bin/bash
set +o posix # Enable for process substitution <(...), aka. "party hat"
omit_all_matches='false'
num_commits=256
opts=0
while getopts 'n:y' flag; do
case "${flag}" in
@njhale
njhale / proposal.md
Created August 11, 2020 14:35
OperatorHub Index

Design Proposal

To design a migration, we'll paint a picture of a plausible final design and work backward from there.

On top of conformance with the rest of the ecosystem, the value-add of bundles and indexes for upstream-community-operators is a reduction in operator manifests managed in the repository. Ideally, these new features will shrink the operator inclusion mechanism from a set of directories to a finite number of config files.

Once fully migrated to the new formats, the general flow for updating the catalog's content might look like:

  1. The git repository is forked
  2. A bundle image reference is added, updated, or deny-listed in an index config file
@njhale
njhale / snapshot-appr-catalog.md
Last active November 18, 2019 23:01
How To: Snapshot Quay Appregistry Type Catalogs

How do I snapshot a Quay Appregistry type OLM operator catalog?

What in tarnation is a snapshot?

For the purposes of this document, a snapshot is:

  • a point-in-time export of an Appregistry (appr) type catalog's content
  • the result of converting an appr catalog to a container image type catalog
  • an immutable artifact
@njhale
njhale / observer.go
Last active June 3, 2019 18:28
Modeling Kubernetes Controllers as Observer Graphs
package subscription
import (
"context"
"sync"
"time"
"github.com/sirupsen/logrus"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
@njhale
njhale / actionable.go
Last active February 22, 2019 01:02
OLM - Checking APIService Status
// apiServiceResourceErrorsActionable returns true if OLM can do something about any one
// of the apiService errors in errs; otherwise returns false
//
// This method can be used to determine if a CSV in a failed state due to APIService
// issues can resolve them by reinstalling
func (a *Operator) apiServiceResourceErrorsActionable(errs []error) bool {
for _, err := range errs {
switch e := err.(type){
case UnadoptableError:
return false

Keybase proof

I hereby claim:

  • I am njhale on github.
  • I am njohnhale (https://keybase.io/njohnhale) on keybase.
  • I have a public key ASDGLK5rMFDg57GPUdhkz44xrLzl0NG4gxHzwKQRAajpFQo

To claim this, I am signing this object: