Skip to content

Instantly share code, notes, and snippets.

View aojea's full-sized avatar

Antonio Ojea aojea

View GitHub Profile
package main
import (
"context"
"crypto/tls"
"fmt"
"io"
"log"
"net"
"net/http"
@aojea
aojea / backend.go
Created April 22, 2022 10:04
kubernetes reverse proxy
package main
import (
"crypto/tls"
"flag"
"log"
"net/http"
"os"
"path/filepath"
@aojea
aojea / main.go
Last active March 31, 2022 16:31
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@aojea
aojea / k8s_prom.sh
Last active April 11, 2024 17:42
kubernetes prometheus CI metrics
https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/108414/pull-kubernetes-e2e-gce-100-performance/1499390264190439424
https://storage.googleapis.com/kubernetes-jenkins/pr-logs/pull/108414/pull-kubernetes-e2e-gce-100-performance/1499390264190439424/artifacts/prometheus_snapshot.tar
TMP_DIR=$(mktemp -d)
cd $TMP_DIR
wget https://storage.googleapis.com/kubernetes-jenkins/pr-logs/pull/108414/pull-kubernetes-e2e-gce-100-performance/1499390264190439424/artifacts/prometheus_snapshot.tar
tar xvf prometheus_snapshot.tar
touch prometheus.yml
SNAPSHOT=$(ls prometheus/snapshots/)
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@aojea
aojea / prometheus_restore.md
Last active February 1, 2022 10:46
restore prometheus dump
  1. create a snapshot of the db
curl -XPOST http://${PROMETHEUS_IP}:8080/api/v1/admin/tsdb/snapshot
  1. get the prometheus database
tar cvf prometheus.tar /prometheus/snapshots 
  1. create a fake prometheus config so it does not complain
@aojea
aojea / api-performance-overview.json
Created December 10, 2021 10:35
Performance dashboards
{
"__inputs": [ ],
"__requires": [ ],
"annotations": {
"list": [ ]
},
"description": "",
"editable": "true",
"gnetId": null,
"graphTooltip": 0,
etcd&
_output/dockerized/bin/linux/amd64/kube-apiserver --etcd-servers localhost:2379 --service-account-issuer=api --service-account-api-audiences=api --service-account-signing-key-file=/var/run/kubernetes/apiserver.key --service-account-key-file=/var/run/kubernetes/apiserver.key 2>&1 | less
@aojea
aojea / iptables_trace_test.go
Created November 6, 2021 21:15
trace iptables
/*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
apiVersion: v1
kind: Service
metadata:
name: mydomainfortest
namespace: default
spec:
externalName: www.google.com
type: ExternalName
selector:
app: myapp