Skip to content

Commit

Permalink
fix command syntax to work on the CLI scratch image (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
sami-alajrami authored Mar 6, 2024
1 parent 8ddca2e commit d87d3f6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion charts/k8s-reporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.4.2
version: 1.4.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
18 changes: 14 additions & 4 deletions charts/k8s-reporter/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,29 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: KOSLI_ORG
value: {{ required ".Values.reporterConfig.kosliOrg is required" .Values.reporterConfig.kosliOrg }}
- name: KOSLI_API_TOKEN
valueFrom:
secretKeyRef:
name: {{ required ".Values.kosliApiToken.secretName is required." .Values.kosliApiToken.secretName }}
key: {{ .Values.kosliApiToken.secretKey | default "token" }}
{{ if .Values.reporterConfig.namespaces }}
- name: KOSLI_NAMESPACES
value: {{ .Values.reporterConfig.namespaces | quote }}
{{ end }}
{{- range $key, $value := .Values.env }}
- name: {{ $key }}
value: {{ $value }}
{{ end }}
command:
- /bin/sh
- -c
- kosli snapshot k8s {{ required ".Values.reporterConfig.kosliEnvironmentName is required" .Values.reporterConfig.kosliEnvironmentName }} {{ if .Values.reporterConfig.namespaces }} --namespaces {{ .Values.reporterConfig.namespaces | quote }} {{ end }} --org {{ required ".Values.reporterConfig.kosliOrg is required" .Values.reporterConfig.kosliOrg }} {{ if .Values.reporterConfig.dryRun }}--dry-run{{ end }}
args:
- snapshot
- k8s
- {{ required ".Values.reporterConfig.kosliEnvironmentName is required" .Values.reporterConfig.kosliEnvironmentName }}
{{ if .Values.reporterConfig.dryRun }}
- --dry-run
{{ end }}

resources:
{{ toYaml .Values.resources | indent 14 }}
restartPolicy: Never
15 changes: 8 additions & 7 deletions charts/k8s-reporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template
name: ""

# -- the cron schedule at which the reporter is triggered to report to kosli
# -- the cron schedule at which the reporter is triggered to report to Kosli
cronSchedule: "*/5 * * * *"

kosliApiToken:
# -- the name of the secret containing the kosli API token
secretName: ""
# -- the name of the key in the secret data which contains the kosli API token
secretKey: ""
secretName: "kosli-api-token"
# -- the name of the key in the secret data which contains the Kosli API token
secretKey: "key"

reporterConfig:
# -- the name of the kosli org
# -- the name of the Kosli org
kosliOrg: ""
# -- the name of kosli environment that the k8s cluster/namespace correlates to
# -- the name of Kosli environment that the k8s cluster/namespace correlates to
kosliEnvironmentName: ""
# -- the namespaces which represent the environment.
# It is a comma separated list of namespace name regex patterns.
Expand All @@ -46,8 +46,9 @@ reporterConfig:
# -- 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.
dryRun: false

# Uncomment the env variable below and replace <instance_name>, if you are on a single tenant Kosli instance
# env:
# KOSLI_HOST: https://staging.app.kosli.com
# KOSLI_HOST: https://<instance_name>.kosli.com

# -- any custom annotations to be added to the cronjob
podAnnotations: {}
Expand Down

0 comments on commit d87d3f6

Please sign in to comment.