Skip to content

Add Chronicle agent builtin sidecar definitions to Connect and Workbench #671

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

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
820cef1
Start adding values for Chronicle agent config
ianpittwood May 9, 2025
0491fcc
Add some helper functions for chronicle-agent autodiscovery
ianpittwood May 9, 2025
a49367c
Add a definition for Chronicle Agent as a sidecar container
ianpittwood May 9, 2025
b7463a5
Update service target URL for Chronicle agent
ianpittwood May 13, 2025
3f149e9
Fix image reference in Chronicle Agent sidecar
ianpittwood May 13, 2025
4c3ce40
Bump Connect release notes and chart version
ianpittwood May 14, 2025
afc7988
Add logic to use serverAddress value when present
ianpittwood May 14, 2025
2b9d111
Update products to include sidecar configuration utilizing rstudio-li…
ianpittwood May 15, 2025
6ad1c1e
Update helm-docs and README.md
actions-user May 15, 2025
26d3bfa
Pass `.Release` to helper function for namespace search
ianpittwood May 19, 2025
5e37c74
Bump `rstudio-library` to 0.1.33
ianpittwood May 19, 2025
3204920
Change secretKeyRef to valueFrom to be more widely accepting of inputs
ianpittwood May 19, 2025
b2056ba
Trim return values from helper functions
ianpittwood May 19, 2025
0e6859b
Update helm-docs and README.md
actions-user May 19, 2025
d718187
fix connect API key env var name
ianpittwood May 20, 2025
b3e490a
Update `rstudio-library` to 0.1.34
ianpittwood May 20, 2025
f749868
Update documentation
ianpittwood May 20, 2025
496b2d3
Update helm-docs and README.md
actions-user May 20, 2025
661edaf
Trigger CI
ianpittwood May 20, 2025
5ce2f0f
Allow Workbench API key override in chronicleAgent values
ianpittwood May 20, 2025
251507c
Update helm-docs and README.md
actions-user May 20, 2025
712768e
Fix workbenchApiKey docs
ianpittwood May 20, 2025
44a8318
Update helm-docs and README.md
actions-user May 20, 2025
d7a23ae
Trigger CI
ianpittwood May 20, 2025
3115809
Fix Workbench API key docs
ianpittwood May 20, 2025
59a2b01
Update helm-docs and README.md
actions-user May 20, 2025
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
6 changes: 3 additions & 3 deletions charts/rstudio-connect/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: rstudio-library
repository: https://helm.rstudio.com
version: 0.1.31
digest: sha256:2a0e98b8fa01730bf2db3816a7310462c921b9fa2f1f3c74f85fedede82e1593
generated: "2024-11-01T10:19:53.608088-04:00"
version: 0.1.34
digest: sha256:66324c3ca436a3743e6f7c3dd8e159d21fca4fd5072d4d8c2583bfafd8499d70
generated: "2025-05-20T10:37:20.963885313-06:00"
4 changes: 2 additions & 2 deletions charts/rstudio-connect/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: rstudio-connect
description: Official Helm chart for Posit Connect
version: 0.7.25
version: 0.7.27
apiVersion: v2
appVersion: 2025.04.0
icon: https://rstudio.com/wp-content/uploads/2018/10/RStudio-Logo-Flat.png
Expand All @@ -13,7 +13,7 @@ maintainers:
url: https://github.com/sol-eng
dependencies:
- name: rstudio-library
version: 0.1.31
version: 0.1.34
repository: https://helm.rstudio.com
annotations:
artifacthub.io/images: |
Expand Down
6 changes: 6 additions & 0 deletions charts/rstudio-connect/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.7.26

- Bump `rstudio-library` chart version to `0.1.32`.
- Adds a shortcut resource deployment for Chronicle Agent via `chronicleAgent.enabled`. The value is disabled by default
and does not affect existing deployments that use `sidecar` or `initContainer` to deploy the Chronicle Agent.

## 0.7.25

- Bump Connect version to 2025.04.0
Expand Down
80 changes: 77 additions & 3 deletions charts/rstudio-connect/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Posit Connect

![Version: 0.7.25](https://img.shields.io/badge/Version-0.7.25-informational?style=flat-square) ![AppVersion: 2025.04.0](https://img.shields.io/badge/AppVersion-2025.04.0-informational?style=flat-square)
![Version: 0.7.27](https://img.shields.io/badge/Version-0.7.27-informational?style=flat-square) ![AppVersion: 2025.04.0](https://img.shields.io/badge/AppVersion-2025.04.0-informational?style=flat-square)

#### _Official Helm chart for Posit Connect_

Expand Down Expand Up @@ -30,11 +30,11 @@ To ensure reproducibility in your environment and insulate yourself from future

## Installing the chart

To install the chart with the release name `my-release` at version 0.7.25:
To install the chart with the release name `my-release` at version 0.7.27:

```{.bash}
helm repo add rstudio https://helm.rstudio.com
helm upgrade --install my-release rstudio/rstudio-connect --version=0.7.25
helm upgrade --install my-release rstudio/rstudio-connect --version=0.7.27
```

To explore other chart versions, look at:
Expand Down Expand Up @@ -124,6 +124,66 @@ Alternatively, database passwords may be set during `helm install` with the foll

`--set config.Postgres.Password="<YOUR_PASSWORD_HERE>"`

## Chronicle Agent

This chart supports use of a sidecar Chronicle agent to report data to a Chronicle server. The agent can be enabled
by setting `chronicleAgent.enabled=true`.

By default, the chart will attempt to lookup an existing Chronicle server deployed in the release namespace. The
searched namespace can be changed setting `chronicleAgent.serverNamespace`. If a server exists, it will set the
Chronicle agent's server value to the server's service name and will use an agent version to match the server version.
This auto-discovery behavior can be disabled by setting `chronicleAgent.autoDiscovery=false`.

To set the server address and/or version manually, set the following values:
```yaml
chronicleAgent:
enabled: true
serverAddress: <server-address>
image:
tag: <agent-version>
```

If preferred, the Chronicle agent can be directly defined as a sidecar container using either `initContainers`
(recommended) or `sidecar` values. Below is an example of directly defining the Chronicle agent as a native sidecar
container using `initContainers`:
```yaml
initContainers:
- name: chronicle-agent
restartPolicy: Always
image: ghcr.io/rstudio/chronicle-agent:<agent-version>
env:
- name: CHRONICLE_SERVER_ADDRESS
value: "http://<address>"
- name: CHRONICLE_CONNECT_APIKEY
valueFrom:
secretKeyRef:
name: connect
key: apikey
```

For more information on Chronicle, see the [Chronicle documentation](https://docs.posit.co/chronicle/).

### Chronicle Connect API Key

In order to communicate with Connect, the Chronicle agent must be passed an API key. This can either be done by passing
a Kubernetes secret (recommended) or by setting the key directly as an environment variable. Below is an example
of how to set the API key using a secret:
```yaml
chronicleAgent:
enabled: true
connectApiKey:
valueFrom:
secretKeyRef:
name: <secret-name>
key: <key-name>
```

Due to the way Connect manages its API keys, it is currently not possible to provision an API key automatically for the
Chronicle agent at the time of deployment. To workaround this issue in a fresh deployment, you can initially leave
the API key unset for the Chronicle agent, deploy the chart, create an administrator API key, and then provision a
secret with the API key. Once the secret is created, the value of `chronicleAgent.connectApiKey.secretKeyRef`
can be set and the chart can be upgraded to include the new value.

## General principles

- In most places, we opt to pass Helm values over configmaps. We translate these into the valid `.gcfg` file format
Expand All @@ -148,6 +208,20 @@ The Helm `config` values are converted into the `rstudio-connect.gcfg` service c
|-----|------|---------|-------------|
| affinity | object | `{}` | A map used verbatim as the pod's "affinity" definition |
| args | list | `[]` | The pod's run arguments. By default, it uses the container's default |
| chronicleAgent | object | `{"autoDiscovery":true,"connectApiKey":{"value":"","valueFrom":{}},"enabled":false,"env":[],"image":{"imagePullPolicy":"IfNotPresent","registry":"ghcr.io","repository":"rstudio/chronicle-agent","tag":""},"serverAddress":"","serverNamespace":"","volumeMounts":[]}` | Settings for the Chronicle Agent sidecar container |
| chronicleAgent.autoDiscovery | bool | `true` | If true, the chart will attempt to lookup the Chronicle Server address and version in the cluster |
| chronicleAgent.connectApiKey | object | `{"value":"","valueFrom":{}}` | An API key generated in Connect that can be used for the Chronicle Agent to authenticate with the Connect server for metrics. This generally must be set after the initial deployment of the Connect pod. |
| chronicleAgent.connectApiKey.value | string | `""` | The verbatim value for the API Key used in the CONNECT_API_KEY environment variable passed to the Chronicle Agent. It is recommended to reference a secret with valueFrom instead of this. |
| chronicleAgent.connectApiKey.valueFrom | object | `{}` | The verbatim input for valueFrom to use to retrieve the API Key used in the CONNECT_API_KEY environment variable passed to the Chronicle Agent. |
| chronicleAgent.enabled | bool | `false` | Whether to enable the Chronicle Agent sidecar container |
| chronicleAgent.env | list | `[]` | An array of maps that is injected as-is into the "env:" component of the container spec |
| chronicleAgent.image.imagePullPolicy | string | `"IfNotPresent"` | The pull policy for the Chronicle Agent image |
| chronicleAgent.image.registry | string | `"ghcr.io"` | The registry to use for the Chronicle Agent image |
| chronicleAgent.image.repository | string | `"rstudio/chronicle-agent"` | The repository to use for the Chronicle Agent image |
| chronicleAgent.image.tag | string | `""` | A tag to use for the Chronicle Agent image. If not set, the chart will attempt to look up the version of the deployed Chronicle server in the current namespace. |
| chronicleAgent.serverAddress | string | `""` | The address for the Chronicle server including the protocol (ex. "http://address"). If not set, the chart will attempt to look up the address of the Chronicle Server in the release namespace or the serverNamespace if provided. |
| chronicleAgent.serverNamespace | string | `""` | The namespace for the Chronicle server. If not set, the chart will attempt to look up the address of the Chronicle Server in the release namespace. |
| chronicleAgent.volumeMounts | list | `[]` | An array of maps that is injected as-is into the "volumeMounts" component of the container spec |
| command | list | `[]` | The pod's run command. By default, it uses the container's default |
| config | object | [Posit Connect Configuration Reference](https://docs.posit.co/connect/admin/appendix/off-host/helm-reference/) | A nested map of maps that generates the rstudio-connect.gcfg file |
| extraObjects | list | `[]` | Extra objects to deploy (value evaluated as a template) |
Expand Down
60 changes: 60 additions & 0 deletions charts/rstudio-connect/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,66 @@ Alternatively, database passwords may be set during `helm install` with the foll

`--set config.Postgres.Password="<YOUR_PASSWORD_HERE>"`

## Chronicle Agent

This chart supports use of a sidecar Chronicle agent to report data to a Chronicle server. The agent can be enabled
by setting `chronicleAgent.enabled=true`.

By default, the chart will attempt to lookup an existing Chronicle server deployed in the release namespace. The
searched namespace can be changed setting `chronicleAgent.serverNamespace`. If a server exists, it will set the
Chronicle agent's server value to the server's service name and will use an agent version to match the server version.
This auto-discovery behavior can be disabled by setting `chronicleAgent.autoDiscovery=false`.

To set the server address and/or version manually, set the following values:
```yaml
chronicleAgent:
enabled: true
serverAddress: <server-address>
image:
tag: <agent-version>
```

If preferred, the Chronicle agent can be directly defined as a sidecar container using either `initContainers`
(recommended) or `sidecar` values. Below is an example of directly defining the Chronicle agent as a native sidecar
container using `initContainers`:
```yaml
initContainers:
- name: chronicle-agent
restartPolicy: Always
image: ghcr.io/rstudio/chronicle-agent:<agent-version>
env:
- name: CHRONICLE_SERVER_ADDRESS
value: "http://<address>"
- name: CHRONICLE_CONNECT_APIKEY
valueFrom:
secretKeyRef:
name: connect
key: apikey
```

For more information on Chronicle, see the [Chronicle documentation](https://docs.posit.co/chronicle/).

### Chronicle Connect API Key

In order to communicate with Connect, the Chronicle agent must be passed an API key. This can either be done by passing
a Kubernetes secret (recommended) or by setting the key directly as an environment variable. Below is an example
of how to set the API key using a secret:
```yaml
chronicleAgent:
enabled: true
connectApiKey:
valueFrom:
secretKeyRef:
name: <secret-name>
key: <key-name>
```

Due to the way Connect manages its API keys, it is currently not possible to provision an API key automatically for the
Chronicle agent at the time of deployment. To workaround this issue in a fresh deployment, you can initially leave
the API key unset for the Chronicle agent, deploy the chart, create an administrator API key, and then provision a
secret with the API key. Once the secret is created, the value of `chronicleAgent.connectApiKey.secretKeyRef`
can be set and the chart can be upgraded to include the new value.

## General principles

- In most places, we opt to pass Helm values over configmaps. We translate these into the valid `.gcfg` file format
Expand Down
29 changes: 27 additions & 2 deletions charts/rstudio-connect/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,34 @@ spec:
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.initContainers }}
{{- if or .Values.initContainers .Values.chronicleAgent.enabled }}
initContainers:
{{ toYaml .Values.initContainers | indent 8 }}
{{- if .Values.chronicleAgent.enabled }}
- name: chronicle-agent
image: {{ include "rstudio-library.chronicle-agent.image" (dict "chronicleAgent" .Values.chronicleAgent "Release" .Release) | trim | quote }}
imagePullPolicy: {{ .Values.chronicleAgent.image.imagePullPolicy }}
restartPolicy: Always
{{- with .Values.chronicleAgent.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 10 }}
{{- end }}
env:
- name: CHRONICLE_SERVER_ADDRESS
value: {{ include "rstudio-library.chronicle-agent.serverAddress" (dict "chronicleAgent" .Values.chronicleAgent "Release" .Release) | trim | quote }}
- name: CHRONICLE_CONNECT_APIKEY
{{- if .Values.chronicleAgent.connectApiKey.valueFrom }}
valueFrom:
{{ toYaml .Values.chronicleAgent.connectApiKey.valueFrom | indent 14 }}
{{- else }}
value: {{ .Values.chronicleAgent.connectApiKey.value | quote }}
{{- end }}
{{- with .Values.chronicleAgent.env }}
{{ toYaml . | indent 10 }}
{{- end }}
{{- end }}
{{- with .Values.initContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
containers:
- name: connect
Expand Down
30 changes: 30 additions & 0 deletions charts/rstudio-connect/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,36 @@ ingress:
# hosts:
# - chart-example.local

# -- Settings for the Chronicle Agent sidecar container
chronicleAgent:
# -- Whether to enable the Chronicle Agent sidecar container
enabled: false
# -- An array of maps that is injected as-is into the "env:" component of the container spec
env: []
# -- An array of maps that is injected as-is into the "volumeMounts" component of the container spec
volumeMounts: []
# -- If true, the chart will attempt to lookup the Chronicle Server address and version in the cluster
autoDiscovery: true
image:
# -- The registry to use for the Chronicle Agent image
registry: ghcr.io
# -- The repository to use for the Chronicle Agent image
repository: rstudio/chronicle-agent
# -- A tag to use for the Chronicle Agent image. If not set, the chart will attempt to look up the version of the deployed Chronicle server in the current namespace.
tag: ""
# -- The pull policy for the Chronicle Agent image
imagePullPolicy: IfNotPresent
# -- The address for the Chronicle server including the protocol (ex. "http://address"). If not set, the chart will attempt to look up the address of the Chronicle Server in the release namespace or the serverNamespace if provided.
serverAddress: ""
# -- The namespace for the Chronicle server. If not set, the chart will attempt to look up the address of the Chronicle Server in the release namespace.
serverNamespace: ""
# -- An API key generated in Connect that can be used for the Chronicle Agent to authenticate with the Connect server for metrics. This generally must be set after the initial deployment of the Connect pod.
connectApiKey:
# -- The verbatim value for the API Key used in the CONNECT_API_KEY environment variable passed to the Chronicle Agent. It is recommended to reference a secret with valueFrom instead of this.
value: ""
# -- The verbatim input for valueFrom to use to retrieve the API Key used in the CONNECT_API_KEY environment variable passed to the Chronicle Agent.
valueFrom: {}

launcher:
# -- Whether to enable the launcher
enabled: false
Expand Down
6 changes: 3 additions & 3 deletions charts/rstudio-workbench/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: rstudio-library
repository: https://helm.rstudio.com
version: 0.1.31
digest: sha256:2a0e98b8fa01730bf2db3816a7310462c921b9fa2f1f3c74f85fedede82e1593
generated: "2024-11-01T10:20:55.670732-04:00"
version: 0.1.34
digest: sha256:66324c3ca436a3743e6f7c3dd8e159d21fca4fd5072d4d8c2583bfafd8499d70
generated: "2025-05-20T10:37:32.909079863-06:00"
4 changes: 2 additions & 2 deletions 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 Posit Workbench
version: 0.9.1
version: 0.9.2
apiVersion: v2
appVersion: 2025.05.0
icon: https://rstudio.com/wp-content/uploads/2018/10/RStudio-Logo-Flat.png
Expand All @@ -13,7 +13,7 @@ maintainers:
url: https://github.com/sol-eng
dependencies:
- name: rstudio-library
version: 0.1.31
version: 0.1.34
repository: https://helm.rstudio.com
annotations:
artifacthub.io/images: |
Expand Down
6 changes: 6 additions & 0 deletions charts/rstudio-workbench/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.9.2

- Bump `rstudio-library` chart version to `0.1.32`.
- Adds a shortcut resource deployment for Chronicle Agent via `chronicleAgent.enabled`. The value is disabled by default
and does not affect existing deployments that use `sidecar` or `initContainer` to deploy the Chronicle Agent.

## 0.9.1

- Bump Workbench version to 2025.05.0
Expand Down
Loading