Skip to content

Instantly share code, notes, and snippets.

View angelbarrera92's full-sized avatar
🌕
Getafe, +14°

Ángel angelbarrera92

🌕
Getafe, +14°
View GitHub Profile
@angelbarrera92
angelbarrera92 / litestream.json
Created April 2, 2021 11:50
Litestream Grafana Dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@angelbarrera92
angelbarrera92 / main.go
Created April 20, 2021 16:23
golang download parsing netrc
package main
import (
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"strings"
)
@angelbarrera92
angelbarrera92 / prometheus-operator-namespace-issue.yaml
Created February 18, 2021 15:33
Simple example to reproduce the issue while changing namespace labels configured in a Prometheus CRD as namespaceSelector
---
apiVersion: v1
kind: Namespace
metadata:
labels:
example.com.app: app-1
monitoring: "true"
name: monitoring-app-1
---
apiVersion: v1
@angelbarrera92
angelbarrera92 / download_organization_repositories.sh
Last active February 1, 2021 12:40
Download repositories from the GitHub api of an entire organization
#!/bin/bash
# Download repositories from the GitHub api of an entire organization
# It downloads the default branch of each repository
# Creating .tar file
# Usage: ./download_organization_repositories.sh k8spin k8spin_repositories ${GITHUB_PERSONAL_ACCESS_TOKEN}
# Requires curl, jq and bash
org_name="$1"
@angelbarrera92
angelbarrera92 / auth-dockerhub-kind.yaml
Created January 4, 2021 12:24
Avoid DockerHub rate limit on kind configuration
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
- role: control-plane
- role: worker
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry]
@angelbarrera92
angelbarrera92 / main.go
Last active December 11, 2020 18:22
capture control-c with confirmation
package main
import (
"bufio"
"fmt"
"os"
"os/signal"
"strings"
"syscall"
"time" // or "runtime"
#!/bin/bash
# Create the cluster
kind create cluster --name lb
# Get the configuration
kind get kubeconfig --name lb > /tmp/lb-kubeconfig
# Deploy metallb
KUBECONFIG=/tmp/lb-kubeconfig kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.5/manifests/namespace.yaml
KUBECONFIG=/tmp/lb-kubeconfig kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.5/manifests/metallb.yaml
KUBECONFIG=/tmp/lb-kubeconfig kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"
@angelbarrera92
angelbarrera92 / README.md
Last active May 23, 2020 06:06
Kubernetes: Create users in groups

Usage

chmod +x create-user.sh
# ./create-user.sh <username> <group>
./create-user.sh angel k8spin
./create-user.sh pau k8spin
./create-user.sh bill microsoft
@angelbarrera92
angelbarrera92 / main.py
Last active April 25, 2020 17:43
Generate Kubernetes client certificates using own CA
import random
from OpenSSL import crypto
import base64
###########
# CA Cert #
###########
with open("ca.key", "r") as my_cert_file:
my_cert_text = my_cert_file.read()
@angelbarrera92
angelbarrera92 / Getting-started-with-Istio-by-SIGHUP.md
Created January 23, 2020 19:28
Getting started with Istio by SIGHUP

Getting started with Istio by SIGHUP

Español

Description

En este workshop vamos a instalar juntos Istio 1.4.2 en un cluster de Kubernetes 1.15 explicando los conceptos basicos de cualquier Service Mesh a la vez que se explican objetos de Istio sobre Kubernetes.

Se cubriran los siguientes temas: