Skip to content

Commit

Permalink
feat: allow schedule to be customized
Browse files Browse the repository at this point in the history
  • Loading branch information
knechtionscoding committed Apr 4, 2023
1 parent f8695c6 commit 63ed402
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ repos:
# Make the tool search for charts only under the `example-charts` directory
- --chart-search-root=deploy/chart/ecr-cleanup

# The `./` makes it relative to the chart-search-root set above
- --template-files=./_templates.gotmpl
# # The `./` makes it relative to the chart-search-root set above
# - --template-files=./_templates.gotmpl

# Repeating the flag adds this to the list, now [./_templates.gotmpl, README.md.gotmpl]
# A base filename makes it relative to each chart directory found
Expand Down
2 changes: 1 addition & 1 deletion deploy/chart/ecr-cleanup/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,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: 0.2.1
version: 0.2.2

# 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
35 changes: 2 additions & 33 deletions deploy/chart/ecr-cleanup/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,7 @@ 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.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square)

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| awsRegistryId | string | `nil` | ECR Registry ID to override picking the default |
| fullnameOverride | string | `""` | Override fullname |
| image.pullPolicy | string | `"IfNotPresent"` | Pull Policy for images in cronjob |
| image.registry | string | `"ghcr.io"` | Image Registry |
| image.repository | string | `"knechtionscoding/ecr-cleanup"` | Image Repository |
| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. |
| imagePullSecrets | list | `[]` | List of imagePullSecrets to use when getting images |
| nameOverride | string | `""` | Overriding the Name |
| podAnnotations | object | `{}` | Annotations to add to the pod |
| podSecurityContext | object | `{}` | Security Context for Pod |
| resources | object | `{}` | Resources for container in cronjob |
| securityContext | object | `{}` | Security Context for container in cronjob |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| 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 |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
# ecr-cleanup

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

Deploys a job that cleans up an ECR repo based on the following rules.
1. Is a container currently referenced in the same K8s cluster that this job is running in
2. Has the container been pulled in the last 7 days
3. Has the container been tagged with the word `keep`
4. Is the container the only tag in the ECR repository
![Version: 0.2.2](https://img.shields.io/badge/Version-0.2.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square)

## Values

Expand All @@ -55,6 +23,7 @@ Deploys a job that cleans up an ECR repo based on the following rules.
| podAnnotations | object | `{}` | Annotations to add to the pod |
| podSecurityContext | object | `{}` | Security Context for Pod |
| resources | object | `{}` | Resources for container in cronjob |
| schedule | string | `"* 0 * * * "` | |
| securityContext | object | `{}` | Security Context for container in cronjob |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
Expand Down
2 changes: 1 addition & 1 deletion deploy/chart/ecr-cleanup/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
labels:
{{- include "ecr-cleanup.labels" . | nindent 4 }}
spec:
schedule: "* 0 * * *"
schedule: {{ .Values.schedule }}
jobTemplate:
spec:
template:
Expand Down
3 changes: 3 additions & 0 deletions deploy/chart/ecr-cleanup/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"fullnameOverride": {
"type": "string"
},
"schedule": {
"type": "string"
},
"image": {
"type": "object",
"properties": {
Expand Down
1 change: 1 addition & 0 deletions deploy/chart/ecr-cleanup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

schedule: "* 0 * * * "
image:
# -- Image Registry
registry: ghcr.io
Expand Down

0 comments on commit 63ed402

Please sign in to comment.