Skip to content

Instantly share code, notes, and snippets.

kvaps kvaps

Block or report user

Report or block kvaps

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kvaps
kvaps / journalbeat.yaml
Created Aug 14, 2019
Journalbeat config for Kubernetes
View journalbeat.yaml
---
apiVersion: v1
data:
journalbeat.yml: |
name: "${NODENAME}"
journalbeat.inputs:
- paths: []
seek: cursor
cursor_seek_fallback: tail
@kvaps
kvaps / ks2qbec
Created Aug 5, 2019
Helper script for easy migration from Ksonnet to Qbec
View ks2qbec
#!/bin/bash
function parse_yaml {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\):|\1|" \
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
@kvaps
kvaps / 00_ansible_jsonnet.md
Last active Jul 29, 2019
ansible jsonnet proof of concept
View 00_ansible_jsonnet.md
# ansible all -i inventory.sh -m debug -a var=host_specific_var

host-a | SUCCESS => {
    "host_specific_var": "abcde-a"
}
host-b | SUCCESS => {
    "host_specific_var": "abcde-b"
}
host-c | SUCCESS => {
@kvaps
kvaps / playbook.yaml
Last active Jul 17, 2019
ansible raw module with locking
View playbook.yaml
---
- hosts: localhost
gather_facts: no
tasks:
- raw: uname -a
args:
lock_file: '/tmp/asd'
@kvaps
kvaps / example_v1alpha1_foo_crd.yaml
Created Jul 16, 2019
Ansible runner for Kubernetes Custom Resources
View example_v1alpha1_foo_crd.yaml
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: foo.example.org
spec:
group: example.org
names:
kind: Foo
listKind: FooList
plural: foos
@kvaps
kvaps / gitlab_ls_registry.sh
Created May 8, 2019
List all images in the Gitlab docker registry
View gitlab_ls_registry.sh
GITLAB="https://gitlab.example.org"
TOKEN=""
while read REPOSITORY_ID; do
while read REGISTRY_ID; do
curl -s -H "PRIVATE-TOKEN: $TOKEN" "$GITLAB/api/v4//projects/$REPOSITORY_ID/registry/repositories/$REGISTRY_ID/tags?per_page=1000" | jq -r '.[].location'
done < <(curl -s -H "PRIVATE-TOKEN: $TOKEN" "$GITLAB/api/v4//projects/$REPOSITORY_ID/registry/repositories?per_page=1000" | jq -r '.[].id')
done < <(curl -s -H "PRIVATE-TOKEN: $TOKEN" "$GITLAB/api/v4/projects?per_page=1000" | jq -r '.[].id')
@kvaps
kvaps / kubernetes_add_service_account_kubeconfig.sh
Last active Jul 4, 2019 — forked from StevenACoffman/kubernetes_add_service_account_kubeconfig.sh
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the service account, and RBAC
View kubernetes_add_service_account_kubeconfig.sh
#!/bin/bash -e
# Add user to k8s 1.6+ using service account, RBAC for jobs and extensions only
if [[ -z "$1" ]] || [[ -z "$2" ]];then
echo "usage: $0 <service-account> <namespace (stg|prod)>"
exit 1
fi
SERVICE_ACCOUNT_NAME=$1
NAMESPACE=$2
@kvaps
kvaps / kubernetes_add_service_account_kubeconfig.sh
Created May 7, 2019 — forked from innovia/kubernetes_add_service_account_kubeconfig.sh
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
View kubernetes_add_service_account_kubeconfig.sh
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
View opennebula.jsonnet
local name(x) = (
[['NAME', x]]
);
local disk(x) = (
[[
'DISK',
['IMAGE', x],
['IMAGE_UNAME', 'oneadmin'],
@kvaps
kvaps / devoops-sticker.svg
Last active Mar 29, 2019
DevOops sticker
View devoops-sticker.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.