Skip to content

Instantly share code, notes, and snippets.

@identw
identw / discovery_fields.lua
Created September 24, 2025 12:50
flient-bit configs
function cb(tag, timestamp, record)
new_record = record
-- for nginx ingress access log
if record["kubernetes"]["labels"]["app.kubernetes.io/name"] == "ingress-nginx" and record["stream"] == "stdout" then
new_record["tag"] = "kube_nginx_ingress_stdout"
return 2, timestamp, new_record
end
if record["log"] == nil then
@identw
identw / fluent-bit.conf
Created September 24, 2025 12:48
fluent-bit configs
[SERVICE]
Daemon Off
Flush 1
Log_Level info
Parsers_File /fluent-bit/etc/parsers.conf
Parsers_File /fluent-bit/etc/conf/custom_parsers.conf
HTTP_Server On
HTTP_Listen 0.0.0.0
HTTP_Port 2020
Health_Check On
@identw
identw / custom_parsers.conf
Created September 24, 2025 12:47
fluentbit configs
[PARSER]
Name docker_no_time
Format json
Time_Keep Off
Time_Key time
Time_Format %Y-%m-%dT%H:%M:%S.%L
[PARSER]
Name json_nginx
Format json
@identw
identw / netbird.yaml
Created July 29, 2024 12:52
netbird
# dex config:
# ...
# staticClients:
# - id: netbird-backend
# name: netbird-backend
# redirectURIs:
# - https://netbird.example.com
# - https://netbird.example.com/#callback
# secret: <DEX_NETBIRD_BACKEND_SECRET>
# - id: netbird-client
# An OIDC provider is required (e.g., Dex).
# OIDC must be configured for the kube-apiserver. For example:
# - --oidc-client-id=kubernetes-oidc
# - --oidc-groups-claim=groups
# - --oidc-issuer-url=https://dex.example.com
# - --oidc-username-claim=email
# For cloud setups, you can use kube-oidc-proxy (https://github.com/TremoloSecurity/kube-oidc-proxy)
#
# <secret_cookie_auth_key> - 32 bytes string (regex: a-z0-9, example: rpb7aos4rd0m32x9omcrcqacnia0xty2)
# <secret_cookie_enc_key> - 32 bytes string (regex: a-z0-9, example: gg1ejofgupoc19wyuywr2yflm75aeiwg)
@identw
identw / test.jsonnet
Created April 5, 2024 18:56
test.jsonnet
local h = import './helpers.jsonnet';
local object = {
arr: [
{
containerPort: 53,
name: 'dns',
protocol: 'TCP',
},
{
@identw
identw / helpers.jsonnet
Created April 5, 2024 18:55
helpers.jsonnet
{
mapArrayByField(f, mixinField):: {
local m = super[mixinField],
[mixinField]: std.prune(std.map(f, m))
},
mapArrayWithField(fieldValues, fieldName, mixinField, f):: (
local fieldValuesSet = std.set(fieldValues);
local inFieldValuesSet(value) = std.length(std.setInter(fieldValuesSet, std.set([value]))) > 0;
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: disallow-host-namespaces
spec:
background: true
failurePolicy: Fail
rules:
- match:
any:
apiVersion: templates.gatekeeper.sh/v1beta1
kind: ConstraintTemplate
metadata:
name: k8spsphostnamespace
annotations:
description: Controls usage of host namespaces.
spec:
crd:
spec:
names:
apiVersion: apps/v1
kind: Deployment
metadata:
name: pre-stop
labels:
app: pre-stop
spec:
replicas: 1
revisionHistoryLimit: 2
selector: