git clone https://github.com/openfaas/faas-netes
cd faas-netes
make start_kind
import (
"fmt"
"io/ioutil"
"log"
"os"
"handler/function"
)
func main() {
input, err := ioutil.ReadAll(os.Stdin)
if err != nil {
log.Fatalf("Unable to read standard input: %s", err.Error())
}
fmt.Println(function.Handle(input))
}
// Handle a serverless request
func Handle(req []byte) string {
return fmt.Sprintf("Hello, Go. You said: %s", string(req))
}
# Populate example here - i.e. "cat", "sha512sum" or "node index.js"
ENV fprocess="./handler"
# Set to true to see request in function logs
ENV write_debug="false"
EXPOSE 8080
HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1
CMD [ "fwatchdog" ]
Yevgeniy Brikman - Lessons from 300k+ Lines of Infrastructure Code
where "X" is anything not related to the business
Example: framework, in-memory database, queue system, new programming language, etc.
Restaurants buy, cook and sell food.
Very few do farming and even less are good at both.
Developer time (build)
Use a product (buy)
On premise: fixed price and capacity
Cloud: pay for what you use
latency versus throughput
cold start ?
How to test and deploy new pipelines ?
where "X" can be:
infra
config
build
policy
deployment
pipeline
resiliency
where "X" can be:
infra
config
build
policy
deployment
pipeline
resiliency
👉
👉
👉
👉
👉
👉
👉
Terraform
YAML ( or CUE ?)
Dockerfile
Open Policy Agent
YAML (Kubernetes)
Jenkins ( or Tekton / Prow ?)
ChaosToolkit
docker pull esimov/pigo-openfaas:0.1
gcloud auth configure-docker
export IMAGE="eu.gcr.io/${PROJECT_ID}/pigo-openfaas"
docker tag esimov/pigo-openfaas:0.1 "${IMAGE}"
docker push "${IMAGE}"
gcloud beta run deploy pigo-openfaas --platform=managed --region=us-central1 --image="${IMAGE}" --allow-unauthenticated --set-env-vars=output_mode=image --set-env-vars=input_mode=url
export FUNCTION_URL="..."
export IMG_URL="https://upload.wikimedia.org/wikipedia/commons/thumb/c/cc/NASA_Astronaut_Group_18.jpg/1200px-NASA_Astronaut_Group_18.jpg"
curl -H 'Content-Type: binary/octet-stream' --data-binary "${IMG_URL}" "${FUNCTION_URL}" > target.jpg
and I'm sorry 🙏
If you had to maintain my code
I hope you learned more by maintaining it
than me by writing it
Slides made with Reveal.js and hugo-reveal