Slide 1

Slide 1 text

Go? Bash! Meet the Shell-operator Go? Bash! Meet the Shell-operator Andrey Klimentyev & Dmitry Stolyarov

Slide 2

Slide 2 text

Go? Bash! Meet the Shell-operator Kubernetes API Basics

Slide 3

Slide 3 text

Go? Bash! Meet the Shell-operator backend-689bc4d4d5-rv4rq.yaml Deployment ReplicaSet Pod GET backend.yaml frontend.yaml …. .yaml backend-689bc4d4d5.yaml backend-cf789746c.yaml frontend-66544df5ff.yaml frontend-7b5f97db64.yaml frontend-65d68fd554.yaml …. .yaml backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml frontend-66544df5ff-dtnhn.yaml frontend-65d68fd554-twl85.yaml …. .yaml Simple HTTP API

Slide 4

Slide 4 text

Go? Bash! Meet the Shell-operator backend-689bc4d4d5-rv4rq.yaml Deployment ReplicaSet Pod PUT backend.yaml frontend.yaml …. .yaml backend-689bc4d4d5.yaml backend-cf789746c.yaml frontend-66544df5ff.yaml frontend-7b5f97db64.yaml frontend-65d68fd554.yaml …. .yaml backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml frontend-66544df5ff-dtnhn.yaml frontend-65d68fd554-twl85.yaml …. .yaml GET Simple HTTP API

Slide 5

Slide 5 text

Go? Bash! Meet the Shell-operator okay backend-689bc4d4d5-rv4rq.yaml Deployment ReplicaSet Pod PUT backend.yaml frontend.yaml …. .yaml backend-689bc4d4d5.yaml backend-cf789746c.yaml frontend-66544df5ff.yaml frontend-7b5f97db64.yaml frontend-65d68fd554.yaml …. .yaml backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml frontend-66544df5ff-dtnhn.yaml frontend-65d68fd554-twl85.yaml …. .yaml GET Simple HTTP API

Slide 6

Slide 6 text

Go? Bash! Meet the Shell-operator NO! backend-689bc4d4d5-rv4rq.yaml Deployment ReplicaSet Pod PUT backend.yaml frontend.yaml …. .yaml backend-689bc4d4d5.yaml backend-cf789746c.yaml frontend-66544df5ff.yaml frontend-7b5f97db64.yaml frontend-65d68fd554.yaml …. .yaml backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml frontend-66544df5ff-dtnhn.yaml frontend-65d68fd554-twl85.yaml …. .yaml GET Simple HTTP API

Slide 7

Slide 7 text

Go? Bash! Meet the Shell-operator backend-689bc4d4d5-rv4rq.yaml Deployment ReplicaSet Pod WATCH backend.yaml frontend.yaml …. .yaml backend-689bc4d4d5.yaml backend-cf789746c.yaml frontend-66544df5ff.yaml frontend-7b5f97db64.yaml frontend-65d68fd554.yaml …. .yaml backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml frontend-66544df5ff-dtnhn.yaml frontend-65d68fd554-twl85.yaml …. .yaml GET PUT Simple HTTP API

Slide 8

Slide 8 text

Go? Bash! Meet the Shell-operator GET PUT backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml frontend-66544df5ff-dtnhn.yaml frontend-65d68fd554-twl85.yaml …. .yaml backend-689bc4d4d5-rv4rq.yaml Deployment ReplicaSet Pod WATCH backend.yaml frontend.yaml …. .yaml backend-689bc4d4d5.yaml backend-cf789746c.yaml frontend-66544df5ff.yaml frontend-7b5f97db64.yaml frontend-65d68fd554.yaml …. .yaml Simple HTTP API

Slide 9

Slide 9 text

Go? Bash! Meet the Shell-operator GET PUT backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml frontend-66544df5ff-dtnhn.yaml frontend-65d68fd554-twl85.yaml …. .yaml backend-689bc4d4d5-rv4rq.yaml Deployment ReplicaSet Pod WATCH backend.yaml frontend.yaml …. .yaml backend-689bc4d4d5.yaml backend-cf789746c.yaml frontend-66544df5ff.yaml frontend-7b5f97db64.yaml frontend-65d68fd554.yaml …. .yaml Simple HTTP API

Slide 10

Slide 10 text

Go? Bash! Meet the Shell-operator GET PUT backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml frontend-66544df5ff-dtnhn.yaml frontend-65d68fd554-twl85.yaml …. .yaml backend-689bc4d4d5-rv4rq.yaml Deployment ReplicaSet Pod WATCH backend.yaml frontend.yaml …. .yaml backend-689bc4d4d5.yaml backend-cf789746c.yaml frontend-66544df5ff.yaml frontend-7b5f97db64.yaml frontend-65d68fd554.yaml …. .yaml Simple HTTP API

Slide 11

Slide 11 text

Go? Bash! Meet the Shell-operator GET PUT backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml frontend-66544df5ff-dtnhn.yaml frontend-65d68fd554-twl85.yaml …. .yaml backend-689bc4d4d5-rv4rq.yaml Deployment ReplicaSet Pod WATCH backend.yaml frontend.yaml …. .yaml backend-689bc4d4d5.yaml backend-cf789746c.yaml frontend-66544df5ff.yaml frontend-7b5f97db64.yaml frontend-65d68fd554.yaml …. .yaml Simple HTTP API

Slide 12

Slide 12 text

Go? Bash! Meet the Shell-operator GET PUT backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml frontend-66544df5ff-dtnhn.yaml frontend-65d68fd554-twl85.yaml …. .yaml backend-689bc4d4d5-rv4rq.yaml Deployment ReplicaSet Pod WATCH backend.yaml frontend.yaml …. .yaml backend-689bc4d4d5.yaml backend-cf789746c.yaml frontend-66544df5ff.yaml frontend-7b5f97db64.yaml frontend-65d68fd554.yaml …. .yaml Simple HTTP API

Slide 13

Slide 13 text

Go? Bash! Meet the Shell-operator GET PUT backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml frontend-66544df5ff-dtnhn.yaml frontend-65d68fd554-twl85.yaml …. .yaml backend-689bc4d4d5-rv4rq.yaml Deployment ReplicaSet Pod WATCH backend.yaml frontend.yaml …. .yaml backend-689bc4d4d5.yaml backend-cf789746c.yaml frontend-66544df5ff.yaml frontend-7b5f97db64.yaml frontend-65d68fd554.yaml …. .yaml Simple HTTP API

Slide 14

Slide 14 text

Go? Bash! Meet the Shell-operator backend-689bc4d4d5-rv4rq.yaml Deployment ReplicaSet Pod GET PUT WATCH backend.yaml frontend.yaml …. .yaml backend-689bc4d4d5.yaml backend-cf789746c.yaml frontend-66544df5ff.yaml frontend-7b5f97db64.yaml frontend-65d68fd554.yaml …. .yaml backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml frontend-66544df5ff-dtnhn.yaml frontend-65d68fd554-twl85.yaml …. .yaml Simple HTTP API

Slide 15

Slide 15 text

Go? Bash! Meet the Shell-operator backend-689bc4d4d5-rv4rq.yaml Deployment ReplicaSet Pod backend.yaml frontend.yaml …. .yaml backend-689bc4d4d5.yaml backend-cf789746c.yaml frontend-66544df5ff.yaml frontend-7b5f97db64.yaml frontend-65d68fd554.yaml …. .yaml backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml frontend-66544df5ff-dtnhn.yaml frontend-65d68fd554-twl85.yaml …. .yaml External world type #1 type #2

Slide 16

Slide 16 text

Go? Bash! Meet the Shell-operator User backend.yaml Deployment

Slide 17

Slide 17 text

Go? Bash! Meet the Shell-operator User Deployment Controller backend.yaml Deployment

Slide 18

Slide 18 text

Go? Bash! Meet the Shell-operator User Deployment Controller backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet

Slide 19

Slide 19 text

Go? Bash! Meet the Shell-operator Deployment Controller User backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet ReplicaSet Controller

Slide 20

Slide 20 text

Go? Bash! Meet the Shell-operator Deployment Controller User backend-689bc4d4d5-rv4rq.yaml backend-689bc4d4d5-qqbmn.yaml backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet Pod ReplicaSet Controller

Slide 21

Slide 21 text

Go? Bash! Meet the Shell-operator ReplicaSet Controller Deployment Controller User Scheduler backend-689bc4d4d5-rv4rq.yaml backend-689bc4d4d5-qqbmn.yaml backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet Pod

Slide 22

Slide 22 text

Go? Bash! Meet the Shell-operator ReplicaSet Controller Deployment Controller User Scheduler node-x node-y backend-689bc4d4d5-rv4rq.yaml backend-689bc4d4d5-qqbmn.yaml backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet Pod

Slide 23

Slide 23 text

Go? Bash! Meet the Shell-operator ReplicaSet Controller Scheduler node-x node-y Deployment Controller User backend-689bc4d4d5-rv4rq.yaml backend-689bc4d4d5-qqbmn.yaml backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet Pod Kubelet Kubelet

Slide 24

Slide 24 text

Go? Bash! Meet the Shell-operator ReplicaSet Controller Scheduler node-x node-y Deployment Controller User backend-689bc4d4d5-rv4rq.yaml backend-689bc4d4d5-qqbmn.yaml backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet Pod Kubelet Kubelet

Slide 25

Slide 25 text

Go? Bash! Meet the Shell-operator ReplicaSet Controller Scheduler node-x node-y Deployment Controller User backend-689bc4d4d5-rv4rq.yaml backend-689bc4d4d5-qqbmn.yaml backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet Pod Kubelet Kubelet Docker Docker

Slide 26

Slide 26 text

Go? Bash! Meet the Shell-operator ReplicaSet Controller Scheduler node-x node-y Deployment Controller User backend-689bc4d4d5-rv4rq.yaml backend-689bc4d4d5-qqbmn.yaml backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet Pod Kubelet Kubelet Docker Docker

Slide 27

Slide 27 text

Go? Bash! Meet the Shell-operator ReplicaSet Controller Scheduler node-x node-y Deployment Controller User backend-689bc4d4d5-rv4rq.yaml backend-689bc4d4d5-qqbmn.yaml backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet Pod Kubelet Kubelet Docker Docker

Slide 28

Slide 28 text

Go? Bash! Meet the Shell-operator Kubelet Kubelet Docker Docker Scheduler node-x node-y Deployment Controller User backend-689bc4d4d5-rv4rq.yaml backend-689bc4d4d5-qqbmn.yaml backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet Pod ReplicaSet Controller

Slide 29

Slide 29 text

Go? Bash! Meet the Shell-operator Kubelet Kubelet Docker Docker Scheduler node-x node-y Deployment Controller User backend-689bc4d4d5-rv4rq.yaml backend-689bc4d4d5-qqbmn.yaml backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet Pod ReplicaSet Controller

Slide 30

Slide 30 text

Go? Bash! Meet the Shell-operator User Kubelet Kubelet Docker Docker ReplicaSet Controller Scheduler node-x node-y Deployment Controller backend-689bc4d4d5-rv4rq.yaml backend-689bc4d4d5-qqbmn.yaml backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet Pod

Slide 31

Slide 31 text

Go? Bash! Meet the Shell-operator User Kubelet Kubelet Docker Docker ReplicaSet Controller Scheduler node-x node-y Deployment Controller backend-689bc4d4d5-rv4rq.yaml backend-689bc4d4d5-qqbmn.yaml backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet Pod

Slide 32

Slide 32 text

Go? Bash! Meet the Shell-operator Kubelet Kubelet Docker Docker ReplicaSet Controller Scheduler node-x node-y Deployment Controller backend-689bc4d4d5-rv4rq.yaml backend-689bc4d4d5-qqbmn.yaml backend.yaml backend-689bc4d4d5.yaml Deployment ReplicaSet Pod User

Slide 33

Slide 33 text

Go? Bash! Meet the Shell-operator default foo qux quux garply mysecret secret:yes secret:yes secret:yes kubernetes

Slide 34

Slide 34 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux garply mysecret mysecret mysecret secret:yes secret:yes mysecret secret:yes

Slide 35

Slide 35 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret secret:yes secret:yes mysecret secret:yes

Slide 36

Slide 36 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret secret:yes secret:yes secret:yes mysecret secret:yes

Slide 37

Slide 37 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret secret:yes secret:yes mysecret secret:yes mysecret secret:yes

Slide 38

Slide 38 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret secret:yes secret:yes mysecret secret:yes mysecret secret:yes

Slide 39

Slide 39 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret secret:yes secret:yes mysecret secret:yes mysecret

Slide 40

Slide 40 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret secret:yes secret:yes mysecret secret:yes mysecret

Slide 41

Slide 41 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret secret:yes secret:yes mysecret secret:yes

Slide 42

Slide 42 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret secret:yes secret:yes mysecret secret:yes

Slide 43

Slide 43 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret mysecret secret:yes secret:yes secret:yes

Slide 44

Slide 44 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret secret:yes secret:yes mysecret secret:yes

Slide 45

Slide 45 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret secret:yes secret:yes mysecret secret:yes

Slide 46

Slide 46 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret secret:yes secret:yes mysecret secret:yes

Slide 47

Slide 47 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret secret:yes secret:yes mysecret secret:yes

Slide 48

Slide 48 text

Go? Bash! Meet the Shell-operator shell-operator

Slide 49

Slide 49 text

Go? Bash! Meet the Shell-operator kubernetes #! /hooks/ foo.sh bar.py baz.rb

Slide 50

Slide 50 text

Go? Bash! Meet the Shell-operator kubernetes #! #! #! #!

Slide 51

Slide 51 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API #! #! #! #!

Slide 52

Slide 52 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API #! #! #! #!

Slide 53

Slide 53 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API #! #! #! #!

Slide 54

Slide 54 text

Go? Bash! Meet the Shell-operator Configuration Hook is executed with --config arg. 1 Hook should output YAML with its configuration. 2 Normal execution Hook is executed with no args. 1 Hook receives binding context. 2 once, on startup many times, on events

Slide 55

Slide 55 text

Go? Bash! Meet the Shell-operator #!/bin/bash source /shell_lib.sh function __config__() { } function __main__() { } hook::run "$@"

Slide 56

Slide 56 text

Go? Bash! Meet the Shell-operator #!/bin/bash source /shell_lib.sh function __config__() { cat << EOF configVersion: v1 # BINDING CONFIGURATION EOF } function __main__() { #THE LOGIC } hook::run "$@" cat << EOF configVersion: v1 # BINDING CONFIGURATION EOF

Slide 57

Slide 57 text

Go? Bash! Meet the Shell-operator #!/bin/bash source /shell_lib.sh function __config__() { cat << EOF configVersion: v1 # BINDING CONFIGURATION EOF } function __main__() { #THE LOGIC } hook::run "$@" #THE LOGIC

Slide 58

Slide 58 text

Go? Bash! Meet the Shell-operator #!/bin/bash source /shell_lib.sh function __config__() { cat << EOF configVersion: v1 # BINDING CONFIGURATION EOF } function __main__() { #THE LOGIC } hook::run "$@"

Slide 59

Slide 59 text

Go? Bash! Meet the Shell-operator default foo qux quux quuz garply waldo fred mysecret mysecret mysecret mysecret secret:yes secret:yes secret:yes kubernetes

Slide 60

Slide 60 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret mysecret secret:yes secret:yes secret:yes

Slide 61

Slide 61 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret mysecret secret:yes secret:yes secret:yes

Slide 62

Slide 62 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret mysecret secret:yes secret:yes secret:yes

Slide 63

Slide 63 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret mysecret secret:yes secret:yes secret:yes

Slide 64

Slide 64 text

Go? Bash! Meet the Shell-operator #!/bin/bash source /shell_lib.sh function __config__() { cat << EOF configVersion: v1 # BINDING CONFIGURATION EOF } function __main__() { } hook::run "$@" cat << EOF configVersion: v1 # BINDING CONFIGURATION EOF Binding configuration

Slide 65

Slide 65 text

Go? Bash! Meet the Shell-operator function __config__() { } cat << EOF configVersion: v1 # BINDING CONFIGURATION EOF Binding configuration

Slide 66

Slide 66 text

Go? Bash! Meet the Shell-operator function __config__() { } cat << EOF configVersion: v1 kubernetes: - name: src_secret apiVersion: v1 kind: Secret nameSelector: matchNames: - mysecret namespace: nameSelector: matchNames: ["default"] group: main EOF Binding configuration

Slide 67

Slide 67 text

Go? Bash! Meet the Shell-operator function __config__() { } cat << EOF configVersion: v1 kubernetes: - name: src_secret apiVersion: v1 kind: Secret nameSelector: matchNames: - mysecret namespace: nameSelector: matchNames: ["default"] group: main EOF Binding configuration

Slide 68

Slide 68 text

Go? Bash! Meet the Shell-operator function __config__() { } cat << EOF configVersion: v1 kubernetes: - name: src_secret apiVersion: v1 kind: Secret nameSelector: matchNames: - mysecret namespace: nameSelector: matchNames: ["default"] group: main EOF Binding configuration

Slide 69

Slide 69 text

Go? Bash! Meet the Shell-operator function __config__() { } cat << EOF configVersion: v1 kubernetes: - name: src_secret apiVersion: v1 kind: Secret nameSelector: matchNames: - mysecret namespace: nameSelector: matchNames: ["default"] group: main EOF Binding configuration

Slide 70

Slide 70 text

Go? Bash! Meet the Shell-operator function __config__() { } cat << EOF configVersion: v1 kubernetes: - name: src_secret apiVersion: v1 kind: Secret nameSelector: matchNames: - mysecret namespace: nameSelector: matchNames: ["default"] group: main EOF Binding configuration

Slide 71

Slide 71 text

Go? Bash! Meet the Shell-operator snapshots: src_secret: - object: apiVersion: v1 kind: Secret metadata: { … } data: { … } function __config__() { } cat << EOF configVersion: v1 kubernetes: - name: src_secret apiVersion: v1 kind: Secret nameSelector: matchNames: - mysecret namespace: nameSelector: matchNames: ["default"] group: main EOF Binding context Binding configuration

Slide 72

Slide 72 text

Go? Bash! Meet the Shell-operator snapshots: src_secret: - object: apiVersion: v1 kind: Secret metadata: { … } data: { … } function __config__() { } cat << EOF configVersion: v1 kubernetes: - name: src_secret apiVersion: v1 kind: Secret nameSelector: matchNames: - mysecret namespace: nameSelector: matchNames: ["default"] group: main EOF Binding context Binding configuration

Slide 73

Slide 73 text

Go? Bash! Meet the Shell-operator snapshots: src_secret: - object: apiVersion: v1 kind: Secret metadata: { … } data: { … } function __config__() { } cat << EOF configVersion: v1 kubernetes: - name: src_secret apiVersion: v1 kind: Secret nameSelector: matchNames: - mysecret namespace: nameSelector: matchNames: ["default"] group: main EOF Binding context Binding configuration

Slide 74

Slide 74 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret secret:yes secret:yes mysecret secret:yes

Slide 75

Slide 75 text

Go? Bash! Meet the Shell-operator - name: namespaces group: main apiVersion: v1 kind: Namespace jqFilter: | { namespace: .metadata.name, hasLabel: ( .metadata.labels // {} | contains({"secret": "yes"}) ) } group: main keepFullObjectsInMemory: false Binding configuration

Slide 76

Slide 76 text

Go? Bash! Meet the Shell-operator - name: namespaces group: main apiVersion: v1 kind: Namespace jqFilter: | { namespace: .metadata.name, hasLabel: ( .metadata.labels // {} | contains({"secret": "yes"}) ) } group: main keepFullObjectsInMemory: false Binding configuration

Slide 77

Slide 77 text

Go? Bash! Meet the Shell-operator - name: namespaces group: main apiVersion: v1 kind: Namespace jqFilter: | { namespace: .metadata.name, hasLabel: ( .metadata.labels // {} | contains({"secret": "yes"}) ) } group: main keepFullObjectsInMemory: false Binding configuration

Slide 78

Slide 78 text

Go? Bash! Meet the Shell-operator # kubectl get ns foo -o json | jq '{ > "name": .metadata.name, > "hasLabel": ( .metadata.labels // {} | contains({"secret": "yes"}) ) > }' { "name": "kube-system", "hasLabel": true }

Slide 79

Slide 79 text

Go? Bash! Meet the Shell-operator - name: namespaces group: main apiVersion: v1 kind: Namespace jqFilter: | { namespace: .metadata.name, hasLabel: ( .metadata.labels // {} | contains({"secret": "yes"}) ) } group: main keepFullObjectsInMemory: false Binding configuration Binding configuration

Slide 80

Slide 80 text

Go? Bash! Meet the Shell-operator snapshots: namespaces: - filterResult: namespace: foo hasLabel: true - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - filterResult: namespace: quz hasLabel: false - ... - name: namespaces group: main apiVersion: v1 kind: Namespace jqFilter: | { namespace: .metadata.name, hasLabel: ( .metadata.labels // {} | contains({"secret": "yes"}) ) } group: main keepFullObjectsInMemory: false Binding context Binding configuration

Slide 81

Slide 81 text

Go? Bash! Meet the Shell-operator snapshots: namespaces: - filterResult: namespace: foo hasLabel: true - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - filterResult: namespace: quz hasLabel: false - ... - name: namespaces group: main apiVersion: v1 kind: Namespace jqFilter: | { namespace: .metadata.name, hasLabel: ( .metadata.labels // {} | contains({"secret": "yes"}) ) } group: main keepFullObjectsInMemory: false Binding context Binding configuration

Slide 82

Slide 82 text

Go? Bash! Meet the Shell-operator snapshots: namespaces: - filterResult: namespace: foo hasLabel: true - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - filterResult: namespace: quz hasLabel: false - ... - name: namespaces group: main apiVersion: v1 kind: Namespace jqFilter: | { namespace: .metadata.name, hasLabel: ( .metadata.labels // {} | contains({"secret": "yes"}) ) } group: main keepFullObjectsInMemory: false Binding context Binding configuration

Slide 83

Slide 83 text

Go? Bash! Meet the Shell-operator snapshots: namespaces: - filterResult: namespace: foo hasLabel: true - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - ... - name: namespaces group: main apiVersion: v1 kind: Namespace jqFilter: | { namespace: .metadata.name, hasLabel: ( .metadata.labels // {} | contains({"secret": "yes"}) ) } group: main keepFullObjectsInMemory: false Binding context Binding configuration

Slide 84

Slide 84 text

Go? Bash! Meet the Shell-operator snapshots: namespaces: - filterResult: namespace: foo hasLabel: true object: apiVersion: v1 kind: Namespace metadata: { … } - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - ... - name: namespaces group: main apiVersion: v1 kind: Namespace jqFilter: | { namespace: .metadata.name, hasLabel: ( .metadata.labels // {} | contains({"secret": "yes"}) ) } group: main keepFullObjectsInMemory: false Binding context Binding configuration

Slide 85

Slide 85 text

Go? Bash! Meet the Shell-operator snapshots: namespaces: - filterResult: namespace: foo hasLabel: true object: apiVersion: v1 kind: Namespace metadata: { … } - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - ... - name: namespaces group: main apiVersion: v1 kind: Namespace jqFilter: | { namespace: .metadata.name, hasLabel: ( .metadata.labels // {} | contains({"secret": "yes"}) ) } group: main keepFullObjectsInMemory: false Binding context Binding configuration

Slide 86

Slide 86 text

Go? Bash! Meet the Shell-operator snapshots: namespaces: - filterResult: namespace: foo hasLabel: true object: apiVersion: v1 kind: Namespace metadata: { … } - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - ... - name: namespaces group: main apiVersion: v1 kind: Namespace jqFilter: | { namespace: .metadata.name, hasLabel: ( .metadata.labels // {} | contains({"secret": "yes"}) ) } group: main keepFullObjectsInMemory: false Binding context Binding configuration

Slide 87

Slide 87 text

Go? Bash! Meet the Shell-operator kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret secret:yes secret:yes mysecret secret:yes

Slide 88

Slide 88 text

Go? Bash! Meet the Shell-operator - name: dst_secrets apiVersion: v1 kind: Secret labelSelector: matchLabels: managed-secret: "yes" jqFilter: | { "namespace": .metadata.namespace, "resourceVersion": .metadata.annotations.resourceVersion } group: main keepFullObjectsInMemory: false Binding configuration

Slide 89

Slide 89 text

Go? Bash! Meet the Shell-operator - name: dst_secrets apiVersion: v1 kind: Secret labelSelector: matchLabels: managed-secret: "yes" jqFilter: | { "namespace": .metadata.namespace, "resourceVersion": .metadata.annotations.resourceVersion } group: main keepFullObjectsInMemory: false Binding configuration

Slide 90

Slide 90 text

Go? Bash! Meet the Shell-operator - name: dst_secrets apiVersion: v1 kind: Secret labelSelector: matchLabels: managed-secret: "yes" jqFilter: | { "namespace": .metadata.namespace, "resourceVersion": .metadata.annotations.resourceVersion } group: main keepFullObjectsInMemory: false Binding configuration

Slide 91

Slide 91 text

Go? Bash! Meet the Shell-operator snapshots: dst_secrets: - filterResult: namespace: foo resourceVersion: 123456 - name: dst_secrets apiVersion: v1 kind: Secret labelSelector: matchLabels: managed-secret: "yes" jqFilter: | { "namespace": .metadata.namespace, "resourceVersion": .metadata.annotations.resourceVersion } group: main keepFullObjectsInMemory: false Binding context Binding configuration

Slide 92

Slide 92 text

Go? Bash! Meet the Shell-operator snapshots: dst_secrets: - filterResult: namespace: foo resourceVersion: 123456 - name: dst_secrets apiVersion: v1 kind: Secret labelSelector: matchLabels: managed-secret: "yes" jqFilter: | { "namespace": .metadata.namespace, "resourceVersion": .metadata.annotations.resourceVersion } group: main keepFullObjectsInMemory: false Binding context Binding configuration

Slide 93

Slide 93 text

Go? Bash! Meet the Shell-operator namespaces: - filterResult: namespace: foo hasLabel: true - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - filterResult: namespace: quz hasLabel: false - ... dst_secrets: - filterResult: namespace: foo resourceVersion: 123456 - filterResult: namespace: corge resourceVersion: 123456 - filterResult: namespace: xyzzy resourceVersion: 123456 src_secret: - object: apiVersion: v1 kind: Secret metadata: { … } spec: { … }

Slide 94

Slide 94 text

Go? Bash! Meet the Shell-operator namespaces: - filterResult: namespace: foo hasLabel: true - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - filterResult: namespace: quz hasLabel: false - ... dst_secrets: - filterResult: namespace: foo resourceVersion: 123456 - filterResult: namespace: corge resourceVersion: 123456 - filterResult: namespace: xyzzy resourceVersion: 123456 src_secret: - object: apiVersion: v1 kind: Secret metadata: { … } spec: { … }

Slide 95

Slide 95 text

Go? Bash! Meet the Shell-operator namespaces: - filterResult: namespace: foo hasLabel: true - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - filterResult: namespace: quz hasLabel: false - ... dst_secrets: - filterResult: namespace: foo resourceVersion: 123456 - filterResult: namespace: corge resourceVersion: 123456 - filterResult: namespace: xyzzy resourceVersion: 123456 src_secret: - object: apiVersion: v1 kind: Secret metadata: { … } spec: { … }

Slide 96

Slide 96 text

Go? Bash! Meet the Shell-operator namespaces: - filterResult: namespace: foo hasLabel: true - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - filterResult: namespace: quz hasLabel: false - ... dst_secrets: - filterResult: namespace: foo resourceVersion: 123456 - filterResult: namespace: corge resourceVersion: 123456 - filterResult: namespace: xyzzy resourceVersion: 123456 src_secret: - object: apiVersion: v1 kind: Secret metadata: { … } spec: { … }

Slide 97

Slide 97 text

Go? Bash! Meet the Shell-operator Is in sync with ? do nothing yes kubectl create or replace no dst_secrets: - filterResult: namespace: foo resourceVersion: 123456 - filterResult: namespace: corge resourceVersion: 123456 - filterResult: namespace: xyzzy resourceVersion: 123456 src_secret: - object: apiVersion: v1 kind: Secret metadata: { … } spec: { … } namespaces: - filterResult: namespace: foo hasLabel: true - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - filterResult: namespace: quz hasLabel: false - ...

Slide 98

Slide 98 text

Go? Bash! Meet the Shell-operator namespaces: - filterResult: namespace: foo hasLabel: true - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - filterResult: namespace: quz hasLabel: false - ... dst_secrets: - filterResult: namespace: foo resourceVersion: 123456 - filterResult: namespace: corge resourceVersion: 123456 - filterResult: namespace: xyzzy resourceVersion: 123456 src_secret: - object: apiVersion: v1 kind: Secret metadata: { … } spec: { … }

Slide 99

Slide 99 text

Go? Bash! Meet the Shell-operator namespaces: - filterResult: namespace: foo hasLabel: true - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - filterResult: namespace: quz hasLabel: false - ... dst_secrets: - filterResult: namespace: foo resourceVersion: 123456 - filterResult: namespace: corge resourceVersion: 123456 - filterResult: namespace: xyzzy resourceVersion: 123456 src_secret: - object: apiVersion: v1 kind: Secret metadata: { … } spec: { … }

Slide 100

Slide 100 text

Go? Bash! Meet the Shell-operator namespaces: - filterResult: namespace: foo hasLabel: true - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - filterResult: namespace: quz hasLabel: false - ... dst_secrets: - filterResult: namespace: foo resourceVersion: 123456 - filterResult: namespace: corge resourceVersion: 123456 - filterResult: namespace: xyzzy resourceVersion: 123456 src_secret: - object: apiVersion: v1 kind: Secret metadata: { … } spec: { … }

Slide 101

Slide 101 text

Go? Bash! Meet the Shell-operator namespaces: - filterResult: namespace: foo hasLabel: true - filterResult: namespace: bar hasLabel: false - filterResult: namespace: baz hasLabel: false - filterResult: namespace: quz hasLabel: false - ... Does exist? kubectl delete yes do nothing no dst_secrets: - filterResult: namespace: foo resourceVersion: 123456 - filterResult: namespace: corge resourceVersion: 123456 - filterResult: namespace: xyzzy resourceVersion: 123456 src_secret: - object: apiVersion: v1 kind: Secret metadata: { … } spec: { … }

Slide 102

Slide 102 text

Go? Bash! Meet the Shell-operator function __main__() { }

Slide 103

Slide 103 text

Go? Bash! Meet the Shell-operator function __main__() { for i in $(seq 0 "$(context::jq -r '(.snapshots.namespaces | length) - 1')"); do ns_name="$(context::jq -r '.snapshots.namespaces['"$i"'].filterResult.name')" if context::jq -e '.snapshots.namespaces['"$i"'].filterResult.hasLabel'; then sync_secret "$ns_name" else delete_secret "$ns_name" fi done }

Slide 104

Slide 104 text

Go? Bash! Meet the Shell-operator function __main__() { for i in $(seq 0 "$(context::jq -r '(.snapshots.namespaces | length) - 1')"); do ns_name="$(context::jq -r '.snapshots.namespaces['"$i"'].filterResult.name')" if context::jq -e '.snapshots.namespaces['"$i"'].filterResult.hasLabel'; then sync_secret "$ns_name" else delete_secret "$ns_name" fi done }

Slide 105

Slide 105 text

Go? Bash! Meet the Shell-operator function __main__() { for i in $(seq 0 "$(context::jq -r '(.snapshots.namespaces | length) - 1')"); do ns_name="$(context::jq -r '.snapshots.namespaces['"$i"'].filterResult.name')" if context::jq -e '.snapshots.namespaces['"$i"'].filterResult.hasLabel'; then sync_secret "$ns_name" else delete_secret "$ns_name" fi done }

Slide 106

Slide 106 text

Go? Bash! Meet the Shell-operator function __main__() { for i in $(seq 0 "$(context::jq -r '(.snapshots.namespaces | length) - 1')"); do ns_name="$(context::jq -r '.snapshots.namespaces['"$i"'].filterResult.name')" if context::jq -e '.snapshots.namespaces['"$i"'].filterResult.hasLabel'; then sync_secret "$ns_name" else delete_secret "$ns_name" fi done }

Slide 107

Slide 107 text

Go? Bash! Meet the Shell-operator function delete_secret() { if context::jq -e --arg ns "$1" 'select(.snapshots…namespace == $ns)' ; then kubectl -n "$1" delete secret "mysecret" fi }

Slide 108

Slide 108 text

Go? Bash! Meet the Shell-operator function delete_secret() { if context::jq -e --arg ns "$1" 'select(.snapshots…namespace == $ns)' ; then kubectl -n "$1" delete secret "mysecret" fi }

Slide 109

Slide 109 text

Go? Bash! Meet the Shell-operator function delete_secret() { if context::jq -e --arg ns "$1" 'select(.snapshots…namespace == $ns)' ; then kubectl -n "$1" delete secret "mysecret" fi }

Slide 110

Slide 110 text

Go? Bash! Meet the Shell-operator function delete_secret() { if context::jq -e --arg ns "$1" 'select(.snapshots…namespace == $ns)' ; then kubectl -n "$1" delete secret "mysecret" fi } function sync_secret() { src_resource_version="$(…)" dst_secret_resource_version="$(…)" if [ "$src_resource_version" != "$dst_resource_version" ] ; then new_secret="$(context::jq -r '.snapshots.src_secret[0].object | …)" kubectl -n "$1" replace -f <(echo "$new_secret") || kubectl -n "$1" create -f <(echo "$new_secret") fi }

Slide 111

Slide 111 text

Go? Bash! Meet the Shell-operator function delete_secret() { if context::jq -e --arg ns "$1" 'select(.snapshots…namespace == $ns)' ; then kubectl -n "$1" delete secret "mysecret" fi } function sync_secret() { src_resource_version="$(…)" dst_secret_resource_version="$(…)" if [ "$src_resource_version" != "$dst_resource_version" ] ; then new_secret="$(context::jq -r '.snapshots.src_secret[0].object | …)" kubectl -n "$1" replace -f <(echo "$new_secret") || kubectl -n "$1" create -f <(echo "$new_secret") fi }

Slide 112

Slide 112 text

Go? Bash! Meet the Shell-operator function delete_secret() { if context::jq -e --arg ns "$1" 'select(.snapshots…namespace == $ns)' ; then kubectl -n "$1" delete secret "mysecret" fi } function sync_secret() { src_resource_version="$(…)" dst_secret_resource_version="$(…)" if [ "$src_resource_version" != "$dst_resource_version" ] ; then new_secret="$(context::jq -r '.snapshots.src_secret[0].object | …)" kubectl -n "$1" replace -f <(echo "$new_secret") || kubectl -n "$1" create -f <(echo "$new_secret") fi }

Slide 113

Slide 113 text

Go? Bash! Meet the Shell-operator function delete_secret() { if context::jq -e --arg ns "$1" 'select(.snapshots…namespace == $ns)' ; then kubectl -n "$1" delete secret "mysecret" fi } function sync_secret() { src_resource_version="$(…)" dst_secret_resource_version="$(…)" if [ "$src_resource_version" != "$dst_resource_version" ] ; then new_secret="$(context::jq -r '.snapshots.src_secret[0].object | …)" kubectl -n "$1" replace -f <(echo "$new_secret") || kubectl -n "$1" create -f <(echo "$new_secret") fi }

Slide 114

Slide 114 text

Go? Bash! Meet the Shell-operator function delete_secret() { if context::jq -e --arg ns "$1" 'select(.snapshots…namespace == $ns)' ; then kubectl -n "$1" delete secret "mysecret" fi } function sync_secret() { src_resource_version="$(…)" dst_secret_resource_version="$(…)" if [ "$src_resource_version" != "$dst_resource_version" ] ; then new_secret="$(context::jq -r '.snapshots.src_secret[0].object | …)" kubectl -n "$1" replace -f <(echo "$new_secret") || kubectl -n "$1" create -f <(echo "$new_secret") fi }

Slide 115

Slide 115 text

Go? Bash! Meet the Shell-operator function delete_secret() { if context::jq -e --arg ns "$1" 'select(.snapshots…namespace == $ns)' ; then kubectl -n "$1" delete secret "mysecret" fi } function sync_secret() { src_resource_version="$(…)" dst_secret_resource_version="$(…)" if [ "$src_resource_version" != "$dst_resource_version" ] ; then new_secret="$(context::jq -r '.snapshots.src_secret[0].object | …)" kubectl -n "$1" replace -f <(echo "$new_secret") || kubectl -n "$1" create -f <(echo "$new_secret") fi }

Slide 116

Slide 116 text

Go? Bash! Meet the Shell-operator function delete_secret() { if context::jq -e --arg ns "$1" 'select(.snapshots…namespace == $ns)' ; then kubectl -n "$1" delete secret "mysecret" fi } function sync_secret() { src_resource_version="$(…)" dst_secret_resource_version="$(…)" if [ "$src_resource_version" != "$dst_resource_version" ] ; then new_secret="$(context::jq -r '.snapshots.src_secret[0].object | …)" kubectl -n "$1" replace -f <(echo "$new_secret") || kubectl -n "$1" create -f <(echo "$new_secret") fi }

Slide 117

Slide 117 text

Go? Bash! Meet the Shell-operator function delete_secret() { if context::jq -e --arg ns "$1" 'select(.snapshots…namespace == $ns)' ; then kubectl -n "$1" delete secret "mysecret" fi } function sync_secret() { src_resource_version="$(…)" dst_secret_resource_version="$(…)" if [ "$src_resource_version" != "$dst_resource_version" ] ; then new_secret="$(context::jq -r '.snapshots.src_secret[0].object | …)" kubectl -n "$1" replace -f <(echo "$new_secret") || kubectl -n "$1" create -f <(echo "$new_secret") fi }

Slide 118

Slide 118 text

Go? Bash! Meet the Shell-operator function delete_secret() { if context::jq -e --arg ns "$1" 'select(.snapshots…namespace == $ns)' ; then kubectl -n "$1" delete secret "mysecret" fi } function sync_secret() { src_resource_version="$(…)" dst_secret_resource_version="$(…)" if [ "$src_resource_version" != "$dst_resource_version" ] ; then new_secret="$(context::jq -r '.snapshots.src_secret[0].object | …)" kubectl -n "$1" replace -f <(echo "$new_secret") || kubectl -n "$1" create -f <(echo "$new_secret") fi }

Slide 119

Slide 119 text

Go? Bash! Meet the Shell-operator 35 lines in yaml configVersion: v1 kubernetes: - name: src_secret apiVersion: v1 kind: Secret nameSelector: matchNames: - mysecret namespace: nameSelector: matchNames: ["default"] group: main - name: dst_secrets apiVersion: v1 kind: Secret labelSelector: matchLabels: managed-secret: "yes" jqFilter: | { "namespace": .metadata.namespace, "resourceVersion": .annotations."resourceVersion" } group: main keepFullObjectsInMemory: false - name: namespaces group: main apiVersion: v1 kind: Namespace jqFilter: | { name: .metadata.name, hasLabel: (.metadata.labels // {} | contains({"secret": "yes"})) } group: main keepFullObjectsInMemory: false 20 lines in bash #! + + shell-operator function __main__() { for i in $(seq 0 "$(context::jq -r '(.snapshots.namespaces | length) - 1')"); do ns_name="$(context::jq -r '.snapshots.namespaces['"$i"'].filterResult.name')" if context::jq -e '.snapshots.namespaces['"$i"'].filterResult.hasLabel'; then sync_secret "$ns_name" else delete_secret "$ns_name" fi done } function delete_secret() { if context::jq -e --arg ns "$1" 'select(.snapshots…namespace == $ns)' ; then kubectl -n "$1" delete secret "mysecret" fi } function sync_secret() { src_resource_version="$(…)" dst_secret_resource_version="$(…)" if [ "$src_resource_version" != "$dst_resource_version" ] ; then new_secret="$(context::jq -r '.snapshots.src_secret[0].object | …)" kubectl -n "$1" replace -f <(echo "$new_secret") || kubectl -n "$1" create -f <(echo "$new_secret") fi } kubernetes default foo qux quux quuz garply waldo fred mysecret mysecret mysecret mysecret secret:yes secret:yes secret:yes

Slide 120

Slide 120 text

Go? Bash! Meet the Shell-operator kubernetes

Slide 121

Slide 121 text

Go? Bash! Meet the Shell-operator kubernetes Config Map

Slide 122

Slide 122 text

Go? Bash! Meet the Shell-operator apiVersion: apps/v1 kind: Deployment metadata: name: foo spec: template: spec: containers: - name: bar image: registry.example.com/myapp:v1.0.0 env: - name: DB_USER valueFrom: configMapKeyRef: name: foo key: db_user - name: DB_PASSWORD valueFrom: configMapKeyRef: name: foo key: db_password ENV

Slide 123

Slide 123 text

Go? Bash! Meet the Shell-operator apiVersion: apps/v1 kind: Deployment metadata: name: foo spec: template: spec: containers: - name: bar image: registry.example.com/myapp:v1.0.0 volumeMounts: - mountPath: /etc/config name: config volumes: - name: config configMap: name: foo items: - key: config.yaml path: config.yaml Mount

Slide 124

Slide 124 text

Go? Bash! Meet the Shell-operator Config Map kubernetes

Slide 125

Slide 125 text

Go? Bash! Meet the Shell-operator kubernetes Config Map v.1

Slide 126

Slide 126 text

Go? Bash! Meet the Shell-operator kubernetes Config Map v.1 v.1 v.1 v.1

Slide 127

Slide 127 text

Go? Bash! Meet the Shell-operator kubernetes Config Map v.2 v.1 v.1 v.1

Slide 128

Slide 128 text

Go? Bash! Meet the Shell-operator apiVersion: apps/v1 kind: Deployment metadata: name: foo spec: template: spec: containers: - name: bar image: registry.example.com/myapp:v1.0.0 env: - name: DB_USER valueFrom: configMapKeyRef: name: foo key: db_user - name: DB_PASSWORD valueFrom: configMapKeyRef: name: foo key: db_password

Slide 129

Slide 129 text

Go? Bash! Meet the Shell-operator apiVersion: apps/v1 kind: Deployment metadata: name: foo spec: template: spec: containers: - name: bar image: registry.example.com/myapp:v1.0.0 env: - name: DB_USER valueFrom: configMapKeyRef: name: foo key: db_user - name: DB_PASSWORD valueFrom: configMapKeyRef: name: foo key: db_password

Slide 130

Slide 130 text

Go? Bash! Meet the Shell-operator apiVersion: apps/v1 kind: Deployment metadata: name: foo spec: template: metadata: annotations: config/checksum: b4d6b660fffb798dcaca5b8a spec: containers: - name: bar image: registry.example.com/myapp:v1.0.0 env: - name: DB_USER valueFrom: configMapKeyRef: name: foo key: db_user - name: DB_PASSWORD valueFrom: configMapKeyRef: name: foo key: db_password

Slide 131

Slide 131 text

Go? Bash! Meet the Shell-operator kubernetes Config Map

Slide 132

Slide 132 text

Go? Bash! Meet the Shell-operator kubernetes Config Map b4d6b6

Slide 133

Slide 133 text

Go? Bash! Meet the Shell-operator kubernetes Config Map b4d6b6 b4d6b6 b4d6b6 b4d6b6

Slide 134

Slide 134 text

Go? Bash! Meet the Shell-operator kubernetes Config Map b4d6b6 b4d6b6 b4d6b6 b4d6b6

Slide 135

Slide 135 text

Go? Bash! Meet the Shell-operator kubernetes Config Map b4d6b6 b4d6b6 b4d6b6 b4d6b6

Slide 136

Slide 136 text

Go? Bash! Meet the Shell-operator kubernetes Config Map b4d6b6 b4d6b6 b4d6b6 b4d6b6

Slide 137

Slide 137 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map b4d6b6 b4d6b6 b4d6b6 b4d6b6

Slide 138

Slide 138 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map b4d6b6 b4d6b6 b4d6b6 b4d6b6

Slide 139

Slide 139 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map b4d6b6 b4d6b6 b4d6b6 b4d6b6

Slide 140

Slide 140 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map b4d6b6 b4d6b6 b4d6b6 b4d6b6

Slide 141

Slide 141 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map b4d6b6 b4d6b6 b4d6b6 b4d6b6

Slide 142

Slide 142 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map b4d6b6 b4d6b6 b4d6b6 b4d6b6

Slide 143

Slide 143 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map c0ee75 b4d6b6 b4d6b6 b4d6b6

Slide 144

Slide 144 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map c0ee75 b4d6b6 b4d6b6 b4d6b6

Slide 145

Slide 145 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map c0ee75 b4d6b6 b4d6b6

Slide 146

Slide 146 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map c0ee75 c0ee75 b4d6b6 b4d6b6

Slide 147

Slide 147 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map c0ee75 c0ee75 b4d6b6 b4d6b6

Slide 148

Slide 148 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map c0ee75 c0ee75 b4d6b6

Slide 149

Slide 149 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map c0ee75 c0ee75 c0ee75 b4d6b6

Slide 150

Slide 150 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map c0ee75 c0ee75 c0ee75

Slide 151

Slide 151 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map c0ee75 c0ee75 c0ee75 c0ee75

Slide 152

Slide 152 text

Go? Bash! Meet the Shell-operator kubernetes #! Config Map c0ee75 c0ee75 c0ee75 c0ee75

Slide 153

Slide 153 text

Go? Bash! Meet the Shell-operator backend.yaml Deployment backend-689bc4d4d5.yaml ReplicaSet backend-689bc4d4d5-rv4rq.yaml Pod backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml

Slide 154

Slide 154 text

Go? Bash! Meet the Shell-operator backend.yaml Deployment backend-689bc4d4d5.yaml ReplicaSet backend-689bc4d4d5-rv4rq.yaml Pod backend-cf789746c-qqbmn.yaml backend-cf789746c-l9sfr.yaml a-users.yaml MysqlDatabase a-archive.yaml Custom Resource Definitions

Slide 155

Slide 155 text

Go? Bash! Meet the Shell-operator apiVersion: example.com/v1alpha1 kind: MysqlDatabase metadata: name: foo namespace: bar

Slide 156

Slide 156 text

Go? Bash! Meet the Shell-operator kubernetes foo bar baz qux

Slide 157

Slide 157 text

Go? Bash! Meet the Shell-operator kubernetes foo main bar main baz main qux main another

Slide 158

Slide 158 text

Go? Bash! Meet the Shell-operator kubernetes foo main bar main baz main qux main another #!

Slide 159

Slide 159 text

Go? Bash! Meet the Shell-operator kubernetes foo main bar main baz main qux main another #! server

Slide 160

Slide 160 text

Go? Bash! Meet the Shell-operator kubernetes server foo main bar main baz main qux main another #! foo.main bar.main baz.main baz.another qux.main

Slide 161

Slide 161 text

Go? Bash! Meet the Shell-operator configVersion: v1 kubernetes: - name: nodes apiVersion: v1 kind: Node jqFilter: | { name: .metadata.name, ip: ( .status.addresses[] | select(.type == "InternalIP") | .address ) } group: main keepFullObjectsInMemory: false

Slide 162

Slide 162 text

Go? Bash! Meet the Shell-operator configVersion: v1 kubernetes: - name: nodes apiVersion: v1 kind: Node jqFilter: | { name: .metadata.name, ip: ( .status.addresses[] | select(.type == "InternalIP") | .address ) } group: main keepFullObjectsInMemory: false

Slide 163

Slide 163 text

Go? Bash! Meet the Shell-operator configVersion: v1 kubernetes: - name: nodes apiVersion: v1 kind: Node jqFilter: | { name: .metadata.name, ip: ( .status.addresses[] | select(.type == "InternalIP") | .address ) } group: main keepFullObjectsInMemory: false

Slide 164

Slide 164 text

Go? Bash! Meet the Shell-operator configVersion: v1 kubernetes: - name: nodes apiVersion: v1 kind: Node jqFilter: | { name: .metadata.name, ip: ( .status.addresses[] | select(.type == "InternalIP") | .address ) } group: main keepFullObjectsInMemory: false executeHookOnEvent: []

Slide 165

Slide 165 text

Go? Bash! Meet the Shell-operator configVersion: v1 kubernetes: - name: nodes apiVersion: v1 kind: Node jqFilter: | { name: .metadata.name, ip: ( .status.addresses[] | select(.type == "InternalIP") | .address ) } group: main keepFullObjectsInMemory: false executeHookOnEvent: [] schedule: - name: every_minute group: main crontab: "* * * * *"

Slide 166

Slide 166 text

Go? Bash! Meet the Shell-operator function __main__() { for i in $(seq 0 "$(context::jq -r '(.snapshots.nodes | length) - 1')"); do node_name="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.name')" node_ip="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.ip')" packets_lost=0 if ping -c 1 $node_ip -t 1 ; then packets_lost=1 fi cat <<-END { "name": "node_packets_lost", "add": $packets_lost, "labels": { "node": $node_name, } } END >> $METRICS_PATH done }

Slide 167

Slide 167 text

Go? Bash! Meet the Shell-operator function __main__() { for i in $(seq 0 "$(context::jq -r '(.snapshots.nodes | length) - 1')"); do node_name="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.name')" node_ip="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.ip')" packets_lost=0 if ping -c 1 $node_ip -t 1 ; then packets_lost=1 fi cat <<-END { "name": "node_packets_lost", "add": $packets_lost, "labels": { "node": $node_name, } } END >> $METRICS_PATH done }

Slide 168

Slide 168 text

Go? Bash! Meet the Shell-operator function __main__() { for i in $(seq 0 "$(context::jq -r '(.snapshots.nodes | length) - 1')"); do node_name="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.name')" node_ip="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.ip')" packets_lost=0 if ping -c 1 $node_ip -t 1 ; then packets_lost=1 fi cat <<-END { "name": "node_packets_lost", "add": $packets_lost, "labels": { "node": $node_name, } } END >> $METRICS_PATH done }

Slide 169

Slide 169 text

Go? Bash! Meet the Shell-operator function __main__() { for i in $(seq 0 "$(context::jq -r '(.snapshots.nodes | length) - 1')"); do node_name="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.name')" node_ip="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.ip')" packets_lost=0 if ping -c 1 $node_ip -t 1 ; then packets_lost=1 fi cat <<-END { "name": "node_packets_lost", "add": $packets_lost, "labels": { "node": $node_name, } } END >> $METRICS_PATH done }

Slide 170

Slide 170 text

Go? Bash! Meet the Shell-operator function __main__() { for i in $(seq 0 "$(context::jq -r '(.snapshots.nodes | length) - 1')"); do node_name="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.name')" node_ip="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.ip')" packets_lost=0 if ping -c 1 $node_ip -t 1 ; then packets_lost=1 fi cat <<-END { "name": "node_packets_lost", "add": $packets_lost, "labels": { "node": $node_name, } } END >> $METRICS_PATH done }

Slide 171

Slide 171 text

Go? Bash! Meet the Shell-operator function __main__() { for i in $(seq 0 "$(context::jq -r '(.snapshots.nodes | length) - 1')"); do node_name="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.name')" node_ip="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.ip')" packets_lost=0 if ping -c 1 $node_ip -t 1 ; then packets_lost=1 fi cat <<-END { "name": "node_packets_lost", "add": $packets_lost, "labels": { "node": $node_name, } } END >> $METRICS_PATH done }

Slide 172

Slide 172 text

Go? Bash! Meet the Shell-operator function __main__() { for i in $(seq 0 "$(context::jq -r '(.snapshots.nodes | length) - 1')"); do node_name="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.name')" node_ip="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.ip')" packets_lost=0 if ping -c 1 $node_ip -t 1 ; then packets_lost=1 fi cat <<-END { "name": "node_packets_lost", "add": $packets_lost, "labels": { "node": $node_name, } } END >> $METRICS_PATH done }

Slide 173

Slide 173 text

Go? Bash! Meet the Shell-operator function __main__() { for i in $(seq 0 "$(context::jq -r '(.snapshots.nodes | length) - 1')"); do node_name="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.name')" node_ip="$(context::jq -r '.snapshots.nodes['"$i"'].filterResult.ip')" packets_lost=0 if ping -c 1 $node_ip -t 1 ; then packets_lost=1 fi cat <<-END { "name": "node_packets_lost", "add": $packets_lost, "labels": { "node": $node_name, } } END >> $METRICS_PATH done }

Slide 174

Slide 174 text

Go? Bash! Meet the Shell-operator

Slide 175

Slide 175 text

Go? Bash! Meet the Shell-operator #!

Slide 176

Slide 176 text

Go? Bash! Meet the Shell-operator #!

Slide 177

Slide 177 text

Go? Bash! Meet the Shell-operator #! #!

Slide 178

Slide 178 text

Go? Bash! Meet the Shell-operator #! #!

Slide 179

Slide 179 text

Go? Bash! Meet the Shell-operator #! #! #!

Slide 180

Slide 180 text

Go? Bash! Meet the Shell-operator #! #! #!

Slide 181

Slide 181 text

Go? Bash! Meet the Shell-operator #! #! #! #! #! #!

Slide 182

Slide 182 text

Go? Bash! Meet the Shell-operator #! #! #! #! #! #!

Slide 183

Slide 183 text

Go? Bash! Meet the Shell-operator #!

Slide 184

Slide 184 text

Go? Bash! Meet the Shell-operator #!

Slide 185

Slide 185 text

Go? Bash! Meet the Shell-operator #! #! #!

Slide 186

Slide 186 text

Go? Bash! Meet the Shell-operator #! #! #!

Slide 187

Slide 187 text

Go? Bash! Meet the Shell-operator #! #! #!

Slide 188

Slide 188 text

Go? Bash! Meet the Shell-operator #! #! #!

Slide 189

Slide 189 text

Go? Bash! Meet the Shell-operator #! #! #!

Slide 190

Slide 190 text

Go? Bash! Meet the Shell-operator #! #! #!

Slide 191

Slide 191 text

Go? Bash! Meet the Shell-operator #! #! #!

Slide 192

Slide 192 text

Go? Bash! Meet the Shell-operator function __config__() { } cat << EOF configVersion: v1 kubernetes: - name: src_secret apiVersion: v1 kind: Secret nameSelector: matchNames: - mysecret namespace: nameSelector: matchNames: ["default"] group: main EOF Binding configuration

Slide 193

Slide 193 text

Go? Bash! Meet the Shell-operator function __config__() { } cat << EOF configVersion: v1 kubernetes: - name: src_secret apiVersion: v1 kind: Secret nameSelector: matchNames: - mysecret namespace: nameSelector: matchNames: ["default"] group: main EOF Binding configuration

Slide 194

Slide 194 text

Go? Bash! Meet the Shell-operator #!

Slide 195

Slide 195 text

Go? Bash! Meet the Shell-operator #! #! #! #! #! #!

Slide 196

Slide 196 text

Go? Bash! Meet the Shell-operator #! #! #! #! #! #!

Slide 197

Slide 197 text

Go? Bash! Meet the Shell-operator #! #! #! #! #! #!

Slide 198

Slide 198 text

Go? Bash! Meet the Shell-operator #! #! #! #! #! #!

Slide 199

Slide 199 text

Go? Bash! Meet the Shell-operator function __config__() { } cat << EOF configVersion: v1 kubernetes: - name: src_secret apiVersion: v1 kind: Secret nameSelector: matchNames: - mysecret namespace: nameSelector: matchNames: ["default"] group: main EOF Binding configuration

Slide 200

Slide 200 text

Go? Bash! Meet the Shell-operator function __config__() { } cat << EOF configVersion: v1 kubernetes: - name: src_secret apiVersion: v1 kind: Secret nameSelector: matchNames: - mysecret namespace: nameSelector: matchNames: ["default"] group: main queue: "some_name" EOF Binding configuration

Slide 201

Slide 201 text

Go? Bash! Meet the Shell-operator #! shell-operator

Slide 202

Slide 202 text

Go? Bash! Meet the Shell-operator #! + shell-operator addon-operator

Slide 203

Slide 203 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API #! #! #!

Slide 204

Slide 204 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API #! #! #!

Slide 205

Slide 205 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API #! #! #!

Slide 206

Slide 206 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API #! #! #!

Slide 207

Slide 207 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API #! External world #! #!

Slide 208

Slide 208 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API #! External world #! #!

Slide 209

Slide 209 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API + #! External world #!

Slide 210

Slide 210 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API + #! chart External world #!

Slide 211

Slide 211 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API + #! chart External world #!

Slide 212

Slide 212 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API + values #! chart External world #!

Slide 213

Slide 213 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API + values #! chart External world #!

Slide 214

Slide 214 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API + values #! chart External world #!

Slide 215

Slide 215 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API + values #! chart External world #!

Slide 216

Slide 216 text

Go? Bash! Meet the Shell-operator kubernetes Kubernetes API + values #! chart External world #!

Slide 217

Slide 217 text

Go? Bash! Meet the Shell-operator #! + shell-operator addon-operator = #! hooks + events + helm = #! hooks + events

Slide 218

Slide 218 text

Go? Bash! Meet the Shell-operator Thank you! Like? Try! And don’t forget to star on GitHub Dmitry Stolyarov CTO & Co-founder twitter.com/dmistol linkedin.com/in/distol Flant Running your production 24×7×365 medium.com/flant-com youtube.com/c/flant_com flant.com #! + shell-operator github.com/flant/shell-operator addon-operator github.com/flant/addon-operator Andrey Klimentyev Solutions Engineer