Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow st2web to serve HTTPS #264

Merged
merged 8 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* New feature: Add `envFromSecrets` to `st2actionrunner`, `st2client`, `st2sensorcontainer`, and jobs. This is useful for adding custom secrets to the environment. This complements the `extra_volumes` feature (loading secrets as files) to facilitate loading secrets that are not easily injected via the filesystem. (#259) (by @cognifloyd)
* New feature to include `nodeSelector`, `affinity` and `tolerations` to `st2client`, allowing more flexibility to pod positioning. (#263) (by @sandesvitor)
* Template `~/.st2/config`. This allows customizing the settings used by the `st2client` and jobs pods for using the st2 apis. (#262) (by @cognifloyd)
* Advanced Feature: Allow `st2web` to serve HTTPS when the ssl certs are provided via `st2web.extra_volumes`. To enable this, add `ST2WEB_HTTPS: "1"` to `st2web.env` in your values file. (#264) (by @cognifloyd)

## v0.70.0
* New feature: Shared packs volumes `st2.packs.volumes`. Allow using cluster-specific persistent volumes to store packs, virtualenvs, and (optionally) configs. This enables using `st2 pack install`. It even works with `st2packs` images in `st2.packs.images`. (#199) (by @cognifloyd)
Expand Down
18 changes: 13 additions & 5 deletions templates/deployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,13 @@ spec:
image: '{{ template "imageRepository" . }}/st2web:{{ tpl (.Values.st2web.image.tag | default .Values.image.tag) . }}'
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 80
- containerPort: {{ eq (get .Values.st2web.env "ST2WEB_HTTPS" | toString) "1" | ternary 443 80 }}
# Probe to check if app is running. Failure will lead to a pod restart.
livenessProbe:
httpGet:
scheme: HTTP
scheme: {{ eq (get .Values.st2web.env "ST2WEB_HTTPS" | toString) "1" | ternary "HTTPS" "HTTP" }}
path: /
port: 80
port: {{ eq (get .Values.st2web.env "ST2WEB_HTTPS" | toString) "1" | ternary 443 80 }}
initialDelaySeconds: 1
# Probe to check if app is ready to serve traffic. Failure will lead to temp stop serving traffic.
# TODO: Failing to add readinessProbe, since st2 requires authorization (401) and we don't have `/healthz` endpoints yet (https://github.com/StackStorm/st2/issues/4020)
Expand All @@ -426,11 +426,15 @@ spec:
- configMapRef:
name: {{ .Release.Name }}-st2-urls
optional: true
{{- if or .Values.st2web.config .Values.st2web.postStartScript }}
{{- if or .Values.st2web.config .Values.st2web.extra_volumes .Values.st2web.postStartScript }}
volumeMounts:
{{- else }}
volumeMounts: []
{{- end }}
{{- range .Values.st2web.extra_volumes }}
- name: {{ required "Each volume must have a 'name' in st2web.extra_volumes" .name }}
{{- tpl (required "Each volume must have a 'mount' definition in st2web.extra_volumes" .mount | toYaml) $ | nindent 12 }}
{{- end }}
{{- if .Values.st2web.config }}
- name: st2web-config-vol
mountPath: /opt/stackstorm/static/webui/config.js
Expand All @@ -450,11 +454,15 @@ spec:
{{- if .Values.st2web.serviceAccount.attach }}
serviceAccountName: {{ template "stackstorm-ha.serviceAccountName" . }}
{{- end }}
{{- if or .Values.st2web.config .Values.st2web.postStartScript }}
{{- if or .Values.st2web.config .Values.st2web.extra_volumes .Values.st2web.postStartScript }}
volumes:
{{- else }}
volumes: []
{{- end }}
{{- range .Values.st2web.extra_volumes }}
- name: {{ required "Each volume must have a 'name' in st2web.extra_volumes" .name }}
{{- tpl (required "Each volume must have a 'volume' definition in st2web.extra_volumes" .volume | toYaml) $ | nindent 10 }}
{{- end }}
{{- if .Values.st2web.config }}
- name: st2web-config-vol
configMap:
Expand Down
2 changes: 1 addition & 1 deletion templates/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ spec:
{{- end }}
ports:
- protocol: TCP
port: 80
port: {{ eq (get .Values.st2web.env "ST2WEB_HTTPS" | toString) "1" | ternary 443 80 }}

{{ if .Values.st2chatops.enabled -}}
---
Expand Down
7 changes: 7 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,15 @@ st2web:
affinity: {}
env: {}
# HTTP_PROXY: http://proxy:1234
## Advanced: To configure st2web to serve HTTPS (port 443) instead of HTTP (port 80)
## provide ssl certs via extra_volumes, and add the ST2WEB_HTTPS env var here:
# ST2WEB_HTTPS: 1
cognifloyd marked this conversation as resolved.
Show resolved Hide resolved
serviceAccount:
attach: false
# mount extra volumes on the st2web pod(s) (primarily useful for k8s-provisioned secrets)
## Note that Helm templating is supported in 'mount' and 'volume'
extra_volumes: []
# see examples under st2workflowengine.extra_volumes
# User-defined st2web config with custom settings to replace default config.js
# See https://github.com/StackStorm/st2web#connecting-to-st2-server for more info
# config: |
Expand Down