Skip to content

Instantly share code, notes, and snippets.

View pathcl's full-sized avatar

Luis San Martin pathcl

View GitHub Profile
@pathcl
pathcl / checkdhcp.py
Created March 12, 2020 17:05
checkdhcp.py
#!/usr/bin/env python
#
# Author: Hari Sekhon
# Date: 2007-11-20 18:16:55 +0000 (Tue, 20 Nov 2007)
#
# https://github.com/harisekhon/nagios-plugins
#
# License: see accompanying LICENSE file
#
@pathcl
pathcl / example.py
Created March 12, 2020 10:53
kubernetes python api example
#
from kubernetes import client, config
from kubernetes.utils import create_from_yaml
k8s_config = config.load_kube_config(
config_file="/yourkubeconfig/kubeconfig")
k8s_client = client.api_client.ApiClient(configuration=k8s_config)
# taken from here https://raw.githubusercontent.com/pathcl/hellok8s/master/helloworld.yaml
create_from_yaml(yaml_file='helloworld.yaml',
@pathcl
pathcl / example.py
Last active March 12, 2020 10:55
Example for crd/python kubernetes client
from pprint import pprint
from kubernetes import client, config
c = client.Configuration()
c.debug = True
config.load_kube_config(
config_file="/Users/lsanmartin/work/capv/out/k8s-m-mgmt/kubeconfig")
api = client.CustomObjectsApi()
@pathcl
pathcl / rbac-helm.yaml
Created December 2, 2019 16:04
rbac-helm.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tiller
@pathcl
pathcl / main.go
Created October 18, 2019 15:37
example
package main
import (
"crypto/tls"
"crypto/x509"
"encoding/json"
"encoding/pem"
"flag"
"io/ioutil"
"log"
@pathcl
pathcl / ingress.go
Created October 9, 2019 20:46
Get ingress using tls from k8s
// Problem
// - we simply want to check ssl certs on ingress on kubernetes
package main
import (
"flag"
"fmt"
"os"
"path/filepath"
@pathcl
pathcl / .vimrc
Created October 6, 2019 13:07
.vimrc
" vim-bootstrap b0a75e4
"*****************************************************************************
"" Vim-PLug core
"*****************************************************************************
if has('vim_starting')
set nocompatible " Be iMproved
endif
let vimplug_exists=expand('~/.vim/autoload/plug.vim')
@pathcl
pathcl / kubeadm.yaml
Last active September 16, 2019 17:33
kind configuration for multi master
# this config file contains all config fields with comments
kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
# patch the generated kubeadm config with some extra settings
kubeadmConfigPatches:
- |
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
metadata:
name: config
@pathcl
pathcl / test.py
Last active August 14, 2019 07:00
test.py
import os
def main():
print("Os: {}".format(os.uname().version))
print("Hostname: {}".format(os.uname().nodename))
if __name__ == "__main__":
main()
@pathcl
pathcl / dns.tf
Last active July 26, 2019 16:11
Dns && terraform
// Configure the DNS Provider
// dnssec-keygen -r /dev/urandom -a HMAC-MD5 -b 256 -n HOST domain.tld.
provider "dns" {
update {
server = "192.168.0.1"
key_name = "domain.tld."
key_algorithm = "hmac-md5"
key_secret = "yoursecrethere"
}
}