From e50a10f4e7bfb8ac9e80ffd1311d6b885729ff07 Mon Sep 17 00:00:00 2001 From: Warren Van Winckel Date: Thu, 28 Feb 2019 22:35:03 -0800 Subject: [PATCH 01/12] Allow st2sensorcontainer to be partitioned --- templates/deployments.yaml | 80 +++++++++++++++++++++----------------- values.yaml | 31 ++++++++------- 2 files changed, 63 insertions(+), 48 deletions(-) diff --git a/templates/deployments.yaml b/templates/deployments.yaml index c79b42dd..5d3d02a4 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -780,56 +780,56 @@ spec: {{ toYaml . | indent 8 }} {{- end }} +{{- range .Values.st2.packs.sensors }} --- apiVersion: apps/v1 kind: Deployment metadata: - name: {{ .Release.Name }}-st2sensorcontainer{{ template "enterpriseSuffix" . }} + name: {{ $.Release.Name }}-st2sensorcontainer-{{ .name }}{{ template "enterpriseSuffix" $ }} labels: - app: st2sensorcontainer + app: st2sensorcontainer-{{ .name }} tier: backend vendor: stackstorm - support: {{ template "supportMethod" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + support: {{ template "supportMethod" $ }} + chart: {{ $.Chart.Name }}-{{ $.Chart.Version }} + release: {{ $.Release.Name }} + heritage: {{ $.Release.Service }} spec: selector: matchLabels: - app: st2sensorcontainer - support: {{ template "supportMethod" . }} - release: {{ .Release.Name }} + app: st2sensorcontainer-{{ .name }} + support: {{ template "supportMethod" $ }} + release: {{ $.Release.Name }} # https://docs.stackstorm.com/reference/ha.html#st2sensorcontainer # It is possible to run st2sensorcontainer in HA mode by running one process on each compute instance. Each sensor node needs to be # provided with proper partition information to share work with other sensor nodes so that the same sensor does not run on different nodes. # See Partitioning Sensors for information on how to partition sensors. - # TODO: Re-work to use single-sensor-per-container mode instead of running 1 node. Proper implementation is possible with Helm templating (#4) replicas: 1 template: metadata: labels: - app: st2sensorcontainer + app: st2sensorcontainer-{{ .name }} tier: backend vendor: stackstorm - support: {{ template "supportMethod" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + support: {{ template "supportMethod" $ }} + chart: {{ $.Chart.Name }}-{{ $.Chart.Version }} + release: {{ $.Release.Name }} + heritage: {{ $.Release.Service }} annotations: - checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") . | sha256sum }} - checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") . | sha256sum }} + checksum/config: {{ include (print $.Template.BasePath "/configmaps_st2-conf.yaml") $ | sha256sum }} + checksum/packs: {{ include (print $.Template.BasePath "/configmaps_packs.yaml") $ | sha256sum }} spec: - {{- if .Values.enterprise.enabled }} + {{- if $.Values.enterprise.enabled }} imagePullSecrets: - - name: {{ .Release.Name }}-st2-license + - name: {{ $.Release.Name }}-st2-license {{- end }} - {{- if .Values.st2.packs.image.repository }} + {{- if $.Values.st2.packs.image.repository }} initContainers: # Merge packs and virtualenvs from st2sensorcontainer with those from the st2.packs image # Custom packs - name: st2-custom-packs - image: "{{ .Values.st2.packs.image.repository }}/{{ .Values.st2.packs.image.name }}:{{ .Values.st2.packs.image.tag }}" - imagePullPolicy: {{ .Values.st2.packs.image.pullPolicy | quote }} + image: "{{ $.Values.st2.packs.image.repository }}/{{ $.Values.st2.packs.image.name }}:{{ $.Values.st2.packs.image.tag }}" + imagePullPolicy: {{ $.Values.st2.packs.image.pullPolicy | quote }} volumeMounts: - name: st2-packs-vol mountPath: /opt/stackstorm/packs-shared @@ -843,8 +843,8 @@ spec: /bin/cp -aR /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared # System packs - name: st2-system-packs - image: "{{ template "imageRepository" . }}/st2actionrunner{{ template "enterpriseSuffix" . }}:{{ .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + image: "{{ template "imageRepository" $ }}/st2actionrunner{{ template "enterpriseSuffix" $ }}:{{ $.Chart.AppVersion }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} volumeMounts: - name: st2-packs-vol mountPath: /opt/stackstorm/packs-shared @@ -856,15 +856,24 @@ spec: /bin/cp -aR /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared {{- end }} containers: - - name: st2sensorcontainer{{ template "enterpriseSuffix" . }} - image: "{{ template "imageRepository" . }}/st2sensorcontainer{{ template "enterpriseSuffix" . }}:{{ .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + - name: st2sensorcontainer-{{ .name }}{{ template "enterpriseSuffix" $ }} + image: "{{ template "imageRepository" $ }}/st2sensorcontainer{{ template "enterpriseSuffix" $ }}:{{ $.Chart.AppVersion }}" + imagePullPolicy: {{ $.Values.image.pullPolicy }} # TODO: Add liveness/readiness probes (#3) #livenessProbe: #readinessProbe: + {{- if .settings.ref }} + command: + - /opt/stackstorm/st2/bin/st2sensorcontainer + - --config-file=/etc/st2/st2.conf + - --config-file=/etc/st2/st2.docker.conf + - --config-file=/etc/st2/st2.user.conf + - --single-sensor-mode + - --sensor-ref={{ .settings.ref }} + {{- end }} envFrom: - configMapRef: - name: {{ .Release.Name }}-st2-urls + name: {{ $.Release.Name }}-st2-urls volumeMounts: - name: st2-config-vol mountPath: /etc/st2/st2.docker.conf @@ -872,7 +881,7 @@ spec: - name: st2-config-vol mountPath: /etc/st2/st2.user.conf subPath: st2.user.conf - {{- if .Values.st2.packs.image.repository }} + {{- if $.Values.st2.packs.image.repository }} - name: st2-packs-vol mountPath: /opt/stackstorm/packs readOnly: true @@ -881,29 +890,30 @@ spec: readOnly: true {{- end }} resources: -{{ toYaml .Values.st2sensorcontainer.resources | indent 10 }} +{{ toYaml .settings.resources | indent 10 }} volumes: - name: st2-config-vol configMap: - name: {{ .Release.Name }}-st2-config - {{- if .Values.st2.packs.image.repository }} + name: {{ $.Release.Name }}-st2-config + {{- if $.Values.st2.packs.image.repository }} - name: st2-packs-vol emptyDir: {} - name: st2-virtualenvs-vol emptyDir: {} {{- end }} - {{- with .Values.st2sensorcontainer.nodeSelector }} + {{- with .settings.nodeSelector }} nodeSelector: {{ toYaml . | indent 8 }} {{- end }} - {{- with .Values.st2sensorcontainer.affinity }} + {{- with .settings.affinity }} affinity: {{ toYaml . | indent 8 }} {{- end }} - {{- with .Values.st2sensorcontainer.tolerations }} + {{- with .settings.tolerations }} tolerations: {{ toYaml . | indent 8 }} {{- end }} +{{- end }} --- apiVersion: apps/v1 diff --git a/values.yaml b/values.yaml index e95b45fc..ecfd8c0a 100644 --- a/values.yaml +++ b/values.yaml @@ -85,6 +85,24 @@ st2: name: st2packs tag: latest pullPolicy: Always + + # https://docs.stackstorm.com/reference/ha.html#st2sensorcontainer + # It is possible to run st2sensorcontainer in HA mode by running one process on each compute instance. + # Each sensor node needs to be provided with proper partition information to share work with other sensor + # nodes so that the same sensor does not run on different nodes. + sensors: + # Default "all-in-one" sensorcontainer that runs all sensors. + # To partition sensors with one sensor per node, override st2.packs.sensors. + # NOTE: Do not modify this file. + - name: aio + settings: + # ref: circle_ci.CircleCIWebhookSensor + # TODO: Find out recommended/default resources for this specific service (#5) + resources: {} + # Additional advanced settings to control pod/deployment placement + affinity: {} + nodeSelector: {} + tolerations: [] # Import data into StackStorm's Key/Value datastore (https://docs.stackstorm.com/datastore.html) keyvalue: #- name: st2_version @@ -314,19 +332,6 @@ st2notifier: nodeSelector: {} tolerations: [] affinity: {} -# https://docs.stackstorm.com/reference/ha.html#st2sensorcontainer -# It is possible to run st2sensorcontainer in HA mode by running one process on each compute instance. Each sensor node needs to be -# provided with proper partition information to share work with other sensor nodes so that the same sensor does not run on different nodes. -st2sensorcontainer: - # TODO: Re-work to use single-sensor-per-container mode partitioning instead of running 1 single node of st2sensorcontainer. Proper implementation is now possible with Helm templating (#4) - # NB! Number of replicas are hardcoded to 1, see above T0D0 about using single-sensor-per-container mode in future as way of Sensor Partitioning. - # replicas: 1 - # TODO: Find out recommended/default resources for this specific service (#5) - resources: {} - # Additional advanced settings to control pod/deployment placement - nodeSelector: {} - tolerations: [] - affinity: {} # https://docs.stackstorm.com/reference/ha.html#st2actionrunner # Multiple st2actionrunner processes can run in active-active with only connections to MongoDB and RabbitMQ. Work gets naturally # distributed across runners via RabbitMQ. Adding more st2actionrunner processes increases the ability of StackStorm to execute actions. From 7826299ede885ee24eec16f0e57d4cbaa01a185b Mon Sep 17 00:00:00 2001 From: Warren Van Winckel Date: Tue, 5 Mar 2019 13:41:50 -0800 Subject: [PATCH 02/12] Define and use the hyphenPrefix template --- templates/_helpers.tpl | 5 +++++ templates/deployments.yaml | 22 +++++++++++----------- values.yaml | 17 ++++++++--------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index bbc11087..a2c9c14c 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -27,3 +27,8 @@ stackstorm {{- define "enterpriseSuffix" -}} {{ if required "Missing context '.Values.enterprise.enabled'!" .Values.enterprise.enabled }}-enterprise{{ end }} {{- end -}} + +# Generate '-' prefix only when the variable is defined +{{- define "hyphenPrefix" -}} +{{ if . }}-{{ . }}{{end}} +{{- end -}} diff --git a/templates/deployments.yaml b/templates/deployments.yaml index 5d3d02a4..2651e560 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -785,9 +785,9 @@ spec: apiVersion: apps/v1 kind: Deployment metadata: - name: {{ $.Release.Name }}-st2sensorcontainer-{{ .name }}{{ template "enterpriseSuffix" $ }} + name: {{ $.Release.Name }}-st2sensorcontainer{{ template "hyphenPrefix" .name }}{{ template "enterpriseSuffix" $ }} labels: - app: st2sensorcontainer-{{ .name }} + app: st2sensorcontainer{{ template "hyphenPrefix" .name }} tier: backend vendor: stackstorm support: {{ template "supportMethod" $ }} @@ -797,7 +797,7 @@ metadata: spec: selector: matchLabels: - app: st2sensorcontainer-{{ .name }} + app: st2sensorcontainer{{ template "hyphenPrefix" .name }} support: {{ template "supportMethod" $ }} release: {{ $.Release.Name }} # https://docs.stackstorm.com/reference/ha.html#st2sensorcontainer @@ -808,7 +808,7 @@ spec: template: metadata: labels: - app: st2sensorcontainer-{{ .name }} + app: st2sensorcontainer{{ template "hyphenPrefix" .name }} tier: backend vendor: stackstorm support: {{ template "supportMethod" $ }} @@ -856,20 +856,20 @@ spec: /bin/cp -aR /opt/stackstorm/virtualenvs/. /opt/stackstorm/virtualenvs-shared {{- end }} containers: - - name: st2sensorcontainer-{{ .name }}{{ template "enterpriseSuffix" $ }} + - name: st2sensorcontainer{{ template "hyphenPrefix" .name }}{{ template "enterpriseSuffix" $ }} image: "{{ template "imageRepository" $ }}/st2sensorcontainer{{ template "enterpriseSuffix" $ }}:{{ $.Chart.AppVersion }}" imagePullPolicy: {{ $.Values.image.pullPolicy }} # TODO: Add liveness/readiness probes (#3) #livenessProbe: #readinessProbe: - {{- if .settings.ref }} + {{- if .ref }} command: - /opt/stackstorm/st2/bin/st2sensorcontainer - --config-file=/etc/st2/st2.conf - --config-file=/etc/st2/st2.docker.conf - --config-file=/etc/st2/st2.user.conf - --single-sensor-mode - - --sensor-ref={{ .settings.ref }} + - --sensor-ref={{ .ref }} {{- end }} envFrom: - configMapRef: @@ -890,7 +890,7 @@ spec: readOnly: true {{- end }} resources: -{{ toYaml .settings.resources | indent 10 }} +{{ toYaml .resources | indent 10 }} volumes: - name: st2-config-vol configMap: @@ -901,15 +901,15 @@ spec: - name: st2-virtualenvs-vol emptyDir: {} {{- end }} - {{- with .settings.nodeSelector }} + {{- with .nodeSelector }} nodeSelector: {{ toYaml . | indent 8 }} {{- end }} - {{- with .settings.affinity }} + {{- with .affinity }} affinity: {{ toYaml . | indent 8 }} {{- end }} - {{- with .settings.tolerations }} + {{- with .tolerations }} tolerations: {{ toYaml . | indent 8 }} {{- end }} diff --git a/values.yaml b/values.yaml index ecfd8c0a..e965c6d6 100644 --- a/values.yaml +++ b/values.yaml @@ -94,15 +94,14 @@ st2: # Default "all-in-one" sensorcontainer that runs all sensors. # To partition sensors with one sensor per node, override st2.packs.sensors. # NOTE: Do not modify this file. - - name: aio - settings: - # ref: circle_ci.CircleCIWebhookSensor - # TODO: Find out recommended/default resources for this specific service (#5) - resources: {} - # Additional advanced settings to control pod/deployment placement - affinity: {} - nodeSelector: {} - tolerations: [] + - name: + # ref: circle_ci.CircleCIWebhookSensor + # TODO: Find out recommended/default resources for this specific service (#5) + resources: {} + # Additional advanced settings to control pod/deployment placement + affinity: {} + nodeSelector: {} + tolerations: [] # Import data into StackStorm's Key/Value datastore (https://docs.stackstorm.com/datastore.html) keyvalue: #- name: st2_version From 3a002826448d6064c0363986ed0048705a753f72 Mon Sep 17 00:00:00 2001 From: Warren Van Winckel Date: Wed, 6 Mar 2019 14:26:30 -0800 Subject: [PATCH 03/12] Add liveness and readiness probes for sensors --- templates/deployments.yaml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/templates/deployments.yaml b/templates/deployments.yaml index 2651e560..89b85093 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -859,9 +859,18 @@ spec: - name: st2sensorcontainer{{ template "hyphenPrefix" .name }}{{ template "enterpriseSuffix" $ }} image: "{{ template "imageRepository" $ }}/st2sensorcontainer{{ template "enterpriseSuffix" $ }}:{{ $.Chart.AppVersion }}" imagePullPolicy: {{ $.Values.image.pullPolicy }} - # TODO: Add liveness/readiness probes (#3) - #livenessProbe: - #readinessProbe: + {{- if .port }} + readinessProbe: + tcpSocket: + port: {{ .port }} + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: + tcpSocket: + port: {{ .port }} + initialDelaySeconds: 5 + periodSeconds: 10 + {{- end }} {{- if .ref }} command: - /opt/stackstorm/st2/bin/st2sensorcontainer From 6a38ca9ad6f1ff2c261d53a6301d906f12eebbc3 Mon Sep 17 00:00:00 2001 From: Warren Van Winckel Date: Wed, 6 Mar 2019 15:26:05 -0800 Subject: [PATCH 04/12] Generalize the liveness and readiness probes --- templates/deployments.yaml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/templates/deployments.yaml b/templates/deployments.yaml index 89b85093..9762d5ee 100644 --- a/templates/deployments.yaml +++ b/templates/deployments.yaml @@ -859,17 +859,14 @@ spec: - name: st2sensorcontainer{{ template "hyphenPrefix" .name }}{{ template "enterpriseSuffix" $ }} image: "{{ template "imageRepository" $ }}/st2sensorcontainer{{ template "enterpriseSuffix" $ }}:{{ $.Chart.AppVersion }}" imagePullPolicy: {{ $.Values.image.pullPolicy }} - {{- if .port }} + {{- with .readinessProbe }} + # Probe to check if app is running. Failure will lead to a pod restart. readinessProbe: - tcpSocket: - port: {{ .port }} - initialDelaySeconds: 5 - periodSeconds: 10 +{{ toYaml . | indent 10 }} + {{- end }} + {{- with .livenessProbe }} livenessProbe: - tcpSocket: - port: {{ .port }} - initialDelaySeconds: 5 - periodSeconds: 10 +{{ toYaml . | indent 10 }} {{- end }} {{- if .ref }} command: From ae38f5bae224e3a495d4a001289e93041aa9e6c9 Mon Sep 17 00:00:00 2001 From: Warren Van Winckel Date: Wed, 6 Mar 2019 15:44:53 -0800 Subject: [PATCH 05/12] Add livenessProbe and readinessProbe to values Remove reference to "all-in-one" in comment. --- values.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/values.yaml b/values.yaml index e965c6d6..f33e591b 100644 --- a/values.yaml +++ b/values.yaml @@ -91,11 +91,13 @@ st2: # Each sensor node needs to be provided with proper partition information to share work with other sensor # nodes so that the same sensor does not run on different nodes. sensors: - # Default "all-in-one" sensorcontainer that runs all sensors. + # Specify default container that executes all sensors. # To partition sensors with one sensor per node, override st2.packs.sensors. # NOTE: Do not modify this file. - name: # ref: circle_ci.CircleCIWebhookSensor + livenessProbe: {} + readinessProbe: {} # TODO: Find out recommended/default resources for this specific service (#5) resources: {} # Additional advanced settings to control pod/deployment placement From 9dbebcce6b68b082c8efc7264fb9bb10a691da6c Mon Sep 17 00:00:00 2001 From: Warren Van Winckel Date: Thu, 7 Mar 2019 13:48:13 -0800 Subject: [PATCH 06/12] Update st2sensorcontainer documentation The documentation now describes how to configure single-sensor-per-container. --- README.md | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9392c810..b5c9162c 100644 --- a/README.md +++ b/README.md @@ -112,11 +112,44 @@ In an HA deployment there must be a minimum of `2` replicas of st2notifier runni which in our case is `etcd`. ### [st2sensorcontainer](https://docs.stackstorm.com/reference/ha.html#st2sensorcontainer) -st2sensorcontainer manages StackStorm sensors: starts, stops and restarts them as a subprocesses. -At the moment K8s configuration consists of Deployment with hardcoded `1` replica. -Future plans are to re-work this setup and benefit from Docker-friendly [single-sensor-per-container mode #4179](https://github.com/StackStorm/st2/pull/4179) -(since st2 `v2.9`) as a way of [Sensor Partitioning](https://docs.stackstorm.com/latest/reference/sensor_partitioning.html), distributing the computing load -between many pods and relying on K8s failover/reschedule mechanisms, instead of running everything on `1` single instance of st2sensorcontainer. +st2sensorcontainer manages StackStorm sensors: It starts, stops and restarts them as subprocesses. +By default, deployment is configured with `1` replica containing all the sensors. + +st2sensorcontainer also supports a more Docker-friendly single-sensor-per-container mode as a way of +[Sensor Partitioning](https://docs.stackstorm.com/latest/reference/sensor_partitioning.html). This +distributes the computing load between many pods and relies on K8s failover/reschedule mechanisms, +instead of running everything on a single instance of st2sensorcontainer. To partition the sensors, +create a yaml file containing `st2.packs.sensors`, and at a minimum, the `name` and `ref` elements. +You can also specify a `livenessProbe` and `readinessProbe` that Kubernetes will use to check +whether the sensor is healthy. If these probes fail, then the sensor will be restarted. Each sensor +container can also specify `resources`, `nodeSelector`, `affinity` and `tolerations`. + +As an example: + +``` +st2: + packs: + sensors: + - name: github + ref: githubwebhook.GitHubWebhookSensor + livenessProbe: + tcpSocket: + port: 8642 + initialDelaySeconds: 5 + periodSeconds: 10 + readinessProbe: + tcpSocket: + port: 8642 + initialDelaySeconds: 5 + periodSeconds: 10 + resources: {} + nodeSelector: {} + affinity: {} + tolerations: {} +``` + +Pass the name of this file to `helm install` using the `-f ` option. Add additional sensors to +the `sensors:` list following the same format as above. ### [st2actionrunner](https://docs.stackstorm.com/reference/ha.html#st2actionrunner) Stackstorm workers that actually execute actions. From b69f5eee1cb27ffacd01f4cea186e7710690f9be Mon Sep 17 00:00:00 2001 From: Warren Van Winckel Date: Thu, 7 Mar 2019 14:30:05 -0800 Subject: [PATCH 07/12] Update CHANGELOG --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e7ce48f..2038f46e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # Changelog -## In Development +## v0.10.0 * Bump versions of all dependencies (#50) +* Allow st2sensorcontainer to be partitioned (#51) * Replace single-node `etcd` coordination backend with 3-node etcd HA cluster, deployed as a Helm dependency (#52) * Fixed improper job load order for enterprise edition failing due to missing RBAC roles & assignments (#53) From 494c1841055f50694ff5beee549632ee9d40e6b2 Mon Sep 17 00:00:00 2001 From: Warren Van Winckel Date: Thu, 7 Mar 2019 14:34:22 -0800 Subject: [PATCH 08/12] Add "In Development" heading --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2038f46e..824da6ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## In Development + ## v0.10.0 * Bump versions of all dependencies (#50) * Allow st2sensorcontainer to be partitioned (#51) From 1bd407e6b38dfdfe0d82778576f2ae1bdc3e20d7 Mon Sep 17 00:00:00 2001 From: Warren Van Winckel Date: Fri, 8 Mar 2019 11:00:03 -0800 Subject: [PATCH 09/12] Update docs based on feedback --- README.md | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/README.md b/README.md index 4ae3a0f0..c0bae901 100644 --- a/README.md +++ b/README.md @@ -120,36 +120,7 @@ st2sensorcontainer also supports a more Docker-friendly single-sensor-per-contai distributes the computing load between many pods and relies on K8s failover/reschedule mechanisms, instead of running everything on a single instance of st2sensorcontainer. To partition the sensors, create a yaml file containing `st2.packs.sensors`, and at a minimum, the `name` and `ref` elements. -You can also specify a `livenessProbe` and `readinessProbe` that Kubernetes will use to check -whether the sensor is healthy. If these probes fail, then the sensor will be restarted. Each sensor -container can also specify `resources`, `nodeSelector`, `affinity` and `tolerations`. - -As an example: - -``` -st2: - packs: - sensors: - - name: github - ref: githubwebhook.GitHubWebhookSensor - livenessProbe: - tcpSocket: - port: 8642 - initialDelaySeconds: 5 - periodSeconds: 10 - readinessProbe: - tcpSocket: - port: 8642 - initialDelaySeconds: 5 - periodSeconds: 10 - resources: {} - nodeSelector: {} - affinity: {} - tolerations: {} -``` - -Pass the name of this file to `helm install` using the `-f ` option. Add additional sensors to -the `sensors:` list following the same format as above. +The sensor(s) must be deployed as part of the dockerized packs image. ### [st2actionrunner](https://docs.stackstorm.com/reference/ha.html#st2actionrunner) Stackstorm workers that actually execute actions. From 51609c47043e9e01d5aa2b2b5c483e828d2d7c95 Mon Sep 17 00:00:00 2001 From: Warren Van Winckel Date: Fri, 8 Mar 2019 11:05:45 -0800 Subject: [PATCH 10/12] Some more tweaks to docs --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c0bae901..ba4b04d1 100644 --- a/README.md +++ b/README.md @@ -118,9 +118,8 @@ By default, deployment is configured with `1` replica containing all the sensors st2sensorcontainer also supports a more Docker-friendly single-sensor-per-container mode as a way of [Sensor Partitioning](https://docs.stackstorm.com/latest/reference/sensor_partitioning.html). This distributes the computing load between many pods and relies on K8s failover/reschedule mechanisms, -instead of running everything on a single instance of st2sensorcontainer. To partition the sensors, -create a yaml file containing `st2.packs.sensors`, and at a minimum, the `name` and `ref` elements. -The sensor(s) must be deployed as part of the dockerized packs image. +instead of running everything on a single instance of st2sensorcontainer. The sensor(s) must be +deployed as part of the custom packs image. ### [st2actionrunner](https://docs.stackstorm.com/reference/ha.html#st2actionrunner) Stackstorm workers that actually execute actions. From ebf820e94e9b33455c2eb263fad38139712f288f Mon Sep 17 00:00:00 2001 From: Warren Van Winckel Date: Fri, 8 Mar 2019 12:32:36 -0800 Subject: [PATCH 11/12] Add a simplified example --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index ba4b04d1..356c22de 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,18 @@ distributes the computing load between many pods and relies on K8s failover/resc instead of running everything on a single instance of st2sensorcontainer. The sensor(s) must be deployed as part of the custom packs image. +As an example, override the default Helm values as follows: + +``` +st2: + packs: + sensors: + - name: github + ref: githubwebhook.GitHubWebhookSensor + - name: circleci + ref: circle_ci.CircleCIWebhookSensor +``` + ### [st2actionrunner](https://docs.stackstorm.com/reference/ha.html#st2actionrunner) Stackstorm workers that actually execute actions. `5` replicas for K8s Deployment are configured by default to increase StackStorm ability to execute actions without excessive queuing. From 12ab1ef9fd886cac49f17d128cae754a948cedad Mon Sep 17 00:00:00 2001 From: Warren Van Winckel Date: Fri, 8 Mar 2019 12:43:55 -0800 Subject: [PATCH 12/12] Remove extraneous comment --- values.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/values.yaml b/values.yaml index 695f7843..0580cbab 100644 --- a/values.yaml +++ b/values.yaml @@ -95,7 +95,6 @@ st2: # To partition sensors with one sensor per node, override st2.packs.sensors. # NOTE: Do not modify this file. - name: - # ref: circle_ci.CircleCIWebhookSensor livenessProbe: {} readinessProbe: {} # TODO: Find out recommended/default resources for this specific service (#5)