Skip to content

Instantly share code, notes, and snippets.

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: pgbouncer
name: pgbouncer
spec:
replicas: 1
selector:
matchLabels:
apiVersion: v1
kind: Service
metadata:
name: pgbouncer-service
spec:
ports:
- port: 5432
protocol: TCP
targetPort: 5432
selector:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: openfaas-ingress
namespace: openfaas
labels:
name: openfaas-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
def handle(req):
"""handle a request to the function
Args:
req (str): request body
"""
return req
version: 1.0
provider:
name: openfaas
gateway: https://faas.example.com
functions:
pycon:
lang: python3
handler: ./pycon
image: registry.example.com/pycon:latest
@jmrobles
jmrobles / nifi.yaml
Created October 10, 2021 21:54
Apache NiFi deployment, service and ingress
apiVersion: apps/v1
kind: Deployment
metadata:
name: nifi
namespace: default
spec:
selector:
matchLabels:
app: nifi
template:
version: 1.0
provider:
name: openfaas
gateway: https://faas.example.com
functions:
of-test:
lang: python3-fastapi
handler: ./of-test
image: registry.example.com/of-test:latest
secrets:
name: of-test
namespace: openfaas-fn
workdir: /home/app
command: ["sh"]
sync:
- .:/home/app/function
@jmrobles
jmrobles / handler.py
Created December 12, 2021 23:05
Simple Selenium Web Scraper
import sys
import json
from selenium import webdriver
from selenium.webdriver import ChromeOptions
from langdetect import detect
# Consts
AUTH_CODE = 'asecretcode'
version: 1.0
provider:
name: openfaas
gateway: <your-openfaas-gateway-url>
functions:
of-scrap:
lang: python3-http-selenium
handler: ./of-scrap
image: <your-docker-registry>/of-scraper:latest
secrets: