Skip to content

Instantly share code, notes, and snippets.

View guilhem's full-sized avatar
Ohai!

Guilhem Lettron guilhem

Ohai!
View GitHub Profile
@guilhem
guilhem / gist:8185e0fa9f043434984e9adb93ac8231
Created July 15, 2022 14:12
kyverno 1.7.2-rc1 with --disableMetrics=true
I0715 14:09:41.134709 1 controller.go:231] PolicyController "msg"="policy created" "kind"="ClusterPolicy" "name"="block-updates-deletes" "uid"="230551e2-901c-4209-ae4b-1c26b9e05af2"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x2088154]
goroutine 4790 [running]:
github.com/kyverno/kyverno/pkg/metrics/policychanges.registerPolicyChangesMetric(0x0, {0x27cfba3, 0x7}, {0x27cf965, 0x7}, {0x27ca52f, 0x5}, {0x0, 0x32da7b0}, {0xc000dea4c8, ...}, ...)
/src/pkg/metrics/policychanges/policyChanges.go:23 +0xb4
github.com/kyverno/kyverno/pkg/metrics/policychanges.RegisterPolicy(0xc00010c060, {0x3334698, 0xc000318a00}, {0x27cf9ff, 0x7})
/src/pkg/metrics/policychanges/policyChanges.go:48 +0xa8
github.com/kyverno/kyverno/pkg/policy.(*PolicyController).registerPolicyChangesMetricAddPolicy(0x440bc5, {{0x32da7b0, 0xc000a390e0}, 0x0}, {0x3334698, 0xc000318a00})
@guilhem
guilhem / #SteamDeck information
Last active May 24, 2022 08:07
steamdeck informations
SteamDeck Linux information.
Comment for new file content.
@guilhem
guilhem / swag.yaml
Created May 4, 2022 13:55
Github action to maintain swag docs up to date
name: swagger
on:
push:
tags:
- v*
branches:
- master
- main
pull_request:
@guilhem
guilhem / swaggo.yaml
Last active December 22, 2021 13:25
Github action for swaggo
jobs:
swagger:
name: docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: supplypike/setup-bin@v1
with:
uri: 'https://github.com/swaggo/swag/releases/download/v1.7.6/swag_1.7.6_Linux_x86_64.tar.gz'
@guilhem
guilhem / kubectl.md
Last active October 11, 2021 09:18
kubectl cheatsheet

list all ingress hosts

kubectl get ing -o jsonpath='{range .items[*]}{@.metadata.name}:{.spec.rules[*].host}{"\n"}{end}'
@guilhem
guilhem / cloudflare-forwarded-port-cm.yaml
Last active October 25, 2021 12:16
fix nginx.ingress.kubernetes.io/force-ssl-redirect="true" with cloudlare
apiVersion: v1
kind: ConfigMap
metadata:
name: cloudflare-forwarded-port
namespace: ingress-nginx
data:
main.lua: |
local ngx = ngx
local _M = {}
[Unit]
Description=Cleanup pod directory on reboot
Before=kubelet.service
Before=docker.service # for rke install
[Service]
Type=oneshot
Environment=KUBELET_DIR='/var/lib/kubelet/'
ExecStart=/usr/bin/find ${KUBELET_DIR} -mindepth 1 -delete
@guilhem
guilhem / gist:6911ac77565890f623f1c6f55c8fdf9f
Last active March 29, 2021 13:29
azure blob io.ReaderAt
package blob
import (
"context"
"io"
"github.com/Azure/azure-storage-blob-go/azblob"
)
type BlobReaderAt struct {
@guilhem
guilhem / log
Created March 29, 2021 12:11
Error linux make
$ make bindeb-pkg
[...]
make[4]: *** No rule to make target 'debian/canonical-certs.pem', needed by 'certs/x509_certificate_list'. Stop.
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [Makefile:1979: certs] Error 2
make[3]: *** Waiting for unfinished jobs....
[...]
dpkg-buildpackage: error: debian/rules binary subprocess was killed by signal 2
make[1]: *** [scripts/Makefile.package:83: bindeb-pkg] Interrupt
@guilhem
guilhem / log.diff
Created August 14, 2020 17:03
Jupyter notebook log kernel execution and user based on http proxy header
diff --git a/notebook/base/handlers.py b/notebook/base/handlers.py
index 743f7bac7..6d8f478cf 100755
--- a/notebook/base/handlers.py
+++ b/notebook/base/handlers.py
@@ -126,6 +126,8 @@ class AuthenticatedHandler(web.RequestHandler):
self.force_clear_cookie(self.cookie_name)
def get_current_user(self):
+ if "X-AUTH-USER" in self.request.headers:
+ return self.request.headers["X-AUTH-USER"]