Skip to content

Instantly share code, notes, and snippets.

View flavianmissi's full-sized avatar

Flavian Missi flavianmissi

View GitHub Profile
@flavianmissi
flavianmissi / is-pullthrough.yaml
Created August 22, 2023 16:01
ImageStream pull-through example
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
annotations:
openshift.io/image.dockerRepositoryCheck: "2023-08-22T15:59:52Z"
creationTimestamp: "2023-08-22T15:59:51Z"
generation: 2
name: test-1
namespace: test
resourceVersion: "32104"
@flavianmissi
flavianmissi / podman.yaml
Last active April 5, 2022 12:53
lima vm running podman 4 on fedora
# Example to use Podman instead of containerd & nerdctl
# $ limactl start ./podman.yaml
# $ limactl shell podman podman run -it -v $HOME:$HOME --rm docker.io/library/alpine
# To run `podman` on the host (assumes podman-remote is installed):
# $ export CONTAINER_HOST=$(limactl list podman --format 'unix://{{.Dir}}/sock/podman.sock')
# $ podman --remote ...
# To run `docker` on the host (assumes docker-cli is installed):
# $ export DOCKER_HOST=$(limactl list podman --format 'unix://{{.Dir}}/sock/podman.sock')
@flavianmissi
flavianmissi / Makefile
Last active March 1, 2022 14:37
WIP: Quay podman/docker integration tests
# NOTE: the below has not been tested
integration-test:
@docker run -d --name integration_test -v "${PWD}:/quay-registry" -w "/quay-registry" docker:20.10.12-dind-alpine3.15
@docker exec integration_test apk add curl
@docker exec integration_test curl -L "https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
@docker exec integration_test chmod +x /usr/local/bin/docker-compose
@docker exec -d integration_test docker-compose up
@docker stop integration_test
@docker rm integration_test
# TODO:
@flavianmissi
flavianmissi / cleanup.sh
Created February 24, 2022 14:07
delete container images matching grep pattern
PATTERN=localhost
# run the cmd below to see what you'll delete
# docker images --format '{{.ID}} {{.Repository}}' | grep ${PATTERN}
docker rmi $(docker images --format '{{.ID}} {{.Repository}}' | grep ${PATTERN} | awk '{print $1}')
@flavianmissi
flavianmissi / operator.sh
Last active June 14, 2022 08:39
List all bundles within an operator catalog source
# before running the below, make sure to run the container with your operator index
# (aka catalog)
docker run -ti --rm -p 50052:50051 quay.io/you/your-catalog:tag
# note: you'll want to change the packageName value in the jq select filter
grpcurl -plaintext localhost:50052 api.Registry.ListBundles | \
jq 'select(.packageName == "quay-bridge-operator") | { csvName: .csvName, channelName: .channelName, version: .version, skips: .skips, skipRange: .skipRange, replaces: .replaces }'
@flavianmissi
flavianmissi / pyenv-python2.7.5-catalina.sh
Created September 11, 2020 18:24
Install Python 2.7.5 with pyenv on catalina
# source: https://github.com/pyenv/pyenv/issues/950
PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA=openssl@1.0 pyenv install 2.7.5
@flavianmissi
flavianmissi / Dockerfile
Created February 20, 2019 11:33
flavia/seabolt's Dockerfile
ARG PKG_VER_ALPINE=3.8
FROM alpine:${PKG_VER_ALPINE}
# seabolt deps
RUN apk add --no-cache openssl-dev pkgconfig cmake
# download and extract seabolt (neo4j go driver C dep)
RUN wget https://github.com/neo4j-drivers/seabolt/releases/download/v1.7.2/seabolt-1.7.2-Linux-alpine-3.8.2.tar.gz
# now extract it
@flavianmissi
flavianmissi / ingress-service-matcher.sh
Created December 5, 2018 10:45
compare k8s endpoints against ingress configured service names
INGRESS=my-nginx
kubectl get endpoints -o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}'|sort
kubectl get ing ${INGRESS} -o=jsonpath='{range .spec.rules[*]}{range .http.paths[*]}{.backend.serviceName}{"\n"}{end}{end}'|sort
#see in vimdiff
vimdiff <(kubectl get endpoints -o=jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}'|sort) <(kubectl get ing ${INGRESS} -o=jsonpath='{range .spec.rules[*]}{range .http.paths[*]}{.backend.serviceName}{"\n"}{end}{end}'|sort)
@flavianmissi
flavianmissi / go-pkg-deps.sh
Created April 16, 2018 05:59
list a go pkg dependencies
GO_TARGET_PKG=./my/pkg
go list -f '{{ join .Imports "\n" }}' "${GO_TARGET_PKG}" | grep -v vendor
@flavianmissi
flavianmissi / reviewer.sh
Last active March 11, 2021 21:10
add reviewer to PR
# usage:
# add_reviewer_to_PR <your-username> <reviewer> <one-time-password> <PR-nr>
# you'll be prompted for your github password.
function add_reviewer_to_PR {
user=$1
reviewer=$2
OTP=$3
PR=$4
curl -X POST -u "$user" -H 'Content-Type: application/json' -H "X-GitHub-OTP: $OTP" -d "{\"reviewers\": [\"$reviewer\"]}" https://api.github.com/repos/mindoktor/mindoktor/pulls/"$PR"/requested_reviewers
}