SlideShare una empresa de Scribd logo
1 de 29
qaware.de
betterCode() Workshop
Effizientes DevOps-Tooling
mit Go
Mario-Leander Reimer, @LeanderReimer
Markus Zimmermann, @markus_zm
QAware | 2
Mario-Leander Reimer
Principal Software Architect
@LeanderReimer
#cloudnativenerd #qaware
Markus Zimmermann
Senior Software Engineer
@markus_zm
#golangnerd #qaware
How do you organise and enable
DevOps teams for
fast flow and high productivity?
Too much cognitive load will become
a bottleneck for fast flow and high productivity.
QAware | 4
■ Intrinsic Cognitive Load
Relates to fundamental aspects and knowledge in the
problem space (e.g. used languages, APIs, frameworks)
■ Extraneous Cognitive Load
Relates to the environment
(e.g. deployment, configuration, console commands)
■ Germane Cognitive Load
Relates to specific aspects of the business domain
(aka. „value added“ thinking)
Minimize
intrinsic cognitive load
Eliminate
extraneous cognitive
load
Use the right tool for the job!
Ruby Python Ansible Bash
Why Go?
QAware | 8
■ Go is open source and maintained by Google
■ Go is an efficient distributed, parallel language for systems programming at Google to
solve problems of C++ code
■ Single, self contained binary. Runs almost on any platform and OS.
■ Vivid community. Good documentation. Good Tooling.
■ Go is the major language behind the Cloud Native Stack, many important components
are written in Go
Workshop Agenda
09:00 - 09:15 | Begrüßung und Einleitung
09:15 - 10:15 | Getting to Know Go: Basics and Tooling
10:30 - 12:00 | Building CLI Applications with Go and Cobra
13:00 - 14:30 | Kubernetes Sidecars in Go
14:45 - 16:00 | Building a Kubernetes operator in Go
https://gobyexample.com
https://learnxinyminutes.com/docs/go/
https://github.com/qaware/go-for-operations
https://golang.org/doc/install
https://code.visualstudio.com/docs/setup/setup-overview
Workshop Setup
The renaissance of the plain old Makefile
QAware | 12
VERSION = v1.0.0
.PHONY: build
build:
# omit the symbol table, debug information and the DWARF table
@go build -o go-example -ldflags="-s -w -X main.version=$(VERSION)"
clean:
@go clean
test: build
@go test -v
all: clean build test
release: all
@goreleaser --snapshot --skip-publish --rm-dist
Use GoReleaser to publish multi OS binaries
QAware | 13
project_name: go-example
before:
hooks:
- go mod download
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- 386
- amd64
ldflags: -s -w -X main.version={{.Version}}
archives:
- name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}'
format_overrides:
- goos: windows
format: zip
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
■ https://goreleaser.com
■ Cross-compile your Go project
quick and easily
■ Release to GitHub, GitLab et.al
■ Create Docker images and
manifests
■ Create Linux packages and
Homebrew Taps
■ Upload to Bintray, Artifactory and
other Public Blob Stores
■ … and much more!
CLIs - The Swiss Army Knife of Dev and Ops
The Basics of 12-factor CLI applications
QAware | 15
■ Great help is essential. What version am I on?
■ Prefer flags to positional arguments.
■ Mind the streams. stdout is for output, stderr is for messaging.
■ Handle things going wrong: error code, title, how to fix, URL, …
■ Be fancy: use colours, have shell completion.
■ Prompt if you can.
■ Be speedy. CLIs need to start fast.
■ Be clear about subcommands.
For complete list and info, read https://medium.com/@jdxcode/12-factor-cli-apps-dd3c227a0e46
QAware | 16
■ https://github.com/spf13/cobra
■ Cobra is a library providing a simple interface to create powerful
modern CLI interfaces similar to git & go tools.
■ Cobra is also an application that will generate your application
scaffolding to rapidly develop a Cobra-based application.
■ Cobra is used in many Go projects such as Kubernetes, Docker,
Skaffold, Helm and Istio just to name a few.
QAware | 17
■ https://github.com/spf13/viper
■ Viper is a library for configuration handling of Go applications.
■ It supports all types of configuration whether its YAML,
environment variables, flags or remote config systems
■ Live watching and re-reading of config files included
■ Overwriting of configuration is built-in
QAware | 18
a
Container Orchestration Patterns
QAware | 19
Sidecar Container
Extended Container Behaviour
■ Log Extraction / Reformatting
(fluentd, file beat)
■ Scheduling (cron, quartz)
Ambassador Container
Proxy Communication
■ TLS Tunnel (ghostunnel, Istio)
■ Circuit Breaking (linked, Istio)
■ Request Monitoring (linked, Istio)
Adapter Container
Standardized Ops Interfaces
■ Monitoring (Prometheus)
■ Configuration (ConfigMaps,
Secrets, …)
Use a multi-stage Dockerfile to build Linux binaries
QAware | 20
FROM golang:1.15.2 as builder
WORKDIR /build
COPY . /build
RUN go build -o logship-sidecar -ldflags="-s -w"
FROM gcr.io/distroless/static-debian10
COPY --from=builder /build/logship-sidecar /
ENV LOG_DIRECTORY=/logs
ENV LOG_FILE_PATTERN=.+.gz
ENV LOG_SCAN_INTERVAL=10
ENTRYPOINT ["/logship-sidecar"]
CMD [""]
Stage 1: Building
Stage 2: Running
QAware | 21
Operator.
- Do stuff to my Kubernetes.
What are operators?
QAware | 22
■ Operators are codified Ops procedures!
■ Operators are the path towards Zero-Ops. They enable auto-
updating, self-monitoring and self-healing infrastructure and
applications.
■ The concept was coined in the Kubernetes world. It’s now been
adopted and used widespread in the cloud native world.
■ Examples: OKD, Sealed Secrets, Kube Monkey, Weave Flux
Kubernetes API Extensions with Custom Resources
QAware | 23
■ User defined extensions of the Kubernetes APIs
■ Allow the abstraction of complex application constructs and concepts
■ Definition solely via CustomResourceDefinitions
■ Structure definition via OpenAPI v3.0 Validation Schema
■ Default Support for several API Features: CRUD, Watch, Discovery,
json-patch, merge-patch, Admission Webhooks, Metadata, RBAC, …
■ Versioning und Conversion supported via Webhooks
QAware | 24
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
metadata:
labels:
app: nginx
environment: integration
spec:
containers:
- name: nginx
image: nginx:1.19.4-alpine
ports:
- containerPort: 80
# probe definitions
# resource constraints
# volumes and mounts
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
type: LoadBalancer
ports:
- port: 80
protocol: TCP
selector:
app: nginx
apiVersion:
k8s.qaware.de/v1alpha1
kind: Microservice
metadata:
name: microservice-example
labels:
app: nginx
spec:
image: nginx:1.19.4-alpine
replicas: 2
serviceType: LoadBalancer
ports:
- 80
+ =
Kubernetes Operators Explained
QAware | 25
Introducing the Operator SDK
QAware | 26
Cross-Cutting Concerns via Admission Controllers
QAware | 27
■ Admission Controllers are like (dynamic) plugins for Kubernetes
■ Security: increase security by mandating a reasonable security baseline across an
entire namespace or cluster, e.g. PodSecurityPolicy, OPA.
■ Governance: apply and enforce the adherence to best practices, e.g. good labels,
annotations, resource limits, probes.
■ Configuration Management: validate configuration of objects and prevent obvious
misconfigurations from hitting the cluster.
■ More than 30 admission controllers shipped with Kubernetes, incl. the
MutatingAdmissionWebhook and ValidatingAdmissionWebhook
Mutating and Validating Admission Explained
QAware | 28
TLS TLS
POST /mutate POST /validate
qaware.de
QAware GmbH
Aschauer Straße 32
81549 München
Tel. +49 89 232315-0
info@qaware.de
twitter.com/qaware
linkedin.com/company/qaware-gmbh
xing.com/companies/qawaregmbh
slideshare.net/qaware
github.com/qaware

Más contenido relacionado

La actualidad más candente

CQRS - Eine Einführung - NOUG 2011
CQRS - Eine Einführung - NOUG 2011CQRS - Eine Einführung - NOUG 2011
CQRS - Eine Einführung - NOUG 2011
Dennis Traub
 
Putting microservices on a diet with Istio
Putting microservices on a diet with IstioPutting microservices on a diet with Istio
Putting microservices on a diet with Istio
QAware GmbH
 

La actualidad más candente (20)

Secure Architecture and Programming 101
Secure Architecture and Programming 101Secure Architecture and Programming 101
Secure Architecture and Programming 101
 
Cloud Platforms "demystified": Docker, Kubernetes, Knative & Cloud Foundry
Cloud Platforms "demystified": Docker, Kubernetes, Knative & Cloud FoundryCloud Platforms "demystified": Docker, Kubernetes, Knative & Cloud Foundry
Cloud Platforms "demystified": Docker, Kubernetes, Knative & Cloud Foundry
 
Enterprise Cloud Native is the New Normal
Enterprise Cloud Native is the New NormalEnterprise Cloud Native is the New Normal
Enterprise Cloud Native is the New Normal
 
Secure your Quarkus applications | DevNation Tech Talk
Secure your Quarkus applications | DevNation Tech TalkSecure your Quarkus applications | DevNation Tech Talk
Secure your Quarkus applications | DevNation Tech Talk
 
The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
 The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ... The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
The Good, the Bad and the Ugly of Migrating Hundreds of Legacy Applications ...
 
Building streaming applications using a managed Kafka service | DevNation Tec...
Building streaming applications using a managed Kafka service | DevNation Tec...Building streaming applications using a managed Kafka service | DevNation Tec...
Building streaming applications using a managed Kafka service | DevNation Tec...
 
4K–Kubernetes with Knative, Kafka and Kamel
4K–Kubernetes with Knative, Kafka and Kamel 4K–Kubernetes with Knative, Kafka and Kamel
4K–Kubernetes with Knative, Kafka and Kamel
 
Kubernetes für Workstations Edge und IoT Devices
Kubernetes für Workstations Edge und IoT DevicesKubernetes für Workstations Edge und IoT Devices
Kubernetes für Workstations Edge und IoT Devices
 
Cloud-Native Modernization or Death? A false dichotomy. | DevNation Tech Talk
Cloud-Native Modernization or Death? A false dichotomy. | DevNation Tech TalkCloud-Native Modernization or Death? A false dichotomy. | DevNation Tech Talk
Cloud-Native Modernization or Death? A false dichotomy. | DevNation Tech Talk
 
Kubernetes Multi-cluster without Federation - Kubecon EU 2018
Kubernetes Multi-cluster without Federation - Kubecon EU 2018Kubernetes Multi-cluster without Federation - Kubecon EU 2018
Kubernetes Multi-cluster without Federation - Kubecon EU 2018
 
CQRS - Eine Einführung - NOUG 2011
CQRS - Eine Einführung - NOUG 2011CQRS - Eine Einführung - NOUG 2011
CQRS - Eine Einführung - NOUG 2011
 
[DevConf.US 2019]Quarkus Brings Serverless to Java Developers
[DevConf.US 2019]Quarkus Brings Serverless to Java Developers[DevConf.US 2019]Quarkus Brings Serverless to Java Developers
[DevConf.US 2019]Quarkus Brings Serverless to Java Developers
 
kubernetes operators
kubernetes operatorskubernetes operators
kubernetes operators
 
Canary deployment with Traefik and K3S
Canary deployment with Traefik and K3SCanary deployment with Traefik and K3S
Canary deployment with Traefik and K3S
 
Declarative Import with Magento 2 Import Framework (M2IF)
Declarative Import with Magento 2 Import Framework (M2IF)Declarative Import with Magento 2 Import Framework (M2IF)
Declarative Import with Magento 2 Import Framework (M2IF)
 
Putting microservices on a diet with Istio
Putting microservices on a diet with IstioPutting microservices on a diet with Istio
Putting microservices on a diet with Istio
 
K8s from Zero to ~Hero~ Seasoned Beginner
K8s from Zero to ~Hero~ Seasoned BeginnerK8s from Zero to ~Hero~ Seasoned Beginner
K8s from Zero to ~Hero~ Seasoned Beginner
 
Webinar: End-to-End CI/CD with GitLab and DC/OS
Webinar: End-to-End CI/CD with GitLab and DC/OSWebinar: End-to-End CI/CD with GitLab and DC/OS
Webinar: End-to-End CI/CD with GitLab and DC/OS
 
Troubleshooting tips from docker support engineers
Troubleshooting tips from docker support engineersTroubleshooting tips from docker support engineers
Troubleshooting tips from docker support engineers
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
 

Similar a betterCode Workshop: Effizientes DevOps-Tooling mit Go

2 Linux Container and Docker
2 Linux Container and Docker2 Linux Container and Docker
2 Linux Container and Docker
Fabio Fumarola
 

Similar a betterCode Workshop: Effizientes DevOps-Tooling mit Go (20)

Kubernetes - training micro-dragons without getting burnt
Kubernetes -  training micro-dragons without getting burntKubernetes -  training micro-dragons without getting burnt
Kubernetes - training micro-dragons without getting burnt
 
Cluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards KubernetesCluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards Kubernetes
 
Cloud-native .NET Microservices mit Kubernetes
Cloud-native .NET Microservices mit KubernetesCloud-native .NET Microservices mit Kubernetes
Cloud-native .NET Microservices mit Kubernetes
 
2 Linux Container and Docker
2 Linux Container and Docker2 Linux Container and Docker
2 Linux Container and Docker
 
Linux containers and docker
Linux containers and dockerLinux containers and docker
Linux containers and docker
 
Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment
 
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
Docker Azure Friday OSS March 2017 - Developing and deploying Java & Linux on...
 
Docker Enterprise Workshop - Technical
Docker Enterprise Workshop - TechnicalDocker Enterprise Workshop - Technical
Docker Enterprise Workshop - Technical
 
Develop with linux containers and docker
Develop with linux containers and dockerDevelop with linux containers and docker
Develop with linux containers and docker
 
Cluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards KubernetesCluster-as-code. The Many Ways towards Kubernetes
Cluster-as-code. The Many Ways towards Kubernetes
 
K8s-native Infrastructure as Code: einfach, deklarativ, produktiv
 K8s-native Infrastructure as Code: einfach, deklarativ, produktiv K8s-native Infrastructure as Code: einfach, deklarativ, produktiv
K8s-native Infrastructure as Code: einfach, deklarativ, produktiv
 
Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
Kubernetes security
Kubernetes securityKubernetes security
Kubernetes security
 
Kubernetes Intro
Kubernetes IntroKubernetes Intro
Kubernetes Intro
 
Getting Started with MariaDB with Docker
Getting Started with MariaDB with DockerGetting Started with MariaDB with Docker
Getting Started with MariaDB with Docker
 
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsI Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
 
kubectl apply -f cloud-Infrastructure.yaml mit Crossplane et al.
kubectl apply -f cloud-Infrastructure.yaml mit Crossplane et al.kubectl apply -f cloud-Infrastructure.yaml mit Crossplane et al.
kubectl apply -f cloud-Infrastructure.yaml mit Crossplane et al.
 
What's New in Docker - February 2017
What's New in Docker - February 2017What's New in Docker - February 2017
What's New in Docker - February 2017
 
Best Practices for Running Kafka on Docker Containers
Best Practices for Running Kafka on Docker ContainersBest Practices for Running Kafka on Docker Containers
Best Practices for Running Kafka on Docker Containers
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
 

Más de QAware GmbH

"Mixed" Scrum-Teams – Die richtige Mischung macht's!
"Mixed" Scrum-Teams – Die richtige Mischung macht's!"Mixed" Scrum-Teams – Die richtige Mischung macht's!
"Mixed" Scrum-Teams – Die richtige Mischung macht's!
QAware GmbH
 
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
 Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See... Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
QAware GmbH
 

Más de QAware GmbH (20)

50 Shades of K8s Autoscaling #JavaLand24.pdf
50 Shades of K8s Autoscaling #JavaLand24.pdf50 Shades of K8s Autoscaling #JavaLand24.pdf
50 Shades of K8s Autoscaling #JavaLand24.pdf
 
Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...
Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...
Make Agile Great - PM-Erfahrungen aus zwei virtuellen internationalen SAFe-Pr...
 
Fully-managed Cloud-native Databases: The path to indefinite scale @ CNN Mainz
Fully-managed Cloud-native Databases: The path to indefinite scale @ CNN MainzFully-managed Cloud-native Databases: The path to indefinite scale @ CNN Mainz
Fully-managed Cloud-native Databases: The path to indefinite scale @ CNN Mainz
 
Down the Ivory Tower towards Agile Architecture
Down the Ivory Tower towards Agile ArchitectureDown the Ivory Tower towards Agile Architecture
Down the Ivory Tower towards Agile Architecture
 
"Mixed" Scrum-Teams – Die richtige Mischung macht's!
"Mixed" Scrum-Teams – Die richtige Mischung macht's!"Mixed" Scrum-Teams – Die richtige Mischung macht's!
"Mixed" Scrum-Teams – Die richtige Mischung macht's!
 
Make Developers Fly: Principles for Platform Engineering
Make Developers Fly: Principles for Platform EngineeringMake Developers Fly: Principles for Platform Engineering
Make Developers Fly: Principles for Platform Engineering
 
Der Tod der Testpyramide? – Frontend-Testing mit Playwright
Der Tod der Testpyramide? – Frontend-Testing mit PlaywrightDer Tod der Testpyramide? – Frontend-Testing mit Playwright
Der Tod der Testpyramide? – Frontend-Testing mit Playwright
 
Was kommt nach den SPAs
Was kommt nach den SPAsWas kommt nach den SPAs
Was kommt nach den SPAs
 
Cloud Migration mit KI: der Turbo
Cloud Migration mit KI: der Turbo Cloud Migration mit KI: der Turbo
Cloud Migration mit KI: der Turbo
 
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
 Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See... Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
Migration von stark regulierten Anwendungen in die Cloud: Dem Teufel die See...
 
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
 
Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.
Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.
Endlich gute API Tests. Boldly Testing APIs Where No One Has Tested Before.
 
Kubernetes with Cilium in AWS - Experience Report!
Kubernetes with Cilium in AWS - Experience Report!Kubernetes with Cilium in AWS - Experience Report!
Kubernetes with Cilium in AWS - Experience Report!
 
50 Shades of K8s Autoscaling
50 Shades of K8s Autoscaling50 Shades of K8s Autoscaling
50 Shades of K8s Autoscaling
 
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAP
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAPKontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAP
Kontinuierliche Sicherheitstests für APIs mit Testkube und OWASP ZAP
 
Service Mesh Pain & Gain. Experiences from a client project.
Service Mesh Pain & Gain. Experiences from a client project.Service Mesh Pain & Gain. Experiences from a client project.
Service Mesh Pain & Gain. Experiences from a client project.
 
50 Shades of K8s Autoscaling
50 Shades of K8s Autoscaling50 Shades of K8s Autoscaling
50 Shades of K8s Autoscaling
 
Blue turns green! Approaches and technologies for sustainable K8s clusters.
Blue turns green! Approaches and technologies for sustainable K8s clusters.Blue turns green! Approaches and technologies for sustainable K8s clusters.
Blue turns green! Approaches and technologies for sustainable K8s clusters.
 
Per Anhalter zu Cloud Nativen API Gateways
Per Anhalter zu Cloud Nativen API GatewaysPer Anhalter zu Cloud Nativen API Gateways
Per Anhalter zu Cloud Nativen API Gateways
 
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
Aus blau wird grün! Ansätze und Technologien für nachhaltige Kubernetes-Cluster
 

Último

Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
nirzagarg
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
gajnagarg
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
wsppdmt
 
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling ManjurJual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
ptikerjasaptiker
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Bertram Ludäscher
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
nirzagarg
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
ahmedjiabur940
 
PLE-statistics document for primary schs
PLE-statistics document for primary schsPLE-statistics document for primary schs
PLE-statistics document for primary schs
cnajjemba
 

Último (20)

Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
 
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowVadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
 
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling ManjurJual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
Jual Cytotec Asli Obat Aborsi No. 1 Paling Manjur
 
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATIONCapstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham Ware
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptxThe-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
The-boAt-Story-Navigating-the-Waves-of-Innovation.pptx
 
PLE-statistics document for primary schs
PLE-statistics document for primary schsPLE-statistics document for primary schs
PLE-statistics document for primary schs
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
 

betterCode Workshop: Effizientes DevOps-Tooling mit Go

  • 1. qaware.de betterCode() Workshop Effizientes DevOps-Tooling mit Go Mario-Leander Reimer, @LeanderReimer Markus Zimmermann, @markus_zm
  • 2. QAware | 2 Mario-Leander Reimer Principal Software Architect @LeanderReimer #cloudnativenerd #qaware Markus Zimmermann Senior Software Engineer @markus_zm #golangnerd #qaware
  • 3. How do you organise and enable DevOps teams for fast flow and high productivity?
  • 4. Too much cognitive load will become a bottleneck for fast flow and high productivity. QAware | 4 ■ Intrinsic Cognitive Load Relates to fundamental aspects and knowledge in the problem space (e.g. used languages, APIs, frameworks) ■ Extraneous Cognitive Load Relates to the environment (e.g. deployment, configuration, console commands) ■ Germane Cognitive Load Relates to specific aspects of the business domain (aka. „value added“ thinking)
  • 6.
  • 7. Use the right tool for the job! Ruby Python Ansible Bash
  • 8. Why Go? QAware | 8 ■ Go is open source and maintained by Google ■ Go is an efficient distributed, parallel language for systems programming at Google to solve problems of C++ code ■ Single, self contained binary. Runs almost on any platform and OS. ■ Vivid community. Good documentation. Good Tooling. ■ Go is the major language behind the Cloud Native Stack, many important components are written in Go
  • 9. Workshop Agenda 09:00 - 09:15 | Begrüßung und Einleitung 09:15 - 10:15 | Getting to Know Go: Basics and Tooling 10:30 - 12:00 | Building CLI Applications with Go and Cobra 13:00 - 14:30 | Kubernetes Sidecars in Go 14:45 - 16:00 | Building a Kubernetes operator in Go
  • 12. The renaissance of the plain old Makefile QAware | 12 VERSION = v1.0.0 .PHONY: build build: # omit the symbol table, debug information and the DWARF table @go build -o go-example -ldflags="-s -w -X main.version=$(VERSION)" clean: @go clean test: build @go test -v all: clean build test release: all @goreleaser --snapshot --skip-publish --rm-dist
  • 13. Use GoReleaser to publish multi OS binaries QAware | 13 project_name: go-example before: hooks: - go mod download builds: - env: - CGO_ENABLED=0 goos: - linux - windows - darwin goarch: - 386 - amd64 ldflags: -s -w -X main.version={{.Version}} archives: - name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}' format_overrides: - goos: windows format: zip replacements: darwin: Darwin linux: Linux windows: Windows 386: i386 amd64: x86_64 ■ https://goreleaser.com ■ Cross-compile your Go project quick and easily ■ Release to GitHub, GitLab et.al ■ Create Docker images and manifests ■ Create Linux packages and Homebrew Taps ■ Upload to Bintray, Artifactory and other Public Blob Stores ■ … and much more!
  • 14. CLIs - The Swiss Army Knife of Dev and Ops
  • 15. The Basics of 12-factor CLI applications QAware | 15 ■ Great help is essential. What version am I on? ■ Prefer flags to positional arguments. ■ Mind the streams. stdout is for output, stderr is for messaging. ■ Handle things going wrong: error code, title, how to fix, URL, … ■ Be fancy: use colours, have shell completion. ■ Prompt if you can. ■ Be speedy. CLIs need to start fast. ■ Be clear about subcommands. For complete list and info, read https://medium.com/@jdxcode/12-factor-cli-apps-dd3c227a0e46
  • 16. QAware | 16 ■ https://github.com/spf13/cobra ■ Cobra is a library providing a simple interface to create powerful modern CLI interfaces similar to git & go tools. ■ Cobra is also an application that will generate your application scaffolding to rapidly develop a Cobra-based application. ■ Cobra is used in many Go projects such as Kubernetes, Docker, Skaffold, Helm and Istio just to name a few.
  • 17. QAware | 17 ■ https://github.com/spf13/viper ■ Viper is a library for configuration handling of Go applications. ■ It supports all types of configuration whether its YAML, environment variables, flags or remote config systems ■ Live watching and re-reading of config files included ■ Overwriting of configuration is built-in
  • 19. Container Orchestration Patterns QAware | 19 Sidecar Container Extended Container Behaviour ■ Log Extraction / Reformatting (fluentd, file beat) ■ Scheduling (cron, quartz) Ambassador Container Proxy Communication ■ TLS Tunnel (ghostunnel, Istio) ■ Circuit Breaking (linked, Istio) ■ Request Monitoring (linked, Istio) Adapter Container Standardized Ops Interfaces ■ Monitoring (Prometheus) ■ Configuration (ConfigMaps, Secrets, …)
  • 20. Use a multi-stage Dockerfile to build Linux binaries QAware | 20 FROM golang:1.15.2 as builder WORKDIR /build COPY . /build RUN go build -o logship-sidecar -ldflags="-s -w" FROM gcr.io/distroless/static-debian10 COPY --from=builder /build/logship-sidecar / ENV LOG_DIRECTORY=/logs ENV LOG_FILE_PATTERN=.+.gz ENV LOG_SCAN_INTERVAL=10 ENTRYPOINT ["/logship-sidecar"] CMD [""] Stage 1: Building Stage 2: Running
  • 21. QAware | 21 Operator. - Do stuff to my Kubernetes.
  • 22. What are operators? QAware | 22 ■ Operators are codified Ops procedures! ■ Operators are the path towards Zero-Ops. They enable auto- updating, self-monitoring and self-healing infrastructure and applications. ■ The concept was coined in the Kubernetes world. It’s now been adopted and used widespread in the cloud native world. ■ Examples: OKD, Sealed Secrets, Kube Monkey, Weave Flux
  • 23. Kubernetes API Extensions with Custom Resources QAware | 23 ■ User defined extensions of the Kubernetes APIs ■ Allow the abstraction of complex application constructs and concepts ■ Definition solely via CustomResourceDefinitions ■ Structure definition via OpenAPI v3.0 Validation Schema ■ Default Support for several API Features: CRUD, Watch, Discovery, json-patch, merge-patch, Admission Webhooks, Metadata, RBAC, … ■ Versioning und Conversion supported via Webhooks
  • 24. QAware | 24 apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: selector: matchLabels: app: nginx replicas: 2 template: metadata: labels: app: nginx environment: integration spec: containers: - name: nginx image: nginx:1.19.4-alpine ports: - containerPort: 80 # probe definitions # resource constraints # volumes and mounts apiVersion: v1 kind: Service metadata: name: nginx-service spec: type: LoadBalancer ports: - port: 80 protocol: TCP selector: app: nginx apiVersion: k8s.qaware.de/v1alpha1 kind: Microservice metadata: name: microservice-example labels: app: nginx spec: image: nginx:1.19.4-alpine replicas: 2 serviceType: LoadBalancer ports: - 80 + =
  • 26. Introducing the Operator SDK QAware | 26
  • 27. Cross-Cutting Concerns via Admission Controllers QAware | 27 ■ Admission Controllers are like (dynamic) plugins for Kubernetes ■ Security: increase security by mandating a reasonable security baseline across an entire namespace or cluster, e.g. PodSecurityPolicy, OPA. ■ Governance: apply and enforce the adherence to best practices, e.g. good labels, annotations, resource limits, probes. ■ Configuration Management: validate configuration of objects and prevent obvious misconfigurations from hitting the cluster. ■ More than 30 admission controllers shipped with Kubernetes, incl. the MutatingAdmissionWebhook and ValidatingAdmissionWebhook
  • 28. Mutating and Validating Admission Explained QAware | 28 TLS TLS POST /mutate POST /validate
  • 29. qaware.de QAware GmbH Aschauer Straße 32 81549 München Tel. +49 89 232315-0 info@qaware.de twitter.com/qaware linkedin.com/company/qaware-gmbh xing.com/companies/qawaregmbh slideshare.net/qaware github.com/qaware

Notas del editor

  1. Who are you?!
  2. Challenge 0 and Challenge 1.