kcd

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2018 License: MIT Imports: 24 Imported by: 0

README

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

CVManager

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

Deployments that requires CI/CD, can declare ContainerVersion resource. CVManager, ContainerVersion (CV) 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.

CVManager assumes ECR as the container registry. Supporting other registeries is T2D.

The tool has 3 main parts:

  • CV Manager
  • Docker Registry Syncer (supports ECR and Dockerhub)
  • Docker Registry Tagger (supports ECR, with limited Dockerhub support)

architecture

Docker images are on docker.io

CVManager: Controller service

ContainerVersion controller that manages ContainerVersion resources.

Run locally
 cvmanager run --k8s-config ~/.kube/config --configmap-key=kube-system/cvmanager

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
    cvmanager cr sync \
    --namespace=usdev-api \
    --provider=ecr \
    --cv=photos-cv \
    --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
    cvmanager cr tags get \
    --repo  nearmap/cvmanager  \
    --version <SHA>
Add Tag
    cvmanager cr tags remove \
    --repo  nearmap/cvmanager  \
    --tags env-audev-api,env-usdev-api \
    --version <SHA>
Remove Tag
    cvmanager cr tags remove \
    --repo  nearmap/cvmanager  \
    --tags env-audev-api,env-usdev-api
Supporting other docker registries

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

Building and running CVManager

Build & Run
docker build -t nearmap/cvmanager .
docker run -ti  nearmap/cvmanager <command>
Testing with docker-compose
 docker-compose down
 docker-compose rm -f
 docker-compose up --force-recreate --build --abort-on-container-exit

Deploying CVManager to Kubernetes cluster

CVManager 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/cv/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-cv",
      "Tag":"env-usdev-api"
   }
]
  • Html format can also be queried using format query, supported values are json/html. eg. http://localhost:8081/v1/cv/workloads?format=html see example

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

    cvmanager cv get --k8s-config ~/.kube/config

Rollout history

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

  • When history option is chosen, REST interface http://<host>:8081/v1/cv/workloads/cvmanagerapp?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 cvmanagerapp.history see example

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
gok8s
apis/custom/v1
Package v1 is the v1 version of the API.
Package v1 is the v1 version of the API.
client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/clientset/versioned/typed/custom/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/clientset/versioned/typed/custom/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.
ecr
datadog
Package datadog provides stats logging using datadog.
Package datadog provides stats logging using datadog.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL