Skip to content

nearmap/kcd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KCD

CircleCI Go Report Card GoDoc Docker Pulls GitHub (pre-)release

kcd

Kubernetes Continous Delivery (kcd), formally known as Container Version Manager (kcd), is a continous integration (CI) and continous delivery (CD) tool designed for Kubernetes cluster/services. Fundamentally, kcd is a custom Kubernetes controller to achieve a declarative configuration approach to continuous deployment.

Deployments that requires CI/CD, can declare KCD resource. kcd, KCD (Kubernetes Continous Delivery) controller starts monitoring for any new changes that should be rolled-out. If so, using the rollout strategy specified in this deployment, the rollout of new version is carried out.

kcd assumes ECR as the container registry. Supporting other registeries is T2D (see).

The tool has 3 main parts:

  • KCD Controller
  • KCD Syncer: Docker Registry Syncer (supports ECR and Dockerhub)
  • KCD Tagger: Docker Registry Tagger (supports ECR, with limited Dockerhub support)

architecturekcd logo.png

Docker images are on docker.io

kcd: Controller service

Container version controller that manages KCD resources.

Run locally

 kcd run --k8s-config ~/.kube/config --configmap-key=kube-system/kcd

Docker registry sync service

Registry sync service is a polling service that frequently check on registry (AWS ECR and dockerhub only) to see if new version should be rolled out for a given deployment/container.

Sync service default to using AWS ECR as regisrty provider but dockerhub is also supported. Use --provider dockerhub to use syncer service against dockerhub repo.

Dockerhub note: Dockerhub has very limited support w.r.t. tags via API and also multi-tag support is very limited. see 1, 2, 3 and 4 for more info. When using dockerhub, regisrty syncer monitors a tag (example latest) and when the latest image is change i.e. the digest of the image is changed Syncer picks it up as a candidate deployment and deploys new version.

Run locally

    kcd registry sync \
    --namespace=usdev-api \
    --provider=ecr \
    --kcd=photos-kcd \
    --k8s-config ~/.kube/config

ECR Tagger Util

A tagging tool that integrates with CI side of things to manage tags on the ECR repositories.

Get Tag

    kcd registry tags get \
    --repo  nearmap/kcd  \
    --version <SHA>

Add Tag

    kcd registry tags remove \
    --repo  nearmap/kcd  \
    --tags env-audev-api,env-usdev-api \
    --version <SHA>

Remove Tag

    kcd registry tags remove \
    --repo  nearmap/kcd  \
    --tags env-audev-api,env-usdev-api

Supporting other docker registries

We plan to support other docker registries as well in future via kcd.

Building and running kcd

Build & Run

docker build -t nearmap/kcd .
docker run -ti  nearmap/kcd <command>

Testing with docker-compose

 docker-compose down
 docker-compose rm -f
 docker-compose up --force-recreate --build --abort-on-container-exit

Deploying kcd to Kubernetes cluster

kcdanage is only supported on Kubernetes >= 1.9

kcd can be deployed using:

  1. Kubectl: yaml specs for Kubenetes configuration is here
  2. Helm: Helm chart spec is here and helm package is avaialble here

Please see for more info.

Getting current version of all CV managed deployments

  • REST API http://<host>:8081/v1/kcd/workloads is exposed that return naive html page with tabluar data of all CV managed deployments and current version eg.
[
   {
      "Namespace":"usdev-api",
      "Name":"photosapp",
      "Type":"Deployment",
      "Container":"photosapp-container",
      "Version":"d5dd6d366c1446cc9c0451096deeae3a8f3be48f",
      "AvailablePods":2,
      "CV":"photos-kcd",
      "Tag":"env-usdev-api"
   }
]
  • Html format can also be queried using format query, supported values are json/html. eg. http://localhost:8081/v1/kcd/workloads?format=html see example

  • Same can also be generated by (use --k8s-config only if running outside cluster:

    kcd rd get --k8s-config ~/.kube/config

Rollout history

Use --history CLI option on kcd to capture release history in configmap.

  • When history option is chosen, REST interface http://<host>:8081/v1/kcd/workloads/kcdapp?namespace=kube-system, details the update/rollout history. see example

  • The history is stored in configmap under same namespace as workload resource with configmap name <workload_resource_name>.history eg kcdapp.history see example

Reference links