Skip to content

Commit 181dc27

Browse files
Provide Examples of Worker SH Helm Chart Setup (#2508)
1 parent 3978779 commit 181dc27

9 files changed

Lines changed: 193 additions & 0 deletions

File tree

examples/worker/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# JFrog Worker
2+
3+
JFrog Worker lets you run custom serverless code (Workers) that react to events in the JFrog Platform — for example, before/after a repository upload or download, or on a schedule — without deploying and managing your own service.
4+
5+
Workers are written in JavaScript/TypeScript, run in an isolated sandbox, and are triggered by the JFrog Platform based on the events and permissions you configure for them. This chart deploys the Worker service, which hosts and executes those Workers.
6+
7+
See the [JFrog Workers documentation](https://docs.jfrog.com/administration/docs/workers-overview) for the full list of supported event types, quotas, and configuration options.
8+
9+
## Examples
10+
11+
| Example | Description |
12+
| --- | --- |
13+
| [global-values](global-values) | Configure Worker via the shared `global` values block (for example when deployed alongside Artifactory via `jfrog-platform`) |
14+
| [extra-system-yaml](extra-system-yaml) | Override/extend `system.yaml` entries via `extraSystemYaml` |
15+
| [container-security-context](container-security-context) | Configure `containerSecurityContext` on the worker/router containers (replaces the deprecated `securityContext` key) |
16+
| [loggers](loggers) | Expose specific log files as sidecar containers via `loggers` for `kubectl logs`/log-collector visibility |
17+
18+
## Deploy
19+
20+
```shell
21+
helm upgrade --install worker jfrog/worker \
22+
--set jfrogUrl=https://<your-jpd> \
23+
--set joinKey=<join-key> \
24+
--set masterKey=<master-key>
25+
```
26+
27+
See the chart's [values.yaml](../../stable/worker/values.yaml) for the full set of configuration options.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Worker Container Security Context
2+
3+
This example shows how to configure a security context on the `worker` and `router` containers using the `containerSecurityContext` values block.
4+
5+
`containerSecurityContext` is the supported way to control container-level security settings such as `runAsNonRoot`, `allowPrivilegeEscalation`, and dropped Linux capabilities. It is enabled by default with a sensible baseline; the values below show how to further restrict it by dropping the `NET_RAW` capability.
6+
7+
See the [container-security-context-values.yaml](container-security-context-values.yaml) for the configuration example.
8+
9+
## How it works
10+
11+
- `containerSecurityContext` is rendered into the Kubernetes `securityContext` field of both the `worker` and `router` containers in the Worker Deployment.
12+
- `capabilities.drop` accepts a list of Linux capabilities to remove from the containers, in addition to `runAsNonRoot` and `allowPrivilegeEscalation`.
13+
14+
## Deploy
15+
16+
Install Worker with the following command:
17+
18+
```shell
19+
helm upgrade --install worker jfrog/worker -f container-security-context-values.yaml
20+
```
21+
22+
## Notes
23+
24+
- The older top-level `securityContext` key is no longer supported. Setting it causes `helm template`/`helm install` to fail with:
25+
```
26+
.Values.securityContext is no longer supported and should be replaced with .Values.containerSecurityContext
27+
```
28+
If you have `securityContext` set anywhere in your values, replace it with the equivalent `containerSecurityContext` keys shown in this example.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
jfrogUrl: "http://artifactory-local.my-arti.svc.cluster.local:8082"
2+
joinKey: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
3+
masterKey: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
4+
containerSecurityContext:
5+
enabled: true
6+
runAsNonRoot: true
7+
allowPrivilegeEscalation: false
8+
capabilities:
9+
drop:
10+
- NET_RAW
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Worker Extra System YAML
2+
3+
This example shows how to add custom settings to Worker's `system.yaml` using the `extraSystemYaml` block, without having to override the whole file.
4+
5+
`system.yaml` is the configuration file used internally by Worker (and the Router it runs alongside). The chart renders a base `system.yaml` from its own templates and then merges anything set under `extraSystemYaml` on top of it, so you only need to specify the keys you want to add or change.
6+
7+
See the [extra-system-yaml-values.yaml](extra-system-yaml-values.yaml) for the configuration example.
8+
9+
## How it works
10+
11+
- The chart's base `system.yaml` is rendered from `files/system.yaml` (values like `router.serviceRegistry.insecure` are already wired into it as top-level chart values).
12+
- `extraSystemYaml` is deep-merged on top of that rendered base (`extraSystemYaml` wins on conflicts), and the merged result is templated again so any `{{ ... }}` values you set are resolved.
13+
- The final content is stored in the `<release-name>-worker-systemyaml` Secret and mounted into the pod as `/var/opt/jfrog/worker/etc/system.yaml`.
14+
15+
Because of this merge, `extraSystemYaml` can be used to:
16+
- Add settings that have no dedicated top-level value (for example `shared.node.id` / `shared.node.ip`, or `worker.logging.application.level`), and
17+
- Override the value the chart would otherwise compute for an existing key (for example `router.serviceRegistry.insecure`, which is normally set from `.Values.router.serviceRegistry.insecure`).
18+
19+
## Deploy
20+
21+
Install Worker with the following command:
22+
23+
```shell
24+
helm upgrade --install worker jfrog/worker -f extra-system-yaml-values.yaml
25+
```
26+
27+
## Notes
28+
29+
- `extraSystemYaml` follows the same structure as `system.yaml` itself, so nest keys under `shared`, `router`, `worker`, etc. as they appear in the rendered file.
30+
- If you only need to override a value the chart already exposes as a top-level setting (like `router.serviceRegistry.insecure`), prefer setting that value directly; use `extraSystemYaml` when there is no dedicated value or when adding entirely new settings.
31+
- To fully replace `system.yaml` instead of merging into it, use `systemYamlOverride.existingSecret` (or provide your own `systemYaml` block) to point at your own configuration.
32+
- See the [Worker YAML Configuration documentation](https://docs.jfrog.com/installation/docs/worker-yaml-configuration) for the full list of configuration values supported under `system.yaml`.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
global:
2+
jfrogUrl: "http://artifactory-local.my-arti.svc.cluster.local:8082"
3+
joinKey: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
4+
masterKey: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
5+
extraSystemYaml:
6+
shared:
7+
node:
8+
id: my-node-id
9+
ip: 10.0.0.1
10+
router:
11+
serviceRegistry:
12+
insecure: true
13+
worker:
14+
logging:
15+
application:
16+
level: debug
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Worker Global Values
2+
3+
This example shows how to configure JFrog Worker using the `global` values block instead of (or in addition to) the regular top-level values.
4+
5+
`global` values are meant for settings that are typically shared across multiple JFrog charts deployed together (for example when Worker is deployed as part of the `jfrog-platform` chart, alongside Artifactory). Values under `global` take precedence over their equivalent top-level (service-level) values.
6+
7+
See the [global-values.yaml](global-values.yaml) for the configuration example.
8+
9+
## Precedence
10+
11+
For the values below, if both `global.<key>` and the top-level `<key>` are set, `global.<key>` wins:
12+
13+
| Global value | Equivalent top-level value | Notes |
14+
| --- | --- | --- |
15+
| `global.jfrogUrl` | `jfrogUrl` | Artifactory URL |
16+
| `global.joinKey` / `global.joinKeySecretName` | `joinKey` / `joinKeySecretName` | Join key used to connect Worker to Artifactory |
17+
| `global.masterKey` / `global.masterKeySecretName` | `masterKey` / `masterKeySecretName` | Unique master key |
18+
| `global.imageRegistry` | `image.registry` (per-image) | Overrides the registry for all images |
19+
| `global.imagePullSecrets` | `image.pullSecrets` (per-image) | Merged with existing pull secrets |
20+
| `global.versions.<component>` | Image `tag` (per-image) | Order of preference: 1) `global.versions` 2) image tag 3) `Chart.AppVersion` |
21+
| `global.nodeSelector` | `nodeSelector` | Applies to Worker pods |
22+
| `global.customCertificates.enabled` | `customCertificates.enabled` | Custom certificates copied to the trusted keys directory |
23+
| `global.customVolumes` / `global.customVolumeMounts` | `common.customVolumes` / `common.customVolumeMounts` | Both global and common entries are applied simultaneously (not mutually exclusive) |
24+
| `global.customInitContainers` / `global.customSidecarContainers` | `common.customInitContainers` / `common.customSidecarContainers` | Both global and common entries are applied simultaneously (not mutually exclusive) |
25+
26+
## Deploy
27+
28+
Install Worker with the following command:
29+
30+
```shell
31+
helm upgrade --install worker jfrog/worker -f global-values.yaml
32+
```
33+
34+
## When to use global values
35+
36+
Use `global` values when deploying Worker together with other JFrog charts (for example via the `jfrog-platform` umbrella chart) and you want a single place to set values like `jfrogUrl`, `joinKey`, `masterKey`, `imageRegistry` or image versions that should apply consistently across all the deployed services.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
global:
2+
jfrogUrl: "http://artifactory-local.my-arti.svc.cluster.local:8082"
3+
versions:
4+
worker: 1.216.0
5+
imagePullSecrets:
6+
- mysecret
7+
imageRegistry: myregistry.com
8+
joinKey: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
9+
masterKey: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

examples/worker/loggers/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Worker Loggers
2+
3+
This example shows how to expose specific Worker/Router log files as sidecar containers using the `loggers` value, so they can be viewed with `kubectl logs` or picked up by a log collector without exec'ing into the pod.
4+
5+
See the [loggers-values.yaml](loggers-values.yaml) for the configuration example.
6+
7+
## How it works
8+
9+
- For each log file name listed in `loggers`, the chart adds an extra sidecar container to the Worker Deployment (named after the log file, e.g. `worker-service.log` becomes the `worker-service-log` container) that tails that log file.
10+
- The available logger names are:
11+
- `router-request.log`
12+
- `router-service.log`
13+
- `router-traefik.log`
14+
- `worker-service.log`
15+
- `worker-request.log`
16+
- Resource requests/limits for these sidecars can be set with `loggersResources`.
17+
18+
## Deploy
19+
20+
Install Worker with the following command:
21+
22+
```shell
23+
helm upgrade --install worker jfrog/worker -f loggers-values.yaml
24+
```
25+
26+
## Notes
27+
28+
- Once deployed, view a given logger's output with `kubectl logs <worker-pod> -c <logger-container>` (for example `kubectl logs <worker-pod> -c worker-service-log`).
29+
- Any log collector that scrapes container stdout in the cluster will automatically pick up these sidecars' output as well.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
jfrogUrl: "http://artifactory-local.my-arti.svc.cluster.local:8082"
2+
joinKey: EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
3+
masterKey: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
4+
loggers:
5+
- worker-service.log
6+
- worker-request.log

0 commit comments

Comments
 (0)