ecs-inventory

by Anchore

Helm chartv0.1.3App 1.5.3

A Helm chart for the Anchore ECS Inventory, which gathers an inventory of images in use by Amazon Elastic Container Service (ECS).

About this chart

Anchore ECS Inventory Helm Chart

Note: this integration requires a valid license or subscription entitlement from Anchore

Anchore ECS Inventory: Anchore ECS Inventory

Anchore ECS Inventory is a tool to gather an inventory of images in use by Amazon Elastic Container Service (ECS) and ship them to the Anchore platform. Anchore ECS Inventory must be able to resolve the Anchore URL and requires API credentials. The minimum version of the Anchore Enterprise platform required for K8s Inventory is 4.7.

Installation

Anchore ECS Inventory creates it's own secret based on your values.yaml file for the following keys that are required for successfully deploying and connecting the ecs-inventory service to the Anchore Platform and AWS ECS Service:

  • ecsInventory.awsAccessKeyId
  • ecsInventory.awsSecretAccessKey

You can install the chart via via:

helm repo add anchore https://charts.anchore.io
helm install <release-name> -f <values.yaml> anchore/ecs-inventory

A basic values file can always be found here. The key configurations are in the ecsInventory section.

Using your own secrets

The (ecsInventory.useExistingSecret and ecsInventory.existingSecretName) or ecsInventory.injectSecretsViaEnv keys allows you to create your own secret and provide it in the values file or place the required secret into the pod via different means such as injecting the secrets into the pod using hashicorp vault.

For example:

  • Create a secret in kubernetes:

    apiVersion: v1
    kind: Secret
    metadata:
      name: ecs-inventory-secrets
    type: Opaque
    stringData:
      ANCHORE_ECS_INVENTORY_ANCHORE_PASSWORD: foobar
      AWS_ACCESS_KEY_ID: someKeyId
      AWS_SECRET_ACCESS_KEY: someSecretAccessKey
    
  • Provide it to the helm chart via the values file:

    ecsInventory:
        useExistingSecret: true
        existingSecretName: "ecs-inventory-secrets"
    

The Anchore API Password and required AWS secret values can also be injected into the environment of the ecs-inventory container. For injecting the environment variable

# set
ecsInventory:
  injectSecretsViaEnv=true

See the ecs-inventory repo for more information about the ECS Inventory specific configuration.

Image Registry

The chart's image is a set of parts rather than one string:

image:
  registry: ""            # empty -> taken from global.imageRegistryHost
  repository: anchore/ecs-inventory
  tag: "vX.Y.Z"

The registry is chosen from three levels, most specific first:

LevelWhereWins over
1. Per-image registryimage.registryeverything below
2. global.imageRegistryHostone value for the whole chartthe chart defaults
3. Chart defaultdocker.io—

Stated as one rule:

An image value that states no registry of its own takes one from global.imageRegistryHost. An image value that does state one keeps it.

To mirror the image, set the global once:

global:
  imageRegistryHost: harbor.example.com

Only the registry comes from the global — the repository and tag stay with the chart, so chart upgrades keep moving the version. global.imageRegistryHost may include a path, eg. harbor.example.com/anchore.

An image value may also be given as a complete reference string (image: myregistry.example.com/anchore/ecs-inventory:vX.Y.Z), which is used as written. A string that states no registry host takes one from the global like any other value.

Parameters

Global Resource Parameters

NameDescriptionValue
global.imageRegistryHostregistry host used by every image value that does not set its owndocker.io

Common Resource Parameters

NameDescriptionValue
replicaCountNumber of replicas for the Ecs Inventory deployment1
image.registryRegistry for the ECS Inventory image. Empty means take it from global.imageRegistryHost""
image.repositoryRepository for the ECS Inventory imageanchore/ecs-inventory
image.tagTag for the ECS Inventory imagev1.5.3
imagePullPolicyImage pull policy used by all deploymentsIfNotPresent
imagePullSecretNameName of Docker credentials secret for access to private repos""
serviceAccountNameName of a service account used to run all Anchore Ecs Inventory pods""
useExistingSecretset to true to use an existing/precreated secretfalse
existingSecretNamethe name of the precreated secret""
injectSecretsViaEnvEnable secret injection into pod environment variablesfalse
extraEnvextra environment variables. These will be set on all containers.[]
annotationsCommon annotations set on all Kubernetes resources{}
deploymentAnnotationsannotations to set on the ecs-inventory deployment{}
containerSecurityContextThe securityContext for all Anchore ECS Inventory containers{}
securityContext.runAsUserThe securityContext runAsUser for all Anchore ECS Inventory pods1000
securityContext.runAsGroupThe securityContext runAsGroup for all Anchore ECS Inventory pods1000
securityContext.fsGroupThe securityContext fsGroup for all Anchore ECS Inventory pods1000
resourcesResource requests and limits for Anchore ECS Inventory pods{}
nodeSelectorNode labels for pod assignment{}
tolerationsTolerations for pod assignment[]
affinityAffinity for pod assignment{}
labelsAdds additionnal labels to all kubernetes resources{}
probes.liveness.initialDelaySecondsInitial delay seconds for liveness probe1
probes.liveness.timeoutSecondsTimeout seconds for liveness probe10
probes.liveness.periodSecondsPeriod seconds for liveness probe5
probes.liveness.failureThresholdFailure threshold for liveness probe6
probes.liveness.successThresholdSuccess threshold for liveness probe1
probes.readiness.timeoutSecondsTimeout seconds for the readiness probe10
probes.readiness.periodSecondsPeriod seconds for the readiness probe15
probes.readiness.failureThresholdFailure threshold for the readiness probe3
probes.readiness.successThresholdSuccess threshold for the readiness probe1

ecsInventory Parameters

NameDescriptionValue
ecsInventory.quietDetermine whether or not to log the inventory report to stdoutfalse
ecsInventory.outputThe output format of the report (options: table, json)json
ecsInventory.logLevelthe level of verbosity for logsinfo
ecsInventory.logFilelocation to write the log file (default is not to have a log file)""
ecsInventory.pollingIntervalSecondsThe polling interval of the ECS API in seconds60
ecsInventory.anchoreUrlthe url of the anchore platformhttp://localhost:8228
ecsInventory.anchoreAccountthe account of the anchore platformadmin
ecsInventory.anchoreUserthe username of the anchore platformadmin
ecsInventory.anchorePasswordthe password of the anchore platformfoobar
ecsInventory.anchoreHttpInsecurewhether or not anchore is using ssl/tlstrue
ecsInventory.anchoreHttpTimeoutSecondsthe amount of time in seconds before timing out10
ecsInventory.awsAccessKeyIdthe AWS Access Key IDfoobar
ecsInventory.awsSecretAccessKeythe AWS Secret Access Keyfoobar
ecsInventory.awsRegionthe AWS Regionus-west-2

Release Notes

  • Major Chart Version Change (e.g., v0.1.2 -> v1.0.0): Signifies an incompatible breaking change that necessitates manual intervention, such as updates to your values file or data migrations.
  • Minor Chart Version Change (e.g., v0.1.2 -> v0.2.0): Indicates a significant change to the deployment that does not require manual intervention.
  • Patch Chart Version Change (e.g., v0.1.2 -> v0.1.3): Indicates a backwards-compatible bug fix or documentation update.

v0.1.2

  • Documentation and test maintenance: regenerated the README parameters table and de-pinned the chart tests from the release version. No deployment changes.

v0.1.0

The image value is now a dict, and the registry can be set once for the whole chart.

  • Adds global.imageRegistryHost. An image value that states no registry of its own takes one from it, so mirroring the Anchore images is a single setting. See Image Registry.
  • image is now registry / repository / tag rather than a reference string. Setting registry points that image at a different registry without pinning its version, so chart upgrades keep moving the tag. A complete reference string is still accepted and is used as written, so existing values files continue to work.
  • Rendered image references now always include the registry host, so anchore/ecs-inventory:v1.5.1 renders as docker.io/anchore/ecs-inventory:v1.5.1. This resolves to the same image and is a no-op for pulls, but it changes the pod spec, so an upgrade will show a diff and roll the pods.

No values changes are required to upgrade.

Deploy ecs-inventory with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has ecs-inventory 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 chartecs-inventory is pinned at v0.1.3 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