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

feat(cluster-scanner): Add dynamic envs to values #1358

Merged
merged 4 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion charts/cluster-scanner/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Sysdig Cluster Scanner

type: application

version: 0.5.4
version: 0.5.5

appVersion: "0.1.0"
home: https://www.sysdig.com/
Expand Down
10 changes: 6 additions & 4 deletions charts/cluster-scanner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $ pre-commit run -a
$ helm repo add sysdig https://charts.sysdig.com
$ helm repo update
$ helm upgrade --install sysdig-cluster-scanner sysdig/cluster-scanner \
--create-namespace -n sysdig --version=0.5.4 \
--create-namespace -n sysdig --version=0.5.5 \
--set global.clusterConfig.name=CLUSTER_NAME \
--set global.sysdig.region=SYSDIG_REGION \
--set global.sysdig.accessKey=YOUR-KEY-HERE
Expand Down Expand Up @@ -55,7 +55,7 @@ To install the chart with the release name `cluster-scanner`, run:

```console
$ helm upgrade --install sysdig-cluster-scanner sysdig/cluster-scanner \
--create-namespace -n sysdig --version=0.5.4 \
--create-namespace -n sysdig --version=0.5.5 \
--set global.clusterConfig.name=CLUSTER_NAME \
--set global.sysdig.region=SYSDIG_REGION \
--set global.sysdig.accessKey=YOUR-KEY-HERE
Expand Down Expand Up @@ -119,6 +119,7 @@ The following table lists the configurable parameters of the `cluster-scanner` c
| runtimeStatusIntegrator.resources.limits.memory | Runtime Status Integrator Memory limit per replica | <code>350Mi</code> |
| runtimeStatusIntegrator.resources.requests.cpu | Runtime Status Integrator CPU requests per replica | <code>"350m"</code> |
| runtimeStatusIntegrator.resources.requests.memory | Runtime Status Integrator Memory requests per replica | <code>350Mi</code> |
| runtimeStatusIntegrator.env | Runtime Status Integrator env allows the definition of environment variables | <code>{}</code> |
| runtimeStatusIntegrator.natsJS.user | The username to be used in the NATS JetStream instance the Runtime Status Integrator is going to start | <code>"default-user"</code> |
| imageSbomExtractor.image.registry | The image registry to use for the Image SBOM Extractor component of Cluster Scanner | <code>quay.io</code> |
| imageSbomExtractor.image.repository | The image repository to use for pulling the Image SBOM Extractor image | <code>sysdig/image-sbom-extractor</code> |
Expand All @@ -129,6 +130,7 @@ The following table lists the configurable parameters of the `cluster-scanner` c
| imageSbomExtractor.resources.limits.memory | Image SBOM Extractor Memory limit per replica | <code>350Mi</code> |
| imageSbomExtractor.resources.requests.cpu | Image SBOM Extractor CPU requests per replica | <code>"350m"</code> |
| imageSbomExtractor.resources.requests.memory | Image SBOM Extractor Memory requests per replica | <code>350Mi</code> |
| imageSbomExtractor.env | Image SBOM Extractor env allows the definition of environment variables | <code>{}</code> |
| imageSbomExtractor.cache.type | The type of cache to use. Allowed values are `local`, `distributed` and `distributed,local`. When specified more than one, the cache precedence will be applied from right to left. Eg: `distributed,local` will try to hit the local one first, than fallback to distributed one (redis) When setting `distributed`, you should also setup redis settings below accordingly with your redis installation. | <code>"local"</code> |
| imageSbomExtractor.cache.local.maxSizeBytes | The maximum size in bytes of the local cache. By default it is set to 35MB | <code>"36700160"</code> |
| imageSbomExtractor.cache.local.maxElementSizeBytes | When using `local` as cache type, restrict the maximum size of elements to be cached. By default it is set to 100KB | <code>"102400"</code> |
Expand Down Expand Up @@ -159,7 +161,7 @@ Specify each parameter using the **`--set key=value[,key=value]`** argument to `

```console
$ helm upgrade --install sysdig-cluster-scanner sysdig/cluster-scanner \
--create-namespace -n sysdig --version=0.5.4 \
--create-namespace -n sysdig --version=0.5.5 \
--set global.sysdig.region="us1"
```

Expand All @@ -168,7 +170,7 @@ installing the chart. For example:

```console
$ helm upgrade --install sysdig-cluster-scanner sysdig/cluster-scanner \
--create-namespace -n sysdig --version=0.5.4 \
--create-namespace -n sysdig --version=0.5.5 \
--values values.yaml
```

Expand Down
8 changes: 8 additions & 0 deletions charts/cluster-scanner/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ spec:
name: {{ include "cluster-scanner.fullname" . }}
key: rsi_js_server_metrics_port
optional: true
{{- range $key, $value := .Values.runtimeStatusIntegrator.env }}
- name: "{{ $key }}"
value: "{{ $value }}"
{{- end }}
{{- with .Values.runtimeStatusIntegrator }}
livenessProbe:
httpGet:
Expand Down Expand Up @@ -536,6 +540,10 @@ spec:
key: cache_redis_ttl
optional: true
{{- end }}
{{- range $key, $value := .Values.imageSbomExtractor.env }}
- name: "{{ $key }}"
value: "{{ $value }}"
{{- end }}
{{- with .Values.imageSbomExtractor }}
resources:
{{- toYaml .resources | nindent 12 }}
Expand Down
32 changes: 32 additions & 0 deletions charts/cluster-scanner/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -440,3 +440,35 @@ tests:
content:
name: PPROF_PORT
value: "666"

- it: "sets optional envs"
templates:
- ../templates/deployment.yaml
set:
runtimeStatusIntegrator.env: { ENV_VAR_STRING: "test", ENV_VAR_NUM: 15 }
imageSbomExtractor.env: { ENV_VAR_BOOL: true }
asserts:
- not: true
isEmpty:
path: spec.template.spec.containers[0].env[?(@.name == "ENV_VAR_STRING")]
- isSubset:
path: spec.template.spec.containers[0].env[?(@.name == "ENV_VAR_STRING")]
content:
name: ENV_VAR_STRING
value: "test"
- not: true
isEmpty:
path: spec.template.spec.containers[0].env[?(@.name == "ENV_VAR_NUM")]
- isSubset:
path: spec.template.spec.containers[0].env[?(@.name == "ENV_VAR_NUM")]
content:
name: ENV_VAR_NUM
value: "15"
- not: true
isEmpty:
path: spec.template.spec.containers[1].env[?(@.name == "ENV_VAR_BOOL")]
- isSubset:
path: spec.template.spec.containers[1].env[?(@.name == "ENV_VAR_BOOL")]
content:
name: ENV_VAR_BOOL
value: "true"
6 changes: 6 additions & 0 deletions charts/cluster-scanner/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ runtimeStatusIntegrator:
# Runtime Status Integrator Memory requests per replica
memory: 350Mi

# Runtime Status Integrator env allows the definition of environment variables
env: {}
FedericoFeresini marked this conversation as resolved.
Show resolved Hide resolved

natsJS:
# The username to be used in the NATS JetStream instance the Runtime Status
# Integrator is going to start
Expand Down Expand Up @@ -180,6 +183,9 @@ imageSbomExtractor:
# Image SBOM Extractor Memory requests per replica
memory: 350Mi

# Image SBOM Extractor env allows the definition of environment variables
env: {}

cache:
# The type of cache to use.
# Allowed values are `local`, `distributed` and `distributed,local`.
Expand Down
Loading