Skip to content

Instantly share code, notes, and snippets.

@mweibel
mweibel / Makefile.tools.mk
Created May 24, 2023 11:22
Install Go/gRPC tools with Makefile
# GOBIN indicates the path where go tooling is put.
GOBIN=$(shell go env GOPATH)/bin
##@ Tooling
# Versions
GOLANGCI_LINT_VER=v1.52.2
PROTOC_GEN_GO_VERSION=v1.30.0
PROTOC_GEN_GO_GRPC_VERSION=v1.3.0
PROTOC_GEN_VALIDATE_VERSION=v1.0.0
@mweibel
mweibel / README.md
Last active May 5, 2022 17:40
cortex configuration

README

Do not use initial-values.yaml. It's an example for our blog post and does not show values safe to use in production.

@mweibel
mweibel / mapping.yaml
Created July 5, 2021 08:18
banzaicloud/logging-operator working ElasticSearch example with index lifecycle management
apiVersion: v1
kind: Secret
metadata:
name: index-template
stringData:
template: '{"index_patterns":["logstash-*"],"template":{"aliases":{"logstash":{}},"mappings":{"dynamic":"true","dynamic_date_formats":["strict_date_optional_time","yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z"],"dynamic_templates":[]},"settings":{"index":{"lifecycle":{"name":"logstash_policy","rollover_alias":"logstash"},"number_of_shards":"1","number_of_replicas":"0"}}}}'
Workflow
Main*
Unknown*
transmit downstream cluster -> Transmitting
Transmitting
transmitted -> Agent
Agent
Agent Unknown
storage provisioning -> Provisioning
@mweibel
mweibel / simple-k8s-backup.sh
Created February 12, 2021 09:48
Simple k8s backup if you don't yet have k8up or velero in place. Use with caution. Extend extracted values as needed.
#!/bin/bash
set -o pipefail -o errexit -o nounset -o errtrace
mkdir -p backup/
for ns in $(kubectl get ns --no-headers -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}'); do
kubectl --namespace="${ns}" get -o=yaml role,rolebinding,secret,configmap | \
yq eval '
del(
// dbgObject is useful when you have no access to console.log, to debug (e.g. using alert()) a built-in object.
function dbgObject(obj) {
if (Array.isArray(obj)) {
return obj
}
if (typeof obj !== "object") {
return obj
}
const dbg = {}
for (var k in obj) {
@mweibel
mweibel / artifact-passing-linux.yaml
Created August 7, 2020 14:44
argo artifact passing
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: artifact-passing-linux-
spec:
entrypoint: artifact-example
artifactRepositoryRef:
key: gcs
templates:
- name: artifact-example
BEGIN MESSAGE.
MtURVCRvQXV1jha GLHReUbv5IY2aon p2MjDWtTt0MRYtb JXnc8xAmAqzGbQa
DnlO3pIFlj66crL uP1ccDkGxWWTCKq 6Xr2MZHgg6XWBAT 0Bb2PcWp4Zy6F4W
Zpati5yDaOHwZSQ 5dW9lDqTYNXY4yz LmfaJJSBca5W7BF ikbAy7IPFAMyAHu
EqrsljYIMg0Q00F eFxEL2b7yOYBwoX BVgF02IP.
END MESSAGE.
@mweibel
mweibel / usage.tsx
Last active January 24, 2020 16:58
my own useForm hook
const schema = {
email: {
presence: { allowEmpty: false, message: "required" },
email: {
message: "valid"
}
}
};
interface LoginFormFields {
@mweibel
mweibel / Foo.test.js
Created June 26, 2018 13:30
Mock react-beautiful-dnd
// mocks react-beautiful-dnd Droppable without the need of a DragDropContext etc.
jest.mock('react-beautiful-dnd', () => ({
Droppable: jest.fn(
// params to children are `provider`, `snapshot`
({children}) => children({}, {})
)
}));