ecr-cleanup

by joaquinito2051

Helm chartv0.1.1App 0.1.5

A Helm chart to run ecr cleanup controller

About this chart

ECR Cleanup

Cleans up unused ECR images using this

Config

ParameterDescriptionDefaultRequired
controller.dryRunfalseyes
controller.interval60yes
controller.maxImages900yes
controller.namespacesdefaultyes
controller.regionus-east-1yes
controller.repossudermanjr-testyes
controller.registryID""no
controller.verbosity1yes
fullnameOverride no
image.pullPolicyAlwaysno
image.repositorydanielfm/kube-ecr-cleanup-controllerno
image.tag0.1.3no
nameOverride no
nodeSelector{}no
rbac.createTrueno
replicaCount1no
resources.limits.cpu100mno
resources.limits.memory128Mino
resources.requests.cpu100mno
resources.requests.memory128Mino
tolerations[]no
affinity{}no

AWS Policy

The following IAM policy is needed for the controller to work.

{
  "Version": "2008-10-17",
  "Statement": [
    {
      "Sid": "${POLICYNAME}",
      "Effect": "Allow",
      "Principal": {
        "AWS": [
          "arn:aws:iam::${ACCOUNT_ID}:role/${ROLENAME}"
        ]
      },
      "Action": [
        "ecr:BatchDeleteImage",
        "ecr:BatchGetImage",
        "ecr:DescribeImages",
        "ecr:ListImages"
      ]
    }
  ]
}

Deploy ecr-cleanup with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has ecr-cleanup on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartecr-cleanup is pinned at v0.1.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply