Skip to content

Instantly share code, notes, and snippets.

@fiunchinho
fiunchinho / ping.php
Created December 16, 2017 11:10
Example application for CodelyTvPro
<?php
echo "Ping " . $_SERVER['SERVER_ADDR'];
@fiunchinho
fiunchinho / credentials.py
Created March 17, 2016 12:06
Python script to fetch AWS access key and secret key from a running EC2 instance
from botocore.credentials import InstanceMetadataProvider, InstanceMetadataFetcher
provider = InstanceMetadataProvider(iam_role_fetcher=InstanceMetadataFetcher(timeout=1000, num_attempts=2))
credentials = provider.load()
access_key = credentials.access_key
secret_key = credentials.secret_key
print access_key
print secret_key
sonobuoy-config:
driver: Job
plugin-name: giantswarm
result-format: raw
spec:
image: sonobuoy-plugin
name: plugin
env:
- name: KUBECONFIG
- name: CP_KUBECONFIG
https://docs.google.com/presentation/d/18c0x7QhfDSxcgUZaDHgyT5UbdE2bAm2yeAXnNGjdR4U/edit?usp=sharing
https://drive.google.com/open?id=1m-lhdU-iGoGGgYkVcH_rJSz-fxzwzaMi
@fiunchinho
fiunchinho / service.go
Created December 3, 2018 09:44
Dependency injection
func NewIamRoleAnnotator(k8sCli kubernetes.Interface, awsAccountID string, logger Logger) *IamRoleAnnotator {
return &IamRoleAnnotator{
client: k8sCli,
awsAccountID: awsAccountID,
logger: logger,
}
}
@fiunchinho
fiunchinho / service.go
Created December 3, 2018 09:43
object using the client-go library directly
func (s *IamRoleAnnotator) submitChangesToKubernetesAPI(deployment *appsv1beta1.Deployment) (*appsv1beta1.Deployment, error) {
s.logger.Infof("Sending changes to k8s API")
return s.client.AppsV1beta1().Deployments(deployment.Namespace).Update(deployment)
}
@fiunchinho
fiunchinho / ListExample.java
Last active July 30, 2018 18:04
Feign Observable serialization doesn't work
package net.armesto.feign;
import feign.Feign;
import feign.Param;
import feign.RequestLine;
import feign.jackson.JacksonDecoder;
import feign.jackson.JacksonEncoder;
import rx.Observable;
import java.util.List;
@fiunchinho
fiunchinho / main.go
Created August 15, 2017 11:54
Controller that whitelist IP's on ingress objects
package main
import (
"flag"
"fmt"
"log"
"reflect"
"time"
"k8s.io/apimachinery/pkg/util/runtime"
@fiunchinho
fiunchinho / ansistrano.md
Created March 27, 2017 20:00
Ansistrano on fresh EC2 Ubuntu

Playbook

---
- hosts: localhost
  vars:
    ansistrano_deploy_to: "/var/www/html"
  roles:
    - carlosbuenosvinos.ansistrano-deploy
@fiunchinho
fiunchinho / elastic.md
Last active January 28, 2017 18:17
Useful endpoints to monitor cluster health

Useful ElasticSearch urls

/_cluster/health?v
/_cat/nodes?v
/_nodes/stats/_all
/_cat/indices?v
/_cat/shards?v