Skip to content

Instantly share code, notes, and snippets.

View kvaps's full-sized avatar
🔳
This mess is mine!

Andrei Kvapil kvaps

🔳
This mess is mine!
View GitHub Profile
@kvaps
kvaps / .gitlab-ci.yml
Created March 27, 2020 20:56 — forked from shalkam/.gitlab-ci.yml
using service account
stages:
- deploy
deploy_app:
image: bitnami/kubectl:latest
stage: deploy
environment: production
script:
- USER_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
- CERTIFICATE_AUTHORITY_DATA=$(cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt | base64 -i -w0 -)
- kubectl config set-cluster k8s --server="https://kubernetes.default.svc"
apiVersion: v1
data:
index.html: |
hello default
kind: ConfigMap
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"v1","data":{"index.html":"hello default\n"},"kind":"ConfigMap","metadata":{"annotations":{"qbec.io/component":"hello"},"labels":{"aaaa":"ccccc","qbec.io/application":"test","qbec.io/environment":"default"},"name":"demo-config","namespace":"default"}}
qbec.io/component: hello
@kvaps
kvaps / old_firefox_jre.sh
Created March 23, 2020 13:42
Run old firefox with jre6 using docker
mkdir -p /tmp/1
cd /tmp/1
cat >Dockerfile <<\EOT
FROM i386/ubuntu:12.04
RUN apt-get update \
&& apt-get install -y firefox=11.0+build1-0ubuntu4 icedtea-6-plugin libstdc++5
EOT
docker build -t firefox-jre .
xhost +local:
docker run -ti \
@kvaps
kvaps / duplocated_vms.sh
Last active March 16, 2020 18:23
OpenNeubla script to find duplicated VMs on the hosts
#/bin/sh
onehost list -x | xmlstarlet sel -t -v '/HOST_POOL/HOST/VMS/ID' -n | sort | uniq -c | sort | while read dup vm; do
if [ "$dup" != "1" ]; then
echo "vm $vm duplicated $dup times, on hosts:"
onehost list -x | xmlstarlet sel -t -v "/HOST_POOL/HOST[VMS/ID/.=${vm}]/ID" -n
fi
done
@kvaps
kvaps / one_xmlrpc_client.sh
Last active February 4, 2020 19:54
OpenNebula API debug tool
#!/bin/bash
#
# Example usage:
# ./one_xmlrpc_client.sh one.vmpool.info i4:-1 i4:-1 i4:-1 i4:-1
#
print_value() {
case "$1" in
string:*) echo ' <param><value><string>'${1##string:}'</string></value></param>' ;;
i4:*) echo ' <param><value><i4>'${1##i4:}'</i4></value></param>' ;;
local job = {
script: ['echo 123'],
only: { refs: ['tags'] },
};
local ref(x) = { only+: { refs+: [x] } };
job + ref('prod')
local job = {
script: ['echo 123'],
only: { refs: ['tags'] },
};
local ref(x) = { only+: { refs: [x] } };
job + ref('prod')
// Import our library
local jobs = import 'lib/jobs.libsonnet';
// Define override functions
local ref(x) = { only+: { refs: [x] } };
local tag(x) = { tags: [x] };
local submodule(x) = { variables+: { GIT_SUBMODULE_STRATEGY: x } };
{
// Building docker-images
{
// Task for uilding docker-image
dockerImage(name):: {
tags: ['build'],
stage: 'build',
image: {
name: 'gcr.io/kaniko-project/executor:debug-v0.15.0',
entrypoint: [''],
},
script: [
deploy:{{ environment }}:{{ app }}:
stage: deploy
tags:
- {{ environment }}
script:
- qbec apply {{ environment }} --root deploy/{{ app }} --force:k8s-context __incluster__ --wait --yes
only:
changes:
- deploy/{{ app }}/**/*
refs: