Skip to content

Commit 4251fbd

Browse files
committed
Merge branch 'master' into ubuntu_20
2 parents 9b4710d + 6698db7 commit 4251fbd

24 files changed

+3937
-28
lines changed

.github/workflows/unit-tests.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: Unit Tests
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
branches:
10+
- master
11+
12+
jobs:
13+
helm-unittest:
14+
15+
runs-on: ubuntu-latest
16+
# strategy:
17+
# matrix:
18+
# Relevant tools installed by default on ubuntu 20.04:
19+
# - helm 3.8.0
20+
# - jq 1.6
21+
# - kind 0.11.1
22+
# - kubectl 1.23.3
23+
# - minikube 1.25.1
24+
# - python 3.8.10
25+
# - yamllint 1.26.3
26+
# - yq 4.19.1
27+
# see: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md
28+
29+
steps:
30+
- uses: actions/checkout@v2
31+
32+
- name: Install helm-unittest
33+
# We should periodically check to see if another fork has taken over maintenance,
34+
# as the de-facto "best" fork has changed several times over the years.
35+
run: |
36+
helm plugin install https://github.com/quintush/helm-unittest
37+
38+
- name: Install chart dependencies
39+
run: |
40+
helm dependency update
41+
42+
- name: Run helm-unittest
43+
# by default looks for tests/*_test.yaml
44+
run: |
45+
helm unittest --color --helm3 -f 'tests/unit/*_test.yaml' .

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
# Changelog
22

33
## In Development
4+
* Migrate from `python 3.6` `Ubuntu Bionic` to `python 3.8` `Ubuntu Focal` as a base StackStorm OS (StackStorm/st2-dockerfiles#54)
5+
6+
## v0.90.0
47
* Advanced Feature: Make securityContext (on Deployments/Jobs) and podSecurityContext (on Pods) configurable. This allows dropping all capabilities, for example. You can override the securityContext for `st2actionrunner`, `st2sensorcontainer`, and `st2client` if your actions or sensors need, for example, additional capabilites that the rest of StackStorm does not need. (#271) (by @cognifloyd)
58
* Prefix template helpers with chart name and format helper comments as template comments. (#272) (by @cognifloyd)
6-
* Migrate from `python 3.6` `Ubuntu Bionic` to `python 3.8` `Ubuntu Focal` as a base StackStorm OS (StackStorm/st2-dockerfiles#54)
9+
* New feature: Add `extra_volumes` to all python-based st2 deployments. This can facilitate changing log levels by loading logging conf file(s) from a custom ConfigMap. (#276) (by @cognifloyd)
10+
* Initialize basic unittest infrastructure using `helm-unittest`. Added tests for labels, custom annotations, SecurityContext, pullSecrets, pullPolicy, Resources, nodeSelector, tolerations, affinity, dnsPolicy, dnsConfig, ServiceAccount attach, postStartScript, both sensor-modes, env, envFrom, st2.packs.images, and st2.packs.volumes. (#284, #288, #292)
11+
* Allow partitioning sensors using the hash_range strategy instead of one sensor per pod. (#218) (by @cognifloyd)
12+
* New feature to include possibility for external services in st2api, st2stream and st2auth, setting default value for this services as `ClusterIP` and `hostname: ""`. Also, added new entry for custom_annotations_test.yaml and created new unit test services_test.yaml. (by @sandesvitor)
13+
* Advanced Feature: Add extra Helm hook Jobs. This minimizes the boilerplate required to run stackstorm workflows at various helm hook stages: post-install, pre-upgrade, post-upgrade. (#265) (by @cognifloyd)
714

815
## v0.80.0
916
* Switch st2 to `v3.6` as a new default stable version (#274)

Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ apiVersion: v2
22
# StackStorm version which refers to Docker images tag
33
appVersion: "3.6"
44
name: stackstorm-ha
5-
version: 0.80.0
5+
version: 0.90.0
66
description: StackStorm K8s Helm Chart, optimized for running StackStorm in HA environment.
77
home: https://stackstorm.com/
88
icon: https://landscape.cncf.io/logos/stack-storm.svg
99
source:
10-
- https://github.com/stackstorm/stackstorm-ha
10+
- https://github.com/stackstorm/stackstorm-k8s
1111
keywords:
1212
- st2
1313
- stackstorm

README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ which in our case is `Redis`.
123123
st2sensorcontainer manages StackStorm sensors: It starts, stops and restarts them as subprocesses.
124124
By default, deployment is configured with `1` replica containing all the sensors.
125125

126+
You can increase the number of `st2sensorcontainer` pods by increasing the number of deployments.
127+
The replicas count is still only `1` per deployment, but the sensors are distributed between the deployments using
128+
[Sensor Hash Range Partitioning](https://docs.stackstorm.com/reference/sensor_partitioning.html#hash).
129+
The hash ranges are calculated automatically based on the number of deployments.
130+
126131
st2sensorcontainer also supports a more Docker-friendly single-sensor-per-container mode as a way of
127132
[Sensor Partitioning](https://docs.stackstorm.com/latest/reference/sensor_partitioning.html). This
128133
distributes the computing load between many pods and relies on K8s failover/reschedule mechanisms,
@@ -320,10 +325,40 @@ Grab all logs only for stackstorm backend services, excluding st2web and DB/MQ/r
320325
kubectl logs -l release=<release-name>,tier=backend
321326
```
322327

328+
## Running jobs before/after install, upgrade, or rollback
329+
WARNING: The feature described in this section is an Advanced feature that new users should not need.
330+
331+
It may be convenient to run one or more `Job`(s) in your `stackstorm-ha` cluster to manage your release's life cycle.
332+
As the [Helm docs]() explain:
333+
334+
> Helm provides a _hook_ mechanism to allow chart developers to intervene at certain points in a release's life cycle.
335+
336+
The `jobs.extra_hooks` feature in this chart simplifies creating `Jobs` that Helm will run in its hooks.
337+
These jobs will use the same settings as any other job defined by this chart (eg image, annotations, pod placement).
338+
The `st2.conf` files and packs volumes will be mounted in the Job and the `st2` cli will be configured.
339+
This feature is primarily useful when you need to run a StackStorm workflow (with `st2 run ...`) after install,
340+
before/after upgrades, or before/after rollbacks.
341+
342+
NOTE: The `jobs.extra_hooks` feature is very opinionated. If you need to to apply helm hooks to anything other than
343+
`Jobs`, or if these jobs do not meet your needs, then you will need to do so from a parent chart. For example, parent charts
344+
are much better suited to jobs that don't need access to the packs, configs, configmaps, and secrets that this chart provides.
345+
See "Extending this chart" below.
346+
347+
These extra hooks jobs can be used for st2 installation-specific jobs like:
348+
349+
- running a pre-upgrade st2 workflow that notifies on various channels that the upgrade is happening,
350+
- running post-upgrade smoke tests to ensure st2 can connect to vital services (vault, kubernetes, aws, etc),
351+
- running a pre-upgrade st2 workflow that pauses long-running workflows,
352+
- running a post-upgrade st2 workflow that resumes long-running workflows,
353+
- running one-time post-install configuration (such as generating dynamic secrets in the st2kv datastore),
354+
355+
To configure the `jobs.extra_hooks`, set `jobs.extra_hooks` in your values file.
356+
Please refer to stackstorm-ha's default values.yaml file for examples.
357+
323358
## Extending this chart
324359
If you have any suggestions or ideas about how to extend this chart functionality,
325-
we welcome you to collaborate in [Issues](https://github.com/stackstorm/stackstorm-ha/issues)
326-
and contribute via [Pull Requests](https://github.com/stackstorm/stackstorm-ha/pulls).
360+
we welcome you to collaborate in [Issues](https://github.com/stackstorm/stackstorm-k8s/issues)
361+
and contribute via [Pull Requests](https://github.com/stackstorm/stackstorm-k8s/pulls).
327362
However if you need something very custom and specific to your infra that doesn't fit official chart plans,
328363
we strongly recommend you to create a parent Helm chart with custom K8s objects and referencing `stackstorm-ha` chart
329364
as a child dependency.

0 commit comments

Comments
 (0)