Skip to content

Commit

Permalink
Merge pull request #96 from rstudio/fix-health-check
Browse files Browse the repository at this point in the history
Fix health check
  • Loading branch information
colearendt authored Dec 2, 2021
2 parents 33f517f + 996fc5b commit e146655
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 13 deletions.
2 changes: 1 addition & 1 deletion charts/rstudio-workbench/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: rstudio-workbench
description: Official Helm chart for RStudio Workbench
version: 0.5.0-rc09
version: 0.5.0-rc10
apiVersion: v2
appVersion: 2021.09.0-351.pro6
icon: https://rstudio.com/wp-content/uploads/2018/10/RStudio-Logo-Flat.png
Expand Down
3 changes: 3 additions & 0 deletions charts/rstudio-workbench/NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
- BREAKING: Change RStudio Workbench execution model to use supervisord
- BREAKING: Add `vscode.conf` defaults. This enables VS Code sessions, which is dependent on your images having
code-server installed at `/opt/code-server/`
- Create `diagnostics` values (`diagnostics.enabled` and `diagnostics.directory`) to control diagnostic output
- Add values to `launcher.kubernetesHealthCheck` to control the behavior of the "Kubernetes Health Check" that launcher
runs at startup
- Enable PAM sessions by default (i.e. `auth-pam-sessions-enabled=1`). This is important for proper home
directory creation, for instance. Disable by setting `config.server.rserver\.conf.auth-pam-sessions-enabled=0`
- Add `imagePullSecrets` value option ([#57](https://github.com/rstudio/helm/issues/57))
Expand Down
8 changes: 5 additions & 3 deletions charts/rstudio-workbench/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RStudio Workbench

![Version: 0.5.0-rc09](https://img.shields.io/badge/Version-0.5.0--rc09-informational?style=flat-square) ![AppVersion: 2021.09.0-351.pro6](https://img.shields.io/badge/AppVersion-2021.09.0--351.pro6-informational?style=flat-square)
![Version: 0.5.0-rc10](https://img.shields.io/badge/Version-0.5.0--rc10-informational?style=flat-square) ![AppVersion: 2021.09.0-351.pro6](https://img.shields.io/badge/AppVersion-2021.09.0--351.pro6-informational?style=flat-square)

#### _Official Helm chart for RStudio Workbench_

Expand All @@ -23,11 +23,11 @@ As a result, please:

## Installing the Chart

To install the chart with the release name `my-release` at version 0.5.0-rc09:
To install the chart with the release name `my-release` at version 0.5.0-rc10:

```bash
helm repo add rstudio https://helm.rstudio.com
helm install --devel my-release rstudio/rstudio-workbench --version=0.5.0-rc09
helm install --devel my-release rstudio/rstudio-workbench --version=0.5.0-rc10
```

## Required Configuration
Expand Down Expand Up @@ -319,6 +319,7 @@ config:
| config.startupCustom | object | `{}` | a map of supervisord .conf files to define custom services. Mounted into the container at /startup/custom/ |
| config.userProvisioning | object | `{}` | a map of sssd config files, used for user provisioning. Mounted to `/etc/sssd/conf.d/` with 0600 permissions |
| dangerRegenerateAutomatedValues | bool | `false` | |
| diagnostics | object | `{"directory":"/var/log/rstudio","enabled":false}` | Settings for enabling server diagnostics |
| fullnameOverride | string | `""` | the full name of the release (can be overridden) |
| global.secureCookieKey | string | `""` | |
| homeStorage.accessModes | list | `["ReadWriteMany"]` | accessModes defined for the storage PVC (represented as YAML) |
Expand All @@ -339,6 +340,7 @@ config:
| initContainers | bool | `false` | the initContainer spec that will be used verbatim |
| jobJsonOverridesFiles | object | `{}` | jobJsonOverridesFiles is a map of maps. Each item in the map will become a file (named by the key), and the underlying object will be converted to JSON as the file's contents |
| launcher.enabled | bool | `true` | determines whether the launcher should be started in the container |
| launcher.kubernetesHealthCheck | object | `{"enabled":true,"extraCurlArgs":["-fsSL"]}` | configuration for the "Kubernetes Health Check" that the launcher entrypoint runs at startup |
| launcher.namespace | string | `""` | allow customizing the namespace that sessions are launched into. Note RBAC and some config issues today |
| launcherPem | string | `""` | An inline launcher.pem key. If not provided, one will be auto-generated. See README for more details. |
| launcherPub | bool | `false` | An inline launcher.pub key to pair with launcher.pem. If `false` (the default), we will try to generate a `launcher.pub` from the provided `launcher.pem` |
Expand Down
17 changes: 11 additions & 6 deletions charts/rstudio-workbench/prestart-launcher.bash
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@ main() {
_logf 'Ensuring %s exists' "${dyn_dir}"
mkdir -p "${dyn_dir}"

_logf 'Checking kubernetes health via %s' "${k8s_url}"
curl -fsSL \
-H "Authorization: Bearer ${sa_token}" \
--cacert "${cacert}" \
"${k8s_url}/healthz" 2>&1 | _indent
printf '\n'
if [[ -z "${RSTUDIO_LAUNCHER_STARTUP_HEALTH_CHECK}" ]]; then
_logf 'Checking kubernetes health via %s' "${k8s_url}"
curl ${RSTUDIO_LAUNCHER_STARTUP_HEALTH_CHECK_ARGS} \
-H "Authorization: Bearer ${sa_token}" \
--cacert "${cacert}" \
"${k8s_url}/livez?verbose" 2>&1 | _indent
printf '\n'
else
_logf "Not checking kubernetes health because RSTUDIO_LAUNCHER_STARTUP_HEALTH_CHECK=${RSTUDIO_LAUNCHER_STARTUP_HEALTH_CHECK}"
printf '\n'
fi

_logf 'Generating %s' "${launcher_k8s_conf}"
cat >"${launcher_k8s_conf}" <<EOF
Expand Down
12 changes: 10 additions & 2 deletions charts/rstudio-workbench/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,22 @@ containers:
{{- $defaultVersion := .Values.versionOverride | default $.Chart.AppVersion }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default $defaultVersion }}"
env:
{{- if .Values.enableDiagnostics }}
{{- if .Values.diagnostics.enabled }}
- name: DIAGNOSTIC_DIR
value: "/var/log/rstudio"
value: "{{ .Values.diagnostics.directory }}"
- name: DIAGNOSTIC_ONLY
value: "true"
- name: DIAGNOSTIC_ENABLE
value: "true"
{{- end }}
{{- if not .Values.launcher.kubernetesHealthCheck.enabled }}
- name: RSTUDIO_LAUNCHER_STARTUP_HEALTH_CHECK
value: disabled
{{- end }}
{{- if .Values.launcher.kubernetesHealthCheck.enabled }}
- name: RSTUDIO_LAUNCHER_STARTUP_HEALTH_CHECK_ARGS
value: "{{ join " " .Values.launcher.kubernetesHealthCheck.extraCurlArgs }}"
{{- end }}
- name: RSTUDIO_LAUNCHER_NAMESPACE
value: "{{ default $.Release.Namespace .Values.launcher.namespace }}"
{{- include "rstudio-library.license-env" (dict "license" ( .Values.license ) "product" ("rstudio-workbench") "envVarPrefix" ("RSW") "fullName" (include "rstudio-workbench.fullname" .)) | nindent 2 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
{{- end }}
shareProcessNamespace: {{ .Values.shareProcessNamespace }}
restartPolicy: Never
{{- $topLevelParams := dict "enableDiagnostics" true "userCreate" true }}
{{- $topLevelParams := dict "diagnostics" (dict "enabled" true) "userCreate" true }}
{{- $disabledObject := dict "enabled" false }}
{{- $readinessProbe := dict "readinessProbe" $disabledObject }}
{{- $livenessProbe := dict "livenessProbe" $disabledObject }}
Expand Down
10 changes: 10 additions & 0 deletions charts/rstudio-workbench/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ fullnameOverride: ""
# -- A Workbench version to override the "tag" for the RStudio Workbench image and the session images. Necessary until https://github.com/helm/helm/issues/8194
versionOverride: ""

# -- Settings for enabling server diagnostics
diagnostics:
enabled: false
directory: /var/log/rstudio


session:
# -- Whether to automatically mount the config.session configuration into session pods. If launcher.namespace is different from Release Namespace, then the chart will duplicate the session configmap in both namespaces to facilitate this
defaultConfigMount: true
Expand Down Expand Up @@ -50,6 +56,10 @@ launcher:
enabled: true
# -- allow customizing the namespace that sessions are launched into. Note RBAC and some config issues today
namespace: ""
# -- configuration for the "Kubernetes Health Check" that the launcher entrypoint runs at startup
kubernetesHealthCheck:
enabled: true
extraCurlArgs: ["-fsSL"]

homeStorage:
# -- whether to create the persistentVolumeClaim for homeStorage
Expand Down

0 comments on commit e146655

Please sign in to comment.