Skip to content

Commit 43b1fae

Browse files
authored
feat: Expand Helm support for CronJob fields (#705)
1 parent 9142ede commit 43b1fae

5 files changed

Lines changed: 39 additions & 22 deletions

File tree

charts/k8s-reporter/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 2.0.0
18+
version: 2.1.0
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

charts/k8s-reporter/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Kubernetes Reporter Helm Chart
44

55
# k8s-reporter
66

7-
![Version: 2.0.0](https://img.shields.io/badge/Version-2.0.0-informational?style=flat-square)
7+
![Version: 2.1.0](https://img.shields.io/badge/Version-2.1.0-informational?style=flat-square)
88

99
A Helm chart for installing the Kosli K8S reporter as a cronjob.
1010
The chart allows you to create a Kubernetes cronjob and all its necessary RBAC to report running images to Kosli at a given cron schedule.
@@ -99,17 +99,19 @@ helm uninstall kosli-reporter
9999
## Configurations
100100
| Key | Type | Default | Description |
101101
|-----|------|---------|-------------|
102-
| cronSchedule | string | `"*/5 * * * *"` | the cron schedule at which the reporter is triggered to report to Kosli |
102+
| concurrencyPolicy | string | `"Replace"` | specifies how to treat concurrent executions of a Job that is created by this CronJob |
103+
| cronSchedule | string | `"*/5 * * * *"` | the cron schedule at which the reporter is triggered to report to Kosli |
104+
| failedJobsHistoryLimit | int | `1` | specifies the number of failed finished jobs to keep |
103105
| fullnameOverride | string | `""` | overrides the fullname used for the created k8s resources. It has higher precedence than `nameOverride` |
104106
| image.pullPolicy | string | `"IfNotPresent"` | the kosli reporter image pull policy |
105107
| image.repository | string | `"ghcr.io/kosli-dev/cli"` | the kosli reporter image repository |
106108
| image.tag | string | `"v2.12.0"` | the kosli reporter image tag, overrides the image tag whose default is the chart appVersion. |
107109
| kosliApiToken.secretKey | string | `"key"` | the name of the key in the secret data which contains the Kosli API token |
108110
| kosliApiToken.secretName | string | `"kosli-api-token"` | the name of the secret containing the kosli API token |
109111
| nameOverride | string | `""` | overrides the name used for the created k8s resources. If `fullnameOverride` is provided, it has higher precedence than this one |
110-
| podAnnotations | object | `{}` | |
112+
| podAnnotations | object | `{}` | any custom annotations to be added to the cronjob |
111113
| podLabels | object | `{}` | custom labels to add to pods |
112-
| reporterConfig.dryRun | bool | `false` | |
114+
| reporterConfig.dryRun | bool | `false` | whether the dry run mode is enabled or not. In dry run mode, the reporter logs the reports to stdout and does not send them to kosli. |
113115
| reporterConfig.environments | list | `[]` | List of Kosli environments to report to. Each entry has required 'name' and optional namespace selectors. Use one entry to report a single environment; use multiple entries to report to multiple environments with different selectors. Per entry: name (required), namespaces, namespacesRegex, excludeNamespaces, excludeNamespacesRegex (optional). Leave namespace fields unset for an entry to report the entire cluster to that environment. |
114116
| reporterConfig.httpProxy | string | `""` | the http proxy url |
115117
| reporterConfig.kosliOrg | string | `""` | the name of the Kosli org |
@@ -124,7 +126,8 @@ helm uninstall kosli-reporter
124126
| serviceAccount.create | bool | `true` | specifies whether a service account should be created |
125127
| serviceAccount.name | string | `""` | the name of the service account to use. If not set and create is true, a name is generated using the fullname template |
126128
| serviceAccount.permissionScope | string | `"cluster"` | specifies whether to create a cluster-wide permissions for the service account or namespace-scoped permissions. allowed values are: [cluster, namespace] |
129+
| successfulJobsHistoryLimit | int | `3` | specifies the number of successful finished jobs to keep |
127130

128131
----------------------------------------------
129-
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
132+
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
130133

charts/k8s-reporter/templates/cronjob.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@ metadata:
99

1010
spec:
1111
schedule: {{ .Values.cronSchedule | quote }}
12-
concurrencyPolicy: Replace
12+
concurrencyPolicy: {{ .Values.concurrencyPolicy }}
1313
startingDeadlineSeconds: 30
14+
successfulJobsHistoryLimit: {{ .Values.successfulJobsHistoryLimit }}
15+
failedJobsHistoryLimit: {{ .Values.failedJobsHistoryLimit }}
1416
jobTemplate:
1517
spec:
1618
template:
1719
metadata:
18-
labels:
20+
labels:
1921
{{- range $key, $value := .Values.podLabels }}
2022
{{ $key }}: {{ $value }}
21-
{{ end }}
23+
{{ end }}
2224
spec:
2325
serviceAccountName: {{ include "reporter.serviceAccountName" . }}
2426
volumes:
@@ -62,20 +64,20 @@ spec:
6264
{{- range $key, $value := .Values.env }}
6365
- name: {{ $key }}
6466
value: {{ $value }}
65-
{{ end }}
67+
{{ end }}
6668
args:
6769
- snapshot
6870
- k8s
6971
- --config-file
7072
- /config/config.yaml
7173
{{ if .Values.reporterConfig.dryRun }}
72-
- --dry-run
74+
- --dry-run
7375
{{ end }}
7476
{{ if .Values.reporterConfig.httpProxy }}
75-
- --http-proxy
77+
- --http-proxy
7678
- {{ .Values.reporterConfig.httpProxy }}
7779
{{ end }}
78-
80+
7981
resources:
8082
{{ toYaml .Values.resources | indent 14 }}
8183
restartPolicy: Never

charts/k8s-reporter/values.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Default values for k8s-reporter.
1+
# Default values for k8s-reporter.
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
44

@@ -26,9 +26,18 @@ serviceAccount:
2626
# If not set and create is true, a name is generated using the fullname template
2727
name: ""
2828

29-
# -- the cron schedule at which the reporter is triggered to report to Kosli
29+
# -- the cron schedule at which the reporter is triggered to report to Kosli
3030
cronSchedule: "*/5 * * * *"
3131

32+
# -- specifies how to treat concurrent executions of a Job that is created by this CronJob
33+
concurrencyPolicy: Replace
34+
35+
# -- specifies the number of successful finished jobs to keep
36+
successfulJobsHistoryLimit: 3
37+
38+
# -- specifies the number of failed finished jobs to keep
39+
failedJobsHistoryLimit: 1
40+
3241
# -- custom labels to add to pods
3342
podLabels: {}
3443

@@ -80,12 +89,12 @@ reporterConfig:
8089
# -- any custom annotations to be added to the cronjob
8190
podAnnotations: {}
8291

83-
resources:
92+
resources:
8493
requests:
8594
# -- the memory request
8695
memory: "64Mi"
8796
limits:
8897
# -- the memory limit
8998
memory: "256Mi"
9099
# -- the cpu limit
91-
cpu: "100m"
100+
cpu: "100m"

docs.kosli.com/content/helm/_index.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Kubernetes Reporter Helm Chart
44

55
# k8s-reporter
66

7-
![Version: 2.0.0](https://img.shields.io/badge/Version-2.0.0-informational?style=flat-square)
7+
![Version: 2.1.0](https://img.shields.io/badge/Version-2.1.0-informational?style=flat-square)
88

99
A Helm chart for installing the Kosli K8S reporter as a cronjob.
1010
The chart allows you to create a Kubernetes cronjob and all its necessary RBAC to report running images to Kosli at a given cron schedule.
@@ -99,17 +99,19 @@ helm uninstall kosli-reporter
9999
## Configurations
100100
| Key | Type | Default | Description |
101101
|-----|------|---------|-------------|
102-
| cronSchedule | string | `"*/5 * * * *"` | the cron schedule at which the reporter is triggered to report to Kosli |
102+
| concurrencyPolicy | string | `"Replace"` | specifies how to treat concurrent executions of a Job that is created by this CronJob |
103+
| cronSchedule | string | `"*/5 * * * *"` | the cron schedule at which the reporter is triggered to report to Kosli |
104+
| failedJobsHistoryLimit | int | `1` | specifies the number of failed finished jobs to keep |
103105
| fullnameOverride | string | `""` | overrides the fullname used for the created k8s resources. It has higher precedence than `nameOverride` |
104106
| image.pullPolicy | string | `"IfNotPresent"` | the kosli reporter image pull policy |
105107
| image.repository | string | `"ghcr.io/kosli-dev/cli"` | the kosli reporter image repository |
106108
| image.tag | string | `"v2.12.0"` | the kosli reporter image tag, overrides the image tag whose default is the chart appVersion. |
107109
| kosliApiToken.secretKey | string | `"key"` | the name of the key in the secret data which contains the Kosli API token |
108110
| kosliApiToken.secretName | string | `"kosli-api-token"` | the name of the secret containing the kosli API token |
109111
| nameOverride | string | `""` | overrides the name used for the created k8s resources. If `fullnameOverride` is provided, it has higher precedence than this one |
110-
| podAnnotations | object | `{}` | |
112+
| podAnnotations | object | `{}` | any custom annotations to be added to the cronjob |
111113
| podLabels | object | `{}` | custom labels to add to pods |
112-
| reporterConfig.dryRun | bool | `false` | |
114+
| reporterConfig.dryRun | bool | `false` | whether the dry run mode is enabled or not. In dry run mode, the reporter logs the reports to stdout and does not send them to kosli. |
113115
| reporterConfig.environments | list | `[]` | List of Kosli environments to report to. Each entry has required 'name' and optional namespace selectors. Use one entry to report a single environment; use multiple entries to report to multiple environments with different selectors. Per entry: name (required), namespaces, namespacesRegex, excludeNamespaces, excludeNamespacesRegex (optional). Leave namespace fields unset for an entry to report the entire cluster to that environment. |
114116
| reporterConfig.httpProxy | string | `""` | the http proxy url |
115117
| reporterConfig.kosliOrg | string | `""` | the name of the Kosli org |
@@ -124,7 +126,8 @@ helm uninstall kosli-reporter
124126
| serviceAccount.create | bool | `true` | specifies whether a service account should be created |
125127
| serviceAccount.name | string | `""` | the name of the service account to use. If not set and create is true, a name is generated using the fullname template |
126128
| serviceAccount.permissionScope | string | `"cluster"` | specifies whether to create a cluster-wide permissions for the service account or namespace-scoped permissions. allowed values are: [cluster, namespace] |
129+
| successfulJobsHistoryLimit | int | `3` | specifies the number of successful finished jobs to keep |
127130

128131
----------------------------------------------
129-
Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0)
132+
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
130133

0 commit comments

Comments
 (0)