Skip to content

Commit

Permalink
fix: allow for templating of command
Browse files Browse the repository at this point in the history
  • Loading branch information
knechtionscoding committed Apr 5, 2023
1 parent 1598997 commit 33472b6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions charts/ecr-cleanup/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ 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: 0.2.6
version: 0.2.7

# 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
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.2.6"
appVersion: "0.2.7"
3 changes: 2 additions & 1 deletion charts/ecr-cleanup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ Deploys a job that cleans up an ECR repo based on the following rules.
3. Has the container been tagged with the word `keep`
4. Is the container the only tag in the ECR repository

![Version: 0.2.6](https://img.shields.io/badge/Version-0.2.6-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.2.6](https://img.shields.io/badge/AppVersion-0.2.6-informational?style=flat-square)
![Version: 0.2.7](https://img.shields.io/badge/Version-0.2.7-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.2.7](https://img.shields.io/badge/AppVersion-0.2.7-informational?style=flat-square)

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| awsRegistryId | string | `""` | ECR Registry ID to override picking the default |
| command | list | `["/code/main.py"]` | Command being run by the cronjob |
| fullnameOverride | string | `""` | Override fullname |
| image.pullPolicy | string | `"IfNotPresent"` | Pull Policy for images in cronjob |
| image.registry | string | `"ghcr.io"` | Image Registry |
Expand Down
5 changes: 2 additions & 3 deletions charts/ecr-cleanup/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ spec:
- name: main
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: IfNotPresent
{{- if .Values.awsRegistryId }}
{{- if or .Values.awsRegistryId .Values.env}}
env:
- name: AWS_REGISTRY_ID
value: "{{ .Values.awsRegistryId }}"
{{- end }}
command:
- /code/main.py
command: {{- .Values.command }}
securityContext:
{{- toYaml .Values.securityContext | nindent 16 }}
resources:
Expand Down
7 changes: 5 additions & 2 deletions charts/ecr-cleanup/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"fullnameOverride": {
"type": "string"
},
"schedule": {
"type": "string"
"command": {
"type": "array"
},
"image": {
"type": "object",
Expand Down Expand Up @@ -43,6 +43,9 @@
"resources": {
"type": "object"
},
"schedule": {
"type": "string"
},
"securityContext": {
"type": "object"
},
Expand Down
4 changes: 4 additions & 0 deletions charts/ecr-cleanup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ nameOverride: ""
# -- Override fullname
fullnameOverride: ""

# -- Command being run by the cronjob
command:
- /code/main.py

serviceAccount:
# -- Specifies whether a service account should be created
create: true
Expand Down

0 comments on commit 33472b6

Please sign in to comment.