container-agent

by phntom

Helm chartv100.0.1App 3Apache-2.0

For deploying a CircleCI Container Agent

About this chart

Container Runner Helm Chart

Contributing

Prerequisites

  • Kubernetes 1.12+
  • Helm 3.x

Installing the Chart

To install the chart with the release name container-agent:

  • Run helm repo add container-agent https://packagecloud.io/circleci/container-agent/helm
  • Run helm repo update
  • Run helm install container-agent container-agent/container-agent -n circleci to install the chart
  • Update the values.yaml file with your resource class token in the tokens key under the agent key

This will deploy the container runner to the Kubernetes cluster as a release called container-agent. You can view the default values by running helm show values circleci/container-agent and override these using the --values or --set name=value flags on the install command below. The Helm Chart Parameters sections list the parameters that can be configured during installation.

Update values.yaml

To run a job with no custom configuration, add the following configuration to the Helm chart values.yaml. MY_TOKEN is your runner resource class token. Update namespace/my-rc with your namespace and runner resource class.

agent:
  resourceClasses:
    namespace/my-rc:
      token: MY_TOKEN

To learn more about setting up Container Runner, read our docs

Uninstalling the Chart

To uninstall the container-agent deployment:

$ helm uninstall container-agent

The command removes all the Kubernetes objects associated with the chart and deletes the release

Helm Chart Parameters

The following tables list the configurable parameters of the container-agent helm chart.

CircleCI Settings

ParameterDescriptionDefault
agent.runnerAPIRunner API URLhttps://runner.circleci.com
agent.taskImagePullSecretsImage pull secrets used when pulling task images""
agent.terminationGracePeriodSecondsTermination grace period during shutdown18300
agent.maxRunTimeMax task run time. Should be shorter than the grace period5h
agent.maxConcurrentTasksMaximum number of tasks claimed/run concurrently20

Kubernetes Object Settings

ParameterDescriptionDefault
nameOverrideOverride the chart name""
fullnameOverrideOverride the full generated name""
agent.replicaCountNumber of container agents to deploy1
agent.image.registryAgent image registry""
agent.image.repositoryAgent image repositorycircleci/container-agent
agent.pullPolicyAgent image pull policyIfNotPresent
agent.tagAgent image taglatest
agent.pullSecretsSecret objects container private registry credentials[]
agent.matchLabelsMatch labels used on agent podsapp: container-agent
agent.podAnnotationsExtra annotations addded to agent pods{}
agent.podSecurityContextSecurity context policies added to agent pods{}
agent.containerSecurityContextSecurity context policies add to agent containers{}
agent.resourcesCustom resource specifications for agent pods{}
agent.nodeSelectorNode selector for agent pods{}
agent.tolerationsNode tolerations for agent pods[]
agent.affinityNode affinity for agent pods{}
agent.taskImagePullSecretsImage pull secrets passed to task pods[]
agent.kubeGCEnabledOption to enabled/disable garbage collectiontrue
agent.kubeGCThresholdLength of time pods can run before deleted by GC5h5m
serviceAcccount.createCreate a custom service account for the agenttrue
rbac.createCreate a role & rolebinding for the service accounttrue

Deploy container-agent with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has container-agent 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 chartcontainer-agent is pinned at v100.0.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